Chinaunix首页 | 论坛 | 博客
  • 博客访问: 103472
  • 博文数量: 22
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 235
  • 用 户 组: 普通用户
  • 注册时间: 2014-05-15 21:44
个人简介

Just start from your heart.

文章分类

全部博文(22)

文章存档

2015年(5)

2014年(17)

我的朋友

分类: LINUX

2015-02-03 14:46:21

nagios+cacti整合的安装文档

安装环境LAMP

1.1 yum安装httpd、mysqld、php及依赖包


  1. yum -y install gcc* glibc* gd* php* mysql* http* 
  2. yum -y install httpd mysql-server perl-DBI perl-DBD-MySQL php php-devel php-mysql php-snmp php-pdophp-gd lm_sensors net-snmp net-snmp-libs net-snmp-utils net-snmp-devel
  3. chkconfig mysqld on 
  4. chkconfig httpd on 
  5. chkconfig snmpd on
  6. service mysqld start 
  7. service httpd start 
  8. service snmpd start


1.2测试mysql、php、Apache是否安装成功

编写php的测试页面


  1. vim /var/www/html/index.php
  2. <?php
  3. phpinfo();
  4. ?>


访问

 

1.3创建cacti的数据库及cacti用户并赋予cacti用户权限


  1. mysqladmin -u root password '123'
  2. [root@localhost yum.repos.d]# mysql -u root -p
  3. Enter password:
  4. Welcome to the MySQL monitor. Commands end with ; or \g.
  5. Your MySQL connection id is 4
  6. Server version: 5.1.73 Source distribution 
  7. Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 
  8. Oracle is a registered trademark of Oracle Corporation and/or its
  9. affiliates. Other names may be trademarks of their respective
  10. owners. 
  11. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
  12. mysql>Create database cacti default character set utf8;
  13. Query OK, 1 row affected (0.00 sec) 
  14. mysql>Grant all on cacti.* to cacti@localhost identified by '123';
  15. Query OK, 0 rows affected (0.03 sec)
  16. mysql>Flush privileges;
  17. Query OK, 0 rows affected (0.00 sec) 
  18. mysql> quit
  19. Bye


安装cacti

2.1安装rrdtool需要的软件包


  1. yum -y install cairo-devel libxml2-devel pango pango-devel 


2.2安装rrdtool


  1. tar zxvf rrdtool-1.4.4.tar.gz
  2. cd rrdtool-1.4.4
  3. ./configure --prefix=/usr/local/rrdtool
  4. make
  5. make install
  6. ln -s /usr/local/rrdtool/bin/* /usr/local/bin/ #此步非常重要


2.3安装cacti-0.8.7.e中文版


  1. wget http://blogimg.chinaunix.net/blog/upfile2/090815172648.gz 
  2. tar xvf090815172648.gz -C /var/www/html 
  3. cd /var/www/html 
  4. mv cacti-0.8.7e-cn-utf8/ cacti
  5. mysql -u cacti -p cacti < cacti/cacti.sql / 导入数据库
  6. Enter password: 


2.4创建cacti用户


  1. useradd cacti
  2. chown -R cacti:cacti /var/www/html/cacti/
  3. chmod -R 777 /var/www/html/cacti/


2.5修改cacti配置文件连接数据库


  1. vim /var/www/html/cacti/include/config.php
  2. $database_username = "cacti";
  3. $database_password = "123"


2.6添加crontab每五分钟刷新一次


  1. crontab –e
  2. */5 * * * * /usr/bin/php /var/www/html/cacti/poller.php >/dev/null2>&1
  3. service crond restart


浏览器初始化cacti

3.1浏览器输入初始化cacti

如果打开网页页面出现空白那么说明数据库没有导入进去重新导入数据库后重启httpd服务即可

 

注意:RRDTOOLS版本默认为1.0.x改为1.3.x就行了

 

3.2如果打开未看到生成图像请手动执行下面命令


  1. /usr/bin/php/var/www/cacti/poller.php &>/dev/null手动生成图像


3.3字体在图形中显示不正常的解决方法

