nagios自定義監控指令碼接收引數傳遞
阿新 • • 發佈:2019-01-07
useradd nagios
tar zxvf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --prefix=/usr/local/nagios
chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
./configure --enable-command-args
passwd nagios
tar zxvf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --prefix=/usr/local/nagios
make && make install
chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
./configure --enable-command-args
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd
修改nrpe.cfg:
dont_blame_nrpe=1
/etc/init.d/xinetd restart //重啟nrpe服務
services.cfg定義如下:
define service{
use local-service
host_name test1234
service_description test1234
check_command check_nrpe!check_mg_jdbc -a test1234
}
測試監控指令碼:
#!/bin/bash
echo $1
exit 0