Public feed #376378

Something

public text v1 · immutable
Raw Edit
·published 2007-03-01 00:00 UTC
rendered paste body
#!/usr/local/bin/perl
#use strict;
use IO::Socket;
use CGI qw/:standard/;


$SERVER="asgard.ne.tld";
$uptime = `uptime`;
@processes = ("mysqld","sshd","lighttpd","ctorrent");

for ($t=0;$t<=$#processes;$t++) {

        print "Checking $processes[$t]  \n";

        $running = `ps -cax \| grep @processes[$t]`;
        print "$running";

        if ($running =~ /@processes[$t]/) {
                $body="$body\n[OK] @processes[$t]";
        }
        else {
                $body="$body\n[DOWN] @processes[$t]";
        }

}
print "$SERVER
$uptime

$body";