下载并安装中文字体这个是微米黑字体


  1. wgethttp://sourceforge.net/projects/wqy/files/wqy-microhei/0.2.0-beta/wqy-microhei-0.2.0-beta.tar.gz
  2. tar zxvf wqy-microhei-0.2.0-beta.tar.gz
  3. cd wqy-microhei
  4. cp wqy-microhei.ttc /usr/share/fonts/wqy-microhei.ttc


安装完成后注意在"设置"中更改下面两个必改项.

常规->RRDTool应用程序版本改为1.3.x,默认为1.0.x.不改可能图像不能正常显示出来.

路径->RRDTool默认字体路径改为上面安装的文件路径如/usr/share/fonts/wqy-microhei.ttc

 

安装cacti的插件

4.1安装插件cacti-plugin


  1. gunzip 51CTO下载-cacti-plugin-0.8.7d-PA-v2.4-cn-utf8.diff.gz
  2. mv 51CTO下载-cacti-plugin-0.8.7d-PA-v2.4-cn-utf8.diff /var/www/html/cacti/
  3. cd /var/www/html/cacti/
  4. mv 51CTO下载-cacti-plugin-0.8.7d-PA-v2.4-cn-utf8.diff cacti-plugin-0.8.7d-PA-v2.4-cn-utf8.diff
  5. patch -p1 -N < cacti-plugin-0.8.7d-PA-v2.4-cn-utf8.diff
  6. mysql -ucacti -p123 cacti <pa.sql


4.2页面设置插件

控制面板—用户管理—admin


插件管理打钩—保存


看到控制面板—配置多个了插件管理


 

4.3安装Settings插件


  1. [root@nagios ~]# cd /usr/local/src/
  2. [root@nagios nagios]# wget http://docs.cacti.net/_media/plugin:settings-v0.7-1.tgz
  3. [root@nagios nagios]# mv plugin:settings-v0.7-1.tgz settings-v0.7-1.tgz
  4. [root@nagios nagios]# tar zxvf settings-v0.7-1.tgz -C /var/www/html/cacti/plugins/


4.4安装Monitor插件

设备在线状态监控插件,在cacti页面host中设置了的主机会在monitor页面显示在线状态,可以和thold插件配置报警.


  1. [root@nagios nagios]# wget http://docs.cacti.net/_media/plugin:monitor-v1.3-1.tgz
  2. [root@nagios nagios]mv plugin\:monitor-v1.3-1.tgz monitor-v1.3-1.tgz
  3. [root@nagios nagios]# tar zxvf monitor-v1.3-1.tgz -C /var/www/html/cacti/plugins/


在页面上点击插件中安装和启用来启用插件

 

4.5 cacti插件的设置

直接在页面点击安装和启用后没有出现插件,可以在confi.php配置文件中设置


  1. [root@nagios nagios]# vi /var/www/html/cacti/include/config.php
  2. $plugins[] = 'npc';
  3. $plugins[] = 'monitor'


安装nagios

5.1建nagios用户


  1. useradd nagios
  2. mkdir -p /usr/local/nagios
  3. chown -R nagios.nagios /usr/local/nagios/
  4. chmod -R 755 /usr/local/nagios/


5.2编译安装nagios


  1. tar xvf nagios-3.2.0.tar.gz
  2. cd nagios-3.2.0
  3. ./configure --prefix=/usr/local/nagios/
  4. make all
  5. make install
  6. make install-init
  7. make install-commandmode
  8. make install-config
  9. make install-webconf
  10. chkconfig --add nagios
  11. chkconfig nagios on
  12. service nagios start


5.3安装nagios插件


  1. tar xvf nagios-plugins-1.4.14.tar.gz
  2. cd nagios-plugins-1.4.14
  3. ./configure --prefix=/usr/local/nagios/ && make&& make install


5.4安装nagios的汉化包


  1. tar xvf nagios-cn-3.2.0.tar.bz2
  2. cd nagios-cn-3.2.0
  3. ./configure ;
  4. make all ;
  5. make install


5.5安装sendmail


  1. yum install sendmail
  2. service sendmail start


5.6建立登陆的用户名密码


  1. htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin首次创建用-c


