sub test_socket {
my $s = IO::Socket::INET->new( @_, Timeout=>2, Proto => 'tcp' );
if( $s ) {
close $s;
$q->font( {-color=>PAINT_OK}, 'ok' );
}
else {
$q->font( {-color=>PAINT_NOK}, $! )
}
}
my %tcp_probe = (
'foo
Apache' => test_socket( PeerHost => '172.17.0.2', PeerPort => 80, ),
'foo
Lotus' => test_socket( PeerHost => '172.17.0.2', PeerPort => 1352, ),
'bar
Apache' => test_socket( PeerHost => '172.17.0.3', PeerPort => 80, ),
'bar
Lotus' => test_socket( PeerHost => '172.17.0.3', PeerPort => 1352, ),
'example
Apache' => test_socket( PeerHost => 'www.example.com', PeerPort => 80, ),
'example
Domino' => test_socket( PeerHost => 'www.example.com', PeerPort => 8000, ),
'example
Lotus' => test_socket( PeerHost => 'www.example.com', PeerPort => 1352, ),
'Web
Proxy' => test_socket( PeerHost => '172.17.0.9', PeerPort => 8080, ),
'baz
Sybase' => test_socket( PeerHost => '172.17.0.1', PeerPort => 4100, ),
'baz
Samba' => test_socket( PeerHost => '172.17.0.1', PeerPort => 139, ),
);
print $q->h3('Mission Critical'), $q->table(
$q->TR(
$q->th( {-width=>60, -valign=>'bottom', -bgcolor=>'#fff0e0'},
[ sort keys %tcp_probe ]
)
)
. $q->TR(
$q->td( {-width=>60, -align=>'center'},
[ map { $tcp_probe{$_} } sort keys %tcp_probe ]
)
)
);