[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rootlogin.pl



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