5.7修改nagios.cfg文件添加文件路径信息


  1. vim /usr/local/nagios/etc/objects/nagios.cfg //nagios主配置文件
  2. cfg_file=/usr/local/nagios/etc/objects/hosts.cfg //主机配置文件
  3. cfg_file=/usr/local/nagios/etc/objects/services.cfg //服务配置文件
  4. cfg_file=/usr/local/nagios/etc/objects/commands.cfg //命令配置文件
  5. cfg_file=/usr/local/nagios/etc/objects/contacts.cfg //联系人配置文件
  6. cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg //时间配置文件
  7. cfg_file=/usr/local/nagios/etc/objects/templates.cfg //模板文件


5.8修改contacts.cfg文件,修改邮件地址信息


  1. vim /usr/local/nagios/etc/objects/contacts.cfg
  2. email root@localhost


5.9检查nagios的配置文件并重新启动


  1. /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
  2. 重新启动nagios
  3. service nagios restart


整合cacti+nagios

整合cacti和nagios是利用了cacti的一个插件nagiosfor cacti它的原理是将nagios的数据通过ndo2db导入到mysql数据库cacti的库中然后cacti读取数据库信息将nagios

的结果展示出来。

 

6.1安装php-json扩展

因为NPC使用了ExtJS如过没有json的扩展NPC界面无法出来,如果已安装请略过此步。

查看页面是否有php-json,如果没有按照下面的方法安装即可:

 


  1. tar xf php-json-ext-1.2.1.tar.gz
  2. cd php-json-ext-1.2.1
  3. phpize


6.2安装ndoutils插件

需要安装mysql-devel的依赖包前面已经装过这里就不用再装了


  1. wget http://nchc.dl.sourceforge.net/project/nagios/ndoutils-1.x/ndoutils-1.4b9/ndoutils-1.4b9.tar.gz
  2. tar xvf ndoutils-1.4b9.tar.gz
  3. cd ndoutils-1.4b9
  4. ./configure --prefix=/usr/local/nagios/ --with-mysql --with-ndo2db-user=nagios --with-ndo2db-group=nagios --with-ssl --with-ssl-lib --enable-mysql --enable-ssl --with-mysql-inc=/usr/include/mysql --with-mysql-lib=/usr/lib64/mysql --disable-pgsql
  5. make(不用make install)


6.3复制文件


  1. cp src/{ndomod-3x.o,ndo2db-3x,log2ndo,file2sock}/usr/local/nagios/bin/
  2. cp config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg
  3. cp config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg
  4. chmod 644 /usr/local/nagios/etc/ndo*


6.4修改配置文件信息,连接数据库

注意:修改之前先做好备份


  1. vim /usr/local/nagios/etc/ndo2db.cfg //红色数字为行号
  2. 21 ndo2db_user=nagios
  3. 22 ndo2db_group=nagios
  4. 34 socket_type=tcp //将此行#号去掉,socket_type=unix前面加上#号
  5. 102 db_name=cacti //创建的数据库的名字
  6. 111 db_prefix=npc_
  7. 120 db_user=cacti //cacti数据库登陆用户名
  8. 121 db_pass=123 //cacti数据库登陆密码



  1. vim /usr/local/nagios/etc/ndomod.cfg
  2. 25 output_type=tcpsocket //将此行#号去掉,output_type=unixsocket前面加上#号
  3. 39 output=127.0.0.1 //将此行#去掉,output=/usr/local/nagios//var/ndo.sock前面加上#号

6.4启动ndo2db


  1. /usr/local/nagios/bin/ndo2db-3x -c/usr/local/nagios/etc/ndo2db.cfg
  2. ps –elf |grep ndo2db


6.5安装npc插件


  1. wget http://www.constructaegis.com/downloads/npc-2.0.4.tar.gz
  2. tar xvf npc-2.0.4.tar.gz -C /var/www/html/cacti/plugins
  3. chown -R apache.apache /var/www/html/cacti/plugins/npc/


6.6修改nagios配置文件添加如下信息:


  1. vim /usr/local/nagios/etc/nagios.cfg //在最后添加如下行
  2. broker_module=/usr/local/nagios/bin/ndomod-3x.o config_file=/usr/local/nagios/etc/ndomod.cfg 
  3. 注意:broker_module和config_file是一行的


