[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
rootlogin.pl
- To: <hobbit (at) hswn.dk>
- Subject: rootlogin.pl
- From: "Joshua Krause" <forums (at) triadbiz.rr.com>
- Date: Thu, 17 Jul 2008 14:28:37 -0400
- Thread-index: AcjoOu2hI+RHXuWMSmyn77ES/y/0vg==
I am trying to get the rootlogin.pl to go red on root, yellow on any other
user and green if nothing is available. I have made some modifications to
the script and restarted hobbit but it will never go yellow just green and
red. I have modified the script from:
if ( $sections{"who"} =~ /^root /m ) {
$color = "red";
$summary = "ROOT login active";
$statusmsg = "&red ROOT login detected!\n\n" .
$sections{"who"};
}
else {
$color = "green";
#$summary = "OK";
$summary = "OK" . $sections{"who"};
$statusmsg = "&green No root login active\n\n" .
$sections{"who"};
}
To this:
if ( $sections{"who"} =~ /^root /m ) {
$color = "red";
$summary = "ROOT login active";
$statusmsg = "&red ROOT login detected!\n\n " .
$sections{"who"};
}
elsif ( $sections{"who"} =~/^\n/) {
$color = "green";
$summary = "OK";
$statusmsg = "&green No active logins\n\n" .
$sections{"who"};
}
else {
$color = "yellow";
$summary = "USER login active";
$statusmsg = "&yellow USER login detected!" .
$sections{"who"};
}
Can anyone let me know what I am doing wrong?
Thanks,
-Josh