Nagios被监控端的安装

运维 系统运维
Nagios被监控端安装:Nagios的功能是监控服务和主机,而且提供了友好的WEB界面查看当前的网络状态、通知和故障历史、日志文件…但是他自身并不包括这部分功能的代码,所有的监控、检测功能都是有插件来完成的。本文讲述的是Nagios被监控端的安装

  Nagios监控端安装

  没安装xinetd的要安装

  1.   yum -y install xinetd  
  2.  
  3.   yum -y install xinetd  
  4.  

  安装Nagios插件

  1.   ./configure --with-nagios-user=nagios --with-nagios-group=nagios  
  2.  
  3.   make  
  4.  
  5.   make install  
  6.  
  7.   ./configure --with-nagios-user=nagios --with-nagios-group=nagios  
  8.  
  9.   make  
  10.  
  11.   make install  
  12.  

  安装nrpe

  1.   ./configure  
  2.  
  3.   make all  
  4.  
  5.   make install-daemon  
  6.  
  7.   make install-daemon-config  
  8.  
  9.   make install-xinetd  
  10.  
  11.   ./configure  
  12.  
  13.   make all  
  14.  
  15.   make install-daemon  
  16.  
  17.   make install-daemon-config  
  18.  
  19.   make install-xinetd  
  20.  

  配置nrpe启动

  1.   vi /etc/xinetd.d/nrpe  
  2.  
  3.   service nrpe  
  4.  
  5.   {  
  6.  
  7.   flags = REUSE 
  8.  
  9.   socket_type = stream 
  10.  
  11.   port = 5666 
  12.  
  13.   wait = no 
  14.  
  15.   user = nagios 
  16.  
  17.   group = nagios 
  18.  
  19.   server = /usr/local/nagios/bin/nrpe  
  20.  
  21.   server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd  
  22.  
  23.   log_on_failure += USERID  
  24.  
  25.   disable = no 
  26.  
  27.   only_from = 127.0.0.1 10.3.37.110  
  28.  
  29.   #only_from: allow monit server ip. “ ”ge kai duo ge ip  
  30.  
  31.   }  
  32.  
  33.   vi /etc/xinetd.d/nrpe  
  34.  
  35.   service nrpe  
  36.  
  37.   {  
  38.  
  39.   flags = REUSE 
  40.  
  41.   socket_type = stream 
  42.  
  43.   port = 5666 
  44.  
  45.   wait = no 
  46.  
  47.   user = nagios 
  48.  
  49.   group = nagios 
  50.  
  51.   server = /usr/local/nagios/bin/nrpe  
  52.  
  53.   server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd  
  54.  
  55.   log_on_failure += USERID  
  56.  
  57.   disable = no 
  58.  
  59.   only_from = 127.0.0.1 10.3.37.110  
  60.  
  61.   #only_from: allow monit server ip. “ ”ge kai duo ge ip  
  62.  
  63.   }  
  64.  
  65.   vi /etc/services  
  66.  
  67.   vi /etc/services  
  68.  

  加入以下:

  1.   nrpe 5666/tcp # nrpe  
  2.  
  3.   nrpe 5666/tcp # nrpe  
  4.  

  重启 xinetd 服务

  1.   /etc/init.d/xinetd restart  
  2.  
  3.   /etc/init.d/xinetd restart  
  4.  

  检查nrpe是否正常工作

  在监控端执行以下命令,返回版本则成功。

  /usr/local/nagios/libexec/check_nrpe -H 被监控端ip

  NRPE v2.8.1

  /usr/local/nagios/libexec/check_nrpe -H 被监控端ip

  NRPE v2.8.1

  配置监控命令

  1.   vi /usr/local/nagios/etc/nrpe.cfg  
  2.  
  3.   vi /usr/local/nagios/etc/nrpe.cfg  
  4.  
  5.   # The following examples use hardcoded command arguments...  
  6.  
  7.   ###############  
  8.  
  9.   command[check_users]=/usr/local/nagios/libexec/check_users -w 10 -c 20  
  10.  
  11.   command[check_load]=/usr/local/nagios/libexec/check_load -w 16,10,8 -c 30,25,20  
  12.  
  13.   command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1  
  14.  
  15.   command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2  
  16.  
  17.   command[check_sda5]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda5  
  18.  
  19.   command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z  
  20.  
  21.   command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 300 -c 360  
  22.  
  23.   command[check_http]=/usr/local/nagios/libexec/check_http -H 10.3.37.110 -u /nagios.php  
  24.  
  25.   command[check_ftp]=/usr/local/nagios/libexec/check_ftp -H 10.3.37.110 -p 21  
  26.  
  27.   command[check_ssh]=/usr/local/nagios/libexec/check_ssh 10.3.37.110  
  28.  
  29.   command[check_alive]=/usr/local/nagios/libexec/check_ping -H 10.3.37.110 -w 100,20% -c 500,60% -p 4  
  30.  
  31.   command[check_105mysql]=/usr/local/nagios/libexec/check_mysql -H 10.3.37.110 -P 3306 -u nagios -p ***  
  32.  
  33.   ##############  
  34.  
  35.   # The following examples use hardcoded command arguments...  
  36.  
  37.   ###############  
  38.  
  39.   command[check_users]=/usr/local/nagios/libexec/check_users -w 10 -c 20  
  40.  
  41.   command[check_load]=/usr/local/nagios/libexec/check_load -w 16,10,8 -c 30,25,20  
  42.  
  43.   command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1  
  44.  
  45.   command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2  
  46.  
  47.   command[check_sda5]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda5  
  48.  
  49.   command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z  
  50.  
  51.   command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 300 -c 360  
  52.  
  53.   command[check_http]=/usr/local/nagios/libexec/check_http -H 10.3.37.110 -u /nagios.php  
  54.  
  55.   command[check_ftp]=/usr/local/nagios/libexec/check_ftp -H 10.3.37.110 -p 21  
  56.  
  57.   command[check_ssh]=/usr/local/nagios/libexec/check_ssh 10.3.37.110  
  58.  
  59.   command[check_alive]=/usr/local/nagios/libexec/check_ping -H 10.3.37.110 -w 100,20% -c 500,60% -p 4  
  60.  
  61.   command[check_105mysql]=/usr/local/nagios/libexec/check_mysql -H 10.3.37.110 -P 3306 -u nagios -p ***  
  62.  
  63.   ##############  
  64.  

  检查监控命令是否生效

  在监控端执行以下命令,返回结果则成功。

  1.   /usr/local/nagios/libexec/check_nrpe -H被监控端ip -c check_load  
  2.  
  3.   OK - load average: 0.00, 0.00, 0.00|load1=0.000;15.000;30.000;0; load5=0.000;10.000;25.000;0; load15=0.000;5.000;20.000;0;  

