使用Nagios监控Linux客户端-Nagios监控服务器的配置

运维 系统运维
使用Nagios监控Linux客户端:Nagios 与 Ganglia 一样,常用于 HPC 和其他环境,但是 Nagios 更加关注警告机制,Ganglia 则更加关注收集和跟踪指标。Nagios 以前只是从目标主机收集信息,但最近开发了可以在主机上运行代理的插件。Nagios监控服务器的配置

  使用Nagios监控Linux 客户端Nagios监控的方式:  

  本文介绍的是:使用Nagios监控Linux客户端

手机报警短信

Nagios监控服务器的配置

Nagios 监控客户端的配置

使用Nagios监控Windows客户端

  (一)Nagios监控服务器的配置

  1.安装nrpe

  1.   [root@UnixHot src]# tar zxvf nrpe-2.12.tar.gz  
  2.  
  3.   [root@UnixHot nrpe-2.12]# ./configure && make all  
  4.  
  5.   [root@UnixHot nrpe-2.12]# make install-plugin  
  6.  
  7.   [root@UnixHot nrpe-2.12]# make install-daemon  
  8.  
  9.   [root@UnixHot nrpe-2.12]# make install-daemon-config  
  10.  
  11.   [root@UnixHot nrpe-2.12]# make install-xinetd  
  12.  

  2.配置nrep

  1.   [root@UnixHot nrpe-2.12]# 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 192.168.0.206 192.168.0.155 192.168.0.157  
  28.  

  在only_from 添加要监控的主机的IP地址,中间以空格隔开。

  3.添加端口

  1.   [root@UnixHot nrpe-2.12]# vi /etc/services 在最后添加  
  2.  
  3.   nrpe 5666/tcp #nrpe  
  4.  

  4.重新启动Xinetd服务

  1.   [root@UnixHot nrpe-2.12]# /etc/init.d/xinetd restart  
  2.  
  3.   [root@UnixHot nrpe-2.12]# netstat -na | grep 5666  
  4.  
  5.   tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN  
  6.  

  以上的1-4的步骤要在客户端上做。

  5.修改配置文件commands.cfg加入对nrpe的支持

  1.   [root@UnixHot ~]# vi /usr/local/nagios/etc/objects/commands.cfg  
  2.  
  3.   #nrpe set  
  4.  
  5.   define command{  
  6.  
  7.   command_name check_nrpe  
  8.  
  9.   command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$  
  10.  
  11.   }  
  12.  

  6.有哪些nrpe检测命令可以用,它们在哪里呢?

  1.   [root@UnixHot ~]# vi /usr/local/nagios/etc/nrpe.cfg  
  2.  

  (默认有下面四个命令)

  1.   command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10  
  2.  
  3.   command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20  
  4.  
  5.   command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1  
  6.  
  7.   command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z  
  8.  
  9.   command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200  
  10.  

  7.怎么使用这些命令监控客户端呢?

  其实很简单,就是在services.cfg里面添加服务即可,格式就和上篇文档讲的一样,只是命令不同罢了。

  1.   [root@UnixHot ~]# vi /usr/local/nagios/etc/objects/services.cfg  
  2.  

  加入:

  1.   define service {  
  2.  
  3.   host_name Nagios-Server  
  4.  
  5.   service_description check-users  
  6.  
  7.   check_period 24x7  
  8.  
  9.   max_check_attempts 4  
  10.  
  11.   normal_check_interval 3  
  12.  
  13.   retry_check_interval 2  
  14.  
  15.   contact_groups sagroup  
  16.  
  17.   notification_interval 10  
  18.  
  19.   notification_period 24x7  
  20.  
  21.   notification_options w,u,c,r  
  22.  
  23.   check_command check_nrpe!check_users  
  24.  
  25.   }  
  26.  
  27.   define service {  
  28.  
  29.   host_name Nagios-Server  
  30.  
  31.   service_description check-load  
  32.  
  33.   check_period 24x7  
  34.  
  35.   max_check_attempts 4  
  36.  
  37.   normal_check_interval 3  
  38.  
  39.   retry_check_interval 2  
  40.  
  41.   contact_groups sagroup  
  42.  
  43.   notification_interval 10  
  44.  
  45.   notification_period 24x7  
  46.  
  47.   notification_options w,u,c,r  
  48.  
  49.   check_command check_nrpe!check_load  
  50.  
  51.   }  
  52.  
  53.   define service {  
  54.  
  55.   host_name Nagios-Server  
  56.  
  57.   service_description check-total-procs  
  58.  
  59.   check_period 24x7  
  60.  
  61.   max_check_attempts 4  
  62.  
  63.   normal_check_interval 3  
  64.  
  65.   retry_check_interval 2  
  66.  
  67.   contact_groups sagroup  
  68.  
  69.   notification_interval 10  
  70.  
  71.   notification_period 24x7  
  72.  
  73.   notification_options w,u,c,r  
  74.  
  75.   check_command check_total_procs  
  76.  
  77.   }  
  78.  

  在这里仅列出了一个客户端的配置,其它的客户端,只需修改host_name 即可。

 【编辑推荐】

Nagios使用飞信Robot发送报警短信

配置nagios客户端

Nagios的安装配置记录

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

2011-03-21 14:53:27

Nagios监控Linux

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-04-06 14:24:27

Nagios监控Linux

2011-03-25 14:25:38

NagiosWindows监控

2011-04-06 14:24:18

2011-03-25 14:40:33

Nagios监控

2011-03-22 09:03:47

Nagios配置

2011-03-23 15:13:08

Nagios监控Oracle

2011-03-22 09:07:13

Nagios监控Linux

2011-03-24 13:00:31

配置nagios客户端

2011-03-23 10:17:26

2011-04-06 14:24:28

nagios监控Linux

2011-04-06 15:05:56

nagios监控Linux

2011-03-22 15:17:14

Nagios安装

2011-08-22 12:25:08

nagios

2011-03-23 15:13:08

Nagios监控oracle

2011-03-23 13:29:46

Debian安装Nagios
点赞
收藏

51CTO技术栈公众号