6.7修改数据库的个别字段


  1. mysql -ucacti -p123
  2. mysql>use cacti;
  3. Reading table information for completion of table and column names
  4. You can turn off this feature to get a quicker startup with -A
  5.  
  6. Database changed
  7. mysql>ALTER TABLE npc_eventhandlers ADD long_output TEXT NOT NULL DEFAULT '' AFTER output;
  8. Query OK, 0 rows affected, 1 warning (0.02 sec)
  9. Records: 0 Duplicates: 0 Warnings: 0
  10.  
  11. mysql>ALTER TABLE npc_hostchecks ADD long_output TEXT NOT NULL DEFAULT '' AFTER output;
  12. Query OK, 0 rows affected, 1 warning (0.02 sec)
  13. Records: 0 Duplicates: 0 Warnings: 0
  14.  
  15. mysql>ALTER TABLE npc_hoststatus ADD long_output TEXT NOT NULL DEFAULT '' AFTER output;
  16. Query OK, 0 rows affected, 1 warning (0.03 sec)
  17. Records: 0 Duplicates: 0 Warnings: 0
  18.  
  19. mysql>ALTER TABLE npc_notifications ADD long_output TEXT NOT NULL DEFAULT '' AFTER output;
  20. Query OK, 0 rows affected, 1 warning (0.03 sec)
  21. Records: 0 Duplicates: 0 Warnings: 0
  22.  
  23. mysql>ALTER TABLE npc_servicechecks ADD long_output TEXT NOT NULL DEFAULT '' AFTER output;
  24. Query OK, 0 rows affected, 1 warning (0.02 sec)
  25. Records: 0 Duplicates: 0 Warnings: 0
  26.  
  27. mysql>ALTER TABLE npc_servicestatus ADD long_output TEXT NOT NULL DEFAULT '' AFTER output;
  28. Query OK, 0 rows affected, 1 warning (0.02 sec)
  29. Records: 0 Duplicates: 0 Warnings: 0
  30.  
  31. mysql>ALTER TABLE npc_statehistory ADD long_output TEXT NOT NULL DEFAULT '' AFTER output;
  32. Query OK, 0 rows affected, 1 warning (0.03 sec)
  33. Records: 0 Duplicates: 0 Warnings: 0
  34.  
  35. mysql>ALTER TABLE npc_systemcommands ADD long_output TEXT NOT NULL DEFAULT '' AFTER output;
  36. Query OK, 0 rows affected, 1 warning (0.03 sec)
  37. Records: 0 Duplicates: 0 Warnings: 0
  38.  
  39. mysql>ALTER TABLE npc_services ADD importance smallint(6) NOT NULL DEFAULT '0';
  40. Query OK, 8 rows affected (0.04 sec)
  41. Records: 8 Duplicates: 0 Warnings: 0
  42.  
  43. mysql>ALTER TABLE npc_hosts ADD importance smallint(6) NOT NULL DEFAULT '0';
  44. Query OK, 1 row affected (0.02 sec)
  45. Records: 1 Duplicates: 0 Warnings: 0
  46.  
  47. mysql>ALTER TABLE npc_contacts ADD minimum_importance smallint(6) NOT NULL DEFAULT '0';
  48. Query OK, 1 row affected (0.02 sec)
  49. Records: 1 Duplicates: 0 Warnings: 0
  50.  
  51. mysql> quit
  52. Bye 


6.8重启服务


  1. service mysqld restart 
  2. service httpd restart
  3. service nagios restart
  4. ps -ef |grep ndo2db
  5. kill -9 ndo2db的进程号
  6. 启动ndo2db
  7. /usr/local/nagios/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg


3.4.7 Cacti添加被监控主机

7.1监控端的设置

Cacti中添加监控主机设置方法:

① 添加设备


报错:SNMP错误

解决办法:是因为被监控端没有启动snmp

service snmpd restart

然后到监控端cacti服务器上

snmpwalk -c public -v 2c 192.168.1.222    --> (这个ip为被监控主机的ip)

