Nagios被监控端安装
没安装xinetd的要安装
- yum -y install xinetd
- yum -y install xinetd
安装Nagios插件
- ./configure --with-nagios-user=nagios --with-nagios-group=nagios
- make
- make install
- ./configure --with-nagios-user=nagios --with-nagios-group=nagios
- make
- make install
安装nrpe
- ./configure
- make all
- make install-daemon
- make install-daemon-config
- make install-xinetd
- ./configure
- make all
- make install-daemon
- make install-daemon-config
- make install-xinetd
配置nrpe启动
- vi /etc/xinetd.d/nrpe
- service nrpe
- {
- flags = REUSE
- socket_type = stream
- port = 5666
- wait = no
- user = nagios
- group = nagios
- server = /usr/local/nagios/bin/nrpe
- server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
- log_on_failure += USERID
- disable = no
- only_from = 127.0.0.1 10.3.37.110
- #only_from: allow monit server ip. “ ”ge kai duo ge ip
- }
- vi /etc/xinetd.d/nrpe
- service nrpe
- {
- flags = REUSE
- socket_type = stream
- port = 5666
- wait = no
- user = nagios
- group = nagios
- server = /usr/local/nagios/bin/nrpe
- server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
- log_on_failure += USERID
- disable = no
- only_from = 127.0.0.1 10.3.37.110
- #only_from: allow monit server ip. “ ”ge kai duo ge ip
- }
- vi /etc/services
- vi /etc/services
加入以下:
- nrpe 5666/tcp # nrpe
- nrpe 5666/tcp # nrpe
重启 xinetd 服务
- /etc/init.d/xinetd restart
- /etc/init.d/xinetd restart
检查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
配置监控命令
- vi /usr/local/nagios/etc/nrpe.cfg
- vi /usr/local/nagios/etc/nrpe.cfg
- # The following examples use hardcoded command arguments...
- ###############
- command[check_users]=/usr/local/nagios/libexec/check_users -w 10 -c 20
- command[check_load]=/usr/local/nagios/libexec/check_load -w 16,10,8 -c 30,25,20
- command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1
- command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2
- command[check_sda5]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda5
- command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
- command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 300 -c 360
- command[check_http]=/usr/local/nagios/libexec/check_http -H 10.3.37.110 -u /nagios.php
- command[check_ftp]=/usr/local/nagios/libexec/check_ftp -H 10.3.37.110 -p 21
- command[check_ssh]=/usr/local/nagios/libexec/check_ssh 10.3.37.110
- command[check_alive]=/usr/local/nagios/libexec/check_ping -H 10.3.37.110 -w 100,20% -c 500,60% -p 4
- command[check_105mysql]=/usr/local/nagios/libexec/check_mysql -H 10.3.37.110 -P 3306 -u nagios -p ***
- ##############
- # The following examples use hardcoded command arguments...
- ###############
- command[check_users]=/usr/local/nagios/libexec/check_users -w 10 -c 20
- command[check_load]=/usr/local/nagios/libexec/check_load -w 16,10,8 -c 30,25,20
- command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1
- command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2
- command[check_sda5]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda5
- command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
- command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 300 -c 360
- command[check_http]=/usr/local/nagios/libexec/check_http -H 10.3.37.110 -u /nagios.php
- command[check_ftp]=/usr/local/nagios/libexec/check_ftp -H 10.3.37.110 -p 21
- command[check_ssh]=/usr/local/nagios/libexec/check_ssh 10.3.37.110
- command[check_alive]=/usr/local/nagios/libexec/check_ping -H 10.3.37.110 -w 100,20% -c 500,60% -p 4
- command[check_105mysql]=/usr/local/nagios/libexec/check_mysql -H 10.3.37.110 -P 3306 -u nagios -p ***
- ##############
检查监控命令是否生效
在监控端执行以下命令,返回结果则成功。
- /usr/local/nagios/libexec/check_nrpe -H被监控端ip -c check_load
- 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;
【编辑推荐】
【责任编辑:高圆圆 TEL:(010)68476606】