监控第三方端口(22000)
#!/bin/bash
#author:xiaoweige
#check 140 22000
result=`sleep 1|telnet 10.2.1.140 22000|grep -i escape`
recode=`echo $?`
if [[ $recode -eq 0 ]];then
echo "ssh service is ok!"
exit 0
else
echo "ssh service is not ok"
exit 2
fi
nrpe配置文件加command:
command[check_22000]=/usr/local/nagios/libexec/check_22000
define service{
use local-service
host_name client_45
service_description check_22000
check_command check_nrpe!check_22000
normal_check_interval 1
}
用一个例子来演示会更加清晰