




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、 Nagios安装与配置安装环境:centos-5.5Nagios是一款用于系统和网络监控的应用程序。它可以在你设定的条件下对主机和服务进行监控,在状态变差和变好的时候给出告警信息。安装apache,php前提:#yum y install *gcc*安装freetype (FreeType库是一个 开源的、高质量的且可移植的字体引擎)# tar -zxvf freetype-2.4.3.tar.gz -C /usr/src/# cd /usr/src/freetype-2.4.3/# ./configure -prefix=/usr/local/freetype-2.4.3# make# m
2、ake install安装libpng (支持对 PNG 图形文件的创建、读写等操作)# tar -zxvf libpng-1.4.4.tar.gz -C /usr/src/# cd /usr/src/libpng-1.4.4/# ./configure -prefix=/usr/local/libpng-1.4.4# make# make install3、安装jpeg (显示JPEG图像)# tar -zxvf jpegsrc.v8b.tar.gz -C /usr/src/# cd /usr/src/jpeg-8b/# ./configure -prefix=/usr/local/jpeg
3、-8b# make# make install安装GD库重新加载 lib # ldconfig# ldconfig -p | grep jpeg# ldconfig -p | grep free# ldconfig -p | grep libpng# tar -zxvf gd-2.0.33.tar.gz -C /usr/src/# cd /usr/src/gd-2.0.33/# ./configure -prefix=/usr/local/gd-2.0.33 -with-jpeg=/usr/local/jpeg-8b/ -with-freetype=/usr/local/freetype-2.
4、4.3/ -with-png=/usr/local/libpng-1.4.4/ -with-zlib -enable-m4_pattern_allow解决方法:# vim gd_png.c找到png.h 改为 /usr/local/libpng-1.4.4/include/png.h# make# make install安装apache# rpm -e httpd -nodeps 把rpm安装的httpd包卸载# tar -zxvf httpd-2.2.15.tar.gz -C /usr/src/# cd /usr/src/httpd-2.2.15/# ./configure -prefix
5、=/usr/local/apache-2.2.15 -enable-so -enable-rewrite# make# make install安装php# tar -zxvf php-5.2.10.tar.gz -C /usr/src/# cd /usr/src/php-5.2.10/# ./configure -prefix=/usr/local/php-5.2.10 -with-apxs2=/usr/local/apache-2.2.15/bin/apxs -with-zlib -with-libxml-dir -enable-gd-native-ttf -enable-mbstring
6、 -with-gd=/usr/local/gd-2.0.33/ -with-freetype-dir=/usr/local/freetype-2.4.3/ -with-jpeg-dir=/usr/local/jpeg-8b/ -with-png-dir=/usr/local/libpng-1.4.4/解决方法:放入系统光盘 yum y install libxml2* libxml2是一个xml C语言的解析器和工具# make# make test# make install Apaceh与php整合# vim /usr/local/apache/conf/httpd.conf53 Load
7、Module php5_module modules/libphp5.so54 AddType application/x-httpd-php .php167 168 DirectoryIndex index.php index.html169 解决方法:# make clean # /usr/src/php- php-5.2.10#make install解决方法:重新make之前要make clean# /usr/local/apache/bin/apachectl start验证:HYPERLINK http:/localhosthttp:/localhost安装nagios1、创建系统
8、用户# useradd nagios# passwd nagios# groupadd nagcmd# usermod -G nagcmd nagios# usermod -G nagcmd apache安装nagios# tar -zxvf nagios-3.1.2.tar.gz -C /usr/src/# cd /usr/src/nagios-3.1.2/# ./configure -with-command-group=nagcmd# make all# make install# make install-init# make install-config# make install-
9、commandmode 修改配置文件:# vim /usr/local/nagios/etc/objects/contacts.cfg35 email HYPERLINK mailto: 更改email接收报警内容# make install-webconf 安装nagios的web配置文件到apache的conf.d目录下/usr/bin/install: 无法创建一般文件“/etc/httpd/conf.d/nagios.conf”: 没有那个文件或目录make: * install-webconf 错误 1解决方法以:# mkidr p /etc/httpd/conf.d# vim /u
10、sr/local/apache/conf/httpd.conf: -r /etc/httpd/conf.d/nagios.conf 将文件导入到apache配置文件中# /usr/local/apache/bin/apachectl start 启动apache# /usr/local/apache/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users test 创建登录nagios用户3、安装插件1)、nagios-plugis# tar -zxvf nagios-plugins-1.4.14.tar.gz -C /usr/src/# cd
11、 /usr/src/nagios-plugins-1.4.14/# ./configure -with-nagios-user=nagios -with-nagios-group=nagios# make# make install到此,nagios已经安装完成,需要做以下设置,启动Nagios# chkconfig add nagios 将nagios添加到服务中# chkconfig nagios on 设置服务开机启动# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 检查nagios配置是否正确# ser
12、vice nagios start 启动nagios# setenforce 0 关闭selinux验证:http:/localhost/nagios解决方法:# vim /usr/local/nagios/etc/cgi.cfg78 use_authentication=0# service nagios restart(修改nagios侧边栏 /usr/local/nagios/share/side.php)Nagios配置文件# cd /usr/local/nagios/etc/# ll总计 88-rw-rw-r- 1 nagios nagios 11408 06-16 16:39 cg
13、i.cfgCGI配置文件 -rw-r-r- 1 root root 36 06-16 17:58 htpasswd.usersApache 验证密码文件-rw-rw-r- 1 nagios nagios 43825 06-17 00:55 nagios.cfgNagios 主配置文件drwxrwxr-x 2 nagios nagios 4096 06-17 01:39 objects监控对象定义文件目录-rw-rw- 1 nagios nagios 1340 06-16 00:45 resource.cfgNagios 资源配置文件Nagios主配置文件vim /usr/local/nagio
14、s/etc/nagios.cfglog_file=/usr/local/nagios/var/nagios.log nagios日志文件cfg_file=/usr/local/nagios/etc/objects/commands.cfg命令配置文件cfg_file=/usr/local/nagios/etc/objects/contacts.cfg联系人配置文件cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg时间周期配置文件cfg_file=/usr/local/nagios/etc/objects/templates.cfg模板配
15、置文件cfg_file=/usr/local/nagios/etc/objects/localhost.cfg默认监控本机的配置cfg_file=/usr/local/nagios/etc/objects/windows.cfg监控windows配置文件nagios监控linux服务器服务器:centos 5.5 nagios nagios-plugis nrpe客户端:centos 5.5 nagios-plugins nrpe因为监控都是依靠插件去完成的,而监控linux主要使用nrpe插件服务器端安装nrpe# tar -zxvf nagios-nrpe_2.8.1.orig.tar.g
16、z -C /usr/src/# rpm -qa | grep sslopenssl-0.9.8e-12.el5_4.6# cd /usr/src/nrpe-2.8.1/# ./configure -enable-ssl -with-ssl-lib=/lib/configure: error: Cannot find ssl libraries解决方法:# yum -y install openssl-devel# make all# make install-plugin# vim /usr/local/nagios/etc/objects/commands.cfg# 添加#check nrp
17、edefine command command_name check_nrpe command_line $US ER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ # vim /usr/local/nagios/etc/nagios.cfg 配置要监控的linux主机添加:37 cfg_file=/usr/local/nagios/etc/objects/mylinux.cfg# vim /usr/local/nagios/etc/objects/mylinux.cfg 新建监控内容define host use linux-server host_name
18、 mylinux alias mylinux address 1(客户端IP既被监控的IP) define service use generic-service host_name mylinux service_description check-swap check_command check_nrpe!check_swap define service use generic-service host_name mylinux service_description check-load check_command check_nrpe!check_load define servic
19、e use generic-service host_name mylinux service_description check-disk check_command check_nrpe!check_had1define service use generic-service host_name mylinux service_description check-users check_command check_nrpe!check_users define service use generic-service host_name mylinux service_description
20、otal_procs check_command check_nrpe!check_total_procs# service nagios restart客户端配置# useradd nagios# passwd nagios1、安装nagios-plugins# tar -zxvf nagios-plugins-1.4.14.tar.gz -C /usr/src/# cd /usr/src/nagios-plugins-1.4.14/# ./configure -with-nagios-user=nagios -with-nagios-group=nagios# make # make in
21、stall# chown -R nagios.nagios /usr/local/nagios/# cd /usr/local/nagios/2、安装nagios-nrpe# tar -zxvf nagios-nrpe_2.8.1.orig.tar.gz -C /usr/src/# cd /usr/src/nrpe-2.8.1/# ./configure -enable-ssl -with-ssl-lib=/usr/lib# make all# make install-plugin# make install-daemon# make install-daemon-config# vim /
22、usr/local/nagios/etc/nrpe.cfg72 allowed_hosts=# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg d 启动nrpe# netstat -tulnp | grep 5666 验证nrpe服务器测试# /usr/local/nagios/libexec/check_nrpe -H NRPE v2.8.1客户端配置监控对象# vim /usr/local/nagios/etc/nrpe.cfg这一步是关键,如果nagios服务器想要监控客户机swap分区,但客户机nrpe.cfg文件没有swap监控对像,这时监控服务器就是报错(NRPE command check_swapno defined)至此,查看nagios监控。客户端已经被加入进来。监控windows客户端客户端安装软件:
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 餐饮行业公司介绍
- 青志协工作总结
- 四年级信息技术上册 第一单元 电子作文 1.2 设置文本格式教学设计2 浙江摄影版
- 五年级品德与社会下册 我们的地球村教学设计 新人教版
- 一年级道德与法治上册 第三单元 我爱我家 11《把我的爱传给大家》教学设计设计2 鄂教版
- 人教版二年级数学上册全册教案3
- 质量改进工作总结
- 全国人教版信息技术八年级下册第一单元第2课《改变线型和颜色》教学设计
- 神经病学脑血管疾病护理
- 过年手抄报课件
- 《基于作业成本法的S公司物流成本分析研究》8300字(论文)
- 浙江省温州市重点中学2025届高三二诊模拟考试英语试卷含解析
- DB37T 4516-2022 高速公路边坡光伏发电工程技术规范
- 菏泽学院无机化学(专升本)复习题
- 虚实互动:人机协同探秘知到智慧树章节答案
- 2023年云上贵州大数据有限公司社会招聘笔试真题
- 工业自动化设备安装调试方案
- 2024年四川省公务员考试《行测》真题及答案解析
- 小学项目式学习培训
- 委托加工灯具合同模板
- 加油站变更管理制度
评论
0/150
提交评论