如果能够接收到被监控机器的数据信息,则表示被监控主机的snmp配置已经完成,没有错误。如果没有接收到被监控主机的数据信息,那么进行第三步操作。

 

 

第三,用root登录被监控主机,修改snmp的配置文件:


  1. vi /etc/snmp/snmpd.conf
  2. 最后配置如下:
  3. syslocation Server Room
  4. syscontact Sysadmin (root@localhost)
  5. rocommunity public 127.0.0.1
  6. agentaddress 161
  7. rocommunity public
  8. rwcommunity private
  9. trapsink 192.168.124.14 public 162 -->这里的ip=192.168.124.14为被监控主机ip


然后,再执行第二步操作即可。

 

 eq \o\ac(○,2)2添加图像

 

 

Nagios NRPE监控远程主机

8.1监控端的设置

监控机安装NRPE


  1. wget http://nchc.dl.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
  2. tar zxvf nrpe-2.12.tar.gz 
  3. cd nrpe-2.12
  4. ./configure --prefix=/usr/local/nagios
  5. make all
  6. make install-plugin
  7. #监控机只需安装到这步


8.2被监控端的设置

8.2.1被监控端添加用户


  1. groupadd nagios
  2. useradd -g nagios -d /usr/local/nagios -s /sbin/nologin nagios


8.2.2被监控端安装nagios- plugins插件

  1. wget http://nchc.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz
  2. tar zxf nagios-plugins-1.4.13.tar.gz
  3. cd nagios-plugins-1.4.13
  4. ./configure --with-nagios-user=nagios --with-nagios-group=nagios --prefix=/usr/local/nagios --with-ping-command="/bin/ping" --with-mysql=/opt/mysql
  5. make
  6. make install

#查看插件文件是否已安装在这个目录

  1. ls /usr/local/nagios/libexec

8.2.3被监控端安装NRPE

  1. wget http://nchc.dl.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
  2. tar zxvf nrpe-2.12.tar.gz
  3. cd nrpe-2.12
  4. ./configure --prefix=/usr/local/nagios
  5. make all
  6. make install-plugin
  7. make install-daemon
  8. make install-daemon-config
  9. chown -R nagios:nagios /usr/local/nagios

8.2.4配置被监控端的NRPE:

  1. vi /usr/local/nagios/etc/nrpe.cfg
  2. allowed_hosts=127.0.0.1,192.168.1.22 #Nagios监控机的地址或域名

修改/etc/hosts.allow增加监控机ip

  1. echo 'nrpe:192.168.1.22' >> /etc/hosts.allow 

8.2.5启动NRPE守护进程:

  1. /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

8.2.6将nrpe加入/etc/rc.local,以便开机自动启动。

  1. echo "/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d" >> /etc/rc.local

8.2.7检查NRPE是否正常:

在被监控机上

  1. /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1

查看相应的端口:

  1. netstat -an |grep 5666

防火墙开启5666允许局域网IP或固定IP连接

 

在监控主机上

  1. /usr/local/nagios/libexec/check_nrpe -H 192.168.1.222 $目标主机地址(被监控端地址)

都应该可以输出NRPE的版本:NRPE v2.12

 

8.2.8检查可监控的服务

在被监控端的nrpe.cfg文件中,可以看到这样的配置:

command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20

这是用来检查CPU负载的。

 

8.2.9配置被监控端的nrpe.cfg

  1. vim /usr/local/nagios/etc/nrpe.cfg
  2. 添加以下内容:
  3. command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
  4. command[check_load]=/usr/local/nagios/libexec/check_cpu.sh -w 80% -c 90%
  5. command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1
  6. command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2
  7. command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
  8. command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
  9. command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
  10. command[check_iostat]=/usr/local/nagios/libexec/check_iostat.sh -d sda -w 6 -c 10
  11. command[check_mysql]=/usr/local/nagios/libexec/check_mysql -H 192.168.0.22 -u nagios -p 123456 -d nagios
  12. command[check_nginx]=/usr/local/nagios/libexec/check_nginx.sh -u 192.168.0.22 -p /status -w 4000 -c 5000
  13. command[check_mem]=/usr/local/nagios/libexec/check_memory.pl -f -w 20 -c 10

