Xymon Mailing List Archive search

rootlogin.pl

list Joshua Krause
Thu, 17 Jul 2008 14:28:37 -0400
Message-Id: <00e501c8e83a$edee1710$c9ca4530$@rr.com>

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