您好,登錄后才能下訂單哦!
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。