如果需要自定参数则使用下面命令

command[check_load]=/usr/local/nagios/libexec/check_load -w $ARG1$ -c $ARG2$

并开启dont_blame_nrpe =1

开启参数将会带来一定的安全风险

 

8.2.10被监控机重启nrpe

  1. ps aux|grep nrpe
  2. kill $pid
  3. /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg –d

8.3监控机NRPE的设置

8.3.1在监控机commands.cfg添加nrpe的定义

  1. vim /usr/local/nagios/etc/objects/commands.cfg
  2. # 'check_nrpe ' command definition
  3. define command{
  4. command_name check_nrpe
  5. command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
  6. }

8.3.2在监控机的/usr/local/nagios/etc/objects/下添加被监控机的配置文件app1.cfg,并配置

在/usr/local/nagios/etc/objects/目录下新建文件:app1.cfg

把app1.cfg添加到nagios主机:

  1. echo "cfg_file=/usr/local/nagios/etc/objects/app1.cfg" >> /usr/local/nagios/etc/nagios.cfg

如果要再添加B机器如法炮制就可以了

  1. Vim app1.cfg
  2. define host{
  3. use linux-server
  4. host_name nagios-client
  5. alias nagios-client
  6. address 192.168.1.222 //被监控端的IP地址
  7. icon_image server.gif
  8. statusmap_image server.gd2
  9. 2d_coords 500,200
  10. 3d_coords 500,200,100
  11. }
  12. define service{
  13. use local-service ; Name of service template to use
  14. host_name *
  15. service_description PING
  16. check_command check_ping!100.0,20%!500.0,60%
  17. }
  18. define service{
  19. use local-service ; Name of service template to use
  20. host_name nagios-client
  21. service_description boot分区
  22. check_command check_nrpe!check_sda1
  23. }
  24. define service{
  25. use local-service ; Name of service template to use
  26. host_name nagios-client
  27. service_description 根分区
  28. check_command check_nrpe!check_sda2
  29. }
  30. define service{
  31. use local-service ; Name of service template to use
  32. host_name nagios-client
  33. service_description 登录用户数
  34. check_command check_nrpe!check_users
  35. }
  36. define service{
  37. use local-service ; Name of service template to use
  38. host_name nagios-client
  39. service_description 进总程数
  40. check_command check_nrpe!check_total_procs
  41. }
  42. define service{
  43. use local-service ; Name of service template to use
  44. host_name nagios-client
  45. service_description CPU平均负载
  46. check_command check_nrpe!check_load
  47. }
  48. define service{
  49. use local-service ; Name of service template to use
  50. host_name nagios-client
  51. service_description 虚拟内存
  52. check_command check_nrpe!check_swap
  53. }
  54. define service{
  55. use local-service ; Name of service template to use
  56. host_name nagios-client
  57. service_description SSH
  58. check_command check_nrpe!check_ssh
  59. notifications_enabled 0
  60. }
  61. define service{
  62. use local-service ; Name of service template to use
  63. host_name nagios-client
  64. service_description 僵死进程数
  65. check_command check_nrpe!check_zombie_procs
  66. }
  67. define service{
  68. use local-service ; Name of service template to use
  69. host_name nagios-client
  70. service_description iostat
  71. check_command check_nrpe!check_iostat
  72. }
  73. define service{
  74. use local-service ; Name of service template to use
  75. host_name nagios-client
  76. service_description mysql
  77. check_command check_nrpe!check_mysql
  78. }
  79. define service{
  80. use local-service ; Name of service template to use
  81. host_name nagios-client
  82. service_description nginx
  83. check_command check_nrpe!check_nginx
  84. }
  85. define service{
  86. use local-service ; Name of service template to use
  87. host_name nagios-client
  88. service_description memory
  89. check_command check_nrpe!check_mem
  90. }
  91. define service{
  92. use local-service ; Name of service template to use
  93. host_name nagios-client
  94. service_description IP连接数
  95. check_command check_nrpe!check_ip_conn
  96. }

8.3.3检查nagios配置文件是否报错

  1. /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

重启监控机nagios

  1. service nagios reload

访问就可以看到新增的机器了
阅读(2604) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~