nagios监控远程端口

check_port

位置:/usr/local/nagios/libexec/

代码(新建可执行文件)

#!/bin/sh
/usr/local/nagios/libexec/check_tcp -H $1 -p 80 -t 3
if [[ $? == 0 ]]
   then
   echo "OK:80 open"
   exit 0
else
   echo "CRITICAL:80 close"
   exit 2
fi

commands.cfg

位置:/usr/local/nagios/etc/objects/)

在文件中添加命令

define command{
        command_name    check_winport
        command_line    /usr/local/nagios/libexec/check_winport 172.16.41.5
        }

windows.cfg

位置:/usr/local/nagios/etc/objects/

在文件中添加服务

define service{
        use                     generic-service-urgent,srv-pnp
        host_name               172.16.41.102
        service_description     172.16.41.5:80端口
        check_command           check_winport
        }

显示

结果就可以显示对172.16.41.5:80端口的监控

posted @ 2015-07-20 20:10  jihite  阅读(3125)  评论(0编辑  收藏  举报