- 论坛徽章:
- 0
|
#! /usr/bin/perl
use Net: OP3;
if ($#ARGV != 2)
{
print "Error in usage: hostname, username & password required\r\n";
exit 3;
}
$hostname = $ARGV[0];
$username = $ARGV[1];
$password = $ARGV[2];
$pop = Net: OP3->new($hostname, Timeout => 15);
$msgnum = $pop->login($username, $password);
if ( !defined($msgnum) )
{
print "Critical: unable to log on\r\n";
$retval = 2;
} else
{
$retval = 0;
print "OK: successfully logged in.\r\n";
}
$pop->quit;
exit $retval;
这个perl脚本检查pop3服务,但是输出的结果我不太满意,希望能在监测失败的时候输出服务器端的响应信息,同时在正常监测服务和失败监测服务的时候都打印端口打开后登陆成功或者登陆失败的延迟时间,希望高手帮忙搞定下,谢谢!!! |
|