您好,登录后才能下订单哦!
http://www.scdlt.com/?p=32
被监控机安装nrpe
准备工作:
sudo apt-get install openssl
sudo apt-get install libcurl3-openssl-dev
添加用户和组(nagios)
useradd nagios -s /sbin/nologin
groupadd nagios
1.下载与安装NRPE:
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz
tar -zxf nrpe-2.13.tar.gz
cd nrpe-2.13
开始安装:
./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu(可能64位和32位有所不同)
make all
make install-plugin
make install-daemon
make install-daemon-config
2.下载与安装nagios-plugins
wget http://assets.nagios.com/downloads/nagiosplugins/nagios-plugins-1.5.tar.gz
tar -zxvf nagios-plugins-1.5.tar.gz
cd nagios-plugins-1.5
./configure --prefix=/usr/local/nagios
make install
3.下载与安装openmanage
http://folk.uio.no/trondham/software/check_openmanage.html#download
wget http://folk.uio.no/trondham/software/files/check_openmanage-3.7.11.tar.gz
tar -zxvf check_openmanage-3.7.11.tar.gz
cd check_openmanage-3.7.11
cp check_openmanage /usr/local/nagios/libexec/
编辑nrpe: /usr/local/nagios/etc/nrpe.cfg
添加与修改如下内容:
allowed_hosts=127.0.0.1,222.247.*.*,222.247.*.* 加入允许连接的主机,多主机用逗号分开
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 10% -c 5% -p /
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
command[check_boot]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /boot
command[check_sensors]=/usr/local/nagios/libexec/check_sensors
command[check_cputemp]=/usr/local/nagios/libexec/check_cputemp -m sensors -w 70 -c 85
command[check_hardware]=/usr/local/nagios/libexec/check_openmanage -e -t 200 --only critical
command[check_storage]=/usr/local/nagios/libexec/check_openmanage -s -t 200 --only storage -b ctrl_fw=0
command[check_power]=/usr/local/nagios/libexec/check_openmanage -s -t 200 --only power
command[check_memory]=/usr/local/nagios/libexec/check_openmanage -s -t 200 --only memory
command[check_fans]=/usr/local/nagios/libexec/check_openmanage -s -t 200 --only fans
command[check_temp]=/usr/local/nagios/libexec/check_openmanage -s -t 200 --only temp
command[check_cpu]=/usr/local/nagios/libexec/check_openmanage -s -t 200 --only cpu
command[check_voltage]=/usr/local/nagios/libexec/check_openmanage -s -t 200 --only voltage
command[check_batteries]=/usr/local/nagios/libexec/check_openmanage -s -t 200 --only batteries
启动nrpe
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
查看是否启动成功
ps -ef |grep nrpe
nagios 2638 1 0 12:45 ? 00:00:00 /usr/local/nagios/bin/nrpe -c
然后iptables开放端口:5666
vi /etc/iptables
-A INPUT -s 222.247.*.* -p tcp -m tcp --dport 5666 -j ACCEPT
或
#iptables -A INPUT -s 222.247.*.* -p tcp -m tcp --dport 5666 -j ACCEPT
#iptables-restore -c /etc/iptables.rules 即时生效。(不需要安装iptables)
#iptables -L -n 查看规则
重启nrpe,需要先kill进程,然后再启动
如:
ps -ef |grep nrpe
nagios 2638 1 0 12:45 ? 00:00:00 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
kill -9 2638
然后再启动:
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
也可以将脚本加入:/etc/rc.local 文件随机启动 :
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
测试nrpe是否工作
/usr/local/nagios/libexec/check_nrpe -H localhost
服务器配置:
同样安装nrpe.
检查命令行是否可查到被监控主机nrpe信息:
/usr/local/nagios/libexec/check_nrpe -H 被监控IP -c check_disk
日志文件
tail -f /var/log/syslog
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。