9
# $Id: mon.monitor 1.3 Sat, 30 Jun 2001 14:44:29 -0400 trockij $
17
getopts ('u:p:p:t:', \%opt);
24
$TIMEOUT = $opt{"t"} if ($opt{"t"});
26
foreach my $host (@ARGV)
28
my $c = new Mon::Client (
38
local $SIG{"ALRM"} = sub { die "Timeout Alarm" };
41
if (!defined $c->connect)
43
push @failures, $host;
44
push @details, "$host: " . $c->error;
49
if ($opt{"u"} && $opt{"p"})
51
if (! defined $c->login (
52
"username" => $opt{"u"},
53
"password" => $opt{"p"},
56
push @failures, $host;
57
push @details, "$host: " . $c->error;
63
my @st = $c->list_state;
67
push @failures, $host;
68
push @details, "$host: " . $c->error;
74
push @details, "$host: @st";
76
if (!defined $c->disconnect)
78
push @failures, $host;
79
push @details, "$host: could not disconnect, " . $c->error;
87
if ($EVAL_ERROR =~ "Timeout Alarm")
89
push @failures, $host;
90
push @details, "$host: timeout";
96
print join (" ", sort @failures), "\n";
101
print "no failures\n";
106
print join ("\n", @details), "\n";