【编辑推荐】
 

如何使用Nagios监控memcached

使用nagios监控oracle

启动Nagios服务

【责任编辑:高圆圆 TEL:(010)68476606】

责任编辑:zhaolei 来源: javaeye
相关推荐

2011-04-06 14:24:20

Nagios监控Linux

2011-03-21 14:53:36

Nagios监控Linux

2011-03-21 14:53:27

Nagios监控Linux

2014-01-17 15:23:55

Nagios

2011-03-23 10:17:24

2011-03-25 14:25:38

NagiosWindows监控

2011-03-21 14:53:27

Nagios监控Linux

2011-04-06 14:24:21

Nagios监控Linux

2011-04-01 15:42:13

CactiNagios

2013-12-13 17:04:37

运维监控Nagios

2011-04-06 14:24:27

Nagios监控Linux

2011-03-25 12:50:29

nagios安装

2011-03-22 15:17:19

Nagios监控

2011-03-31 16:10:47

Redhat配置nagios

2011-03-31 16:11:22

Redhat配置nagios

2011-04-01 15:42:13

2011-03-23 13:29:46

Debian安装Nagios

2011-04-01 15:39:02

CactiNagios

2011-03-04 10:47:06

Nagios监控Sphinx

2011-03-24 10:08:39

Nagios监控oracle
点赞
收藏

51CTO技术栈公众号