推荐-ubuntu安装配置nrpe+nagios-plugins+openmanage
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
文章名称:推荐-ubuntu安装配置nrpe+nagios-plugins+openmanage
网站路径:http://scyanting.com/article/ijsgje.html