1.拷贝check_tcp到脚本执行的主机中或在此主机中安装nagios;
2.保持list.txt中只有一个IP列
执行脚本如下:
#!/bin/bash
cat list.txt | while read line
do
p3389=`/usr/local/nagios/libexec/check_tcp -H $line -p 3389 | grep OK`
if [ -n "$p3389" ];then
echo $line
fi
done
脚本下载地址:http://download.youkuaiyun.com/detail/drew27/7456955