Here is a basic template. There is a Net::SNMP module you can probably use. It is OO and well documented.
[root@devel3 root]# cat test.pl
#!/usr/bin/perl -w
use strict;
my @progs = qw(
squid
cleaner.pl
httpd
noexist.php
);
for my $prog( @progs ) {
if ( `ps -C $prog` =~ m/\Q$prog\E/ ) {
print "Found $prog\n";
}
else {
do_warn($prog);
}
}
sub do_warn {
my $prog = shift;
warn "$prog is not up, typical!\n";
}
[root@devel3 root]# ./test.pl
Found squid
Found cleaner.pl
Found httpd
noexist.php is not up, typical!
[root@devel3 root]#
|