--- projects/cms/source/host/generic/statgrab.pl 2001/01/29 17:09:04 1.18 +++ projects/cms/source/host/generic/statgrab.pl 2001/02/04 22:38:41 1.20 @@ -2,8 +2,8 @@ #----------------------------------------------------------------- # Machine statistics grabber -# $Author: pjm2 $ -# $Id: statgrab.pl,v 1.18 2001/01/29 17:09:04 pjm2 Exp $ +# $Author: tdb $ +# $Id: statgrab.pl,v 1.20 2001/02/04 22:38:41 tdb Exp $ # # A Perl script to return various information about a host machine # by examining the output of some common Unix/Linux commands. @@ -50,7 +50,7 @@ exit(0); # the host should check this when reading data # means the host must be checked and updated to work with newer versions. sub print_ident() { - print 'version statgrab.pl $Revision: 1.18 $'; + print 'version statgrab.pl $Revision: 1.20 $'; print "\n"; } @@ -131,7 +131,7 @@ sub include_top() { &print_pair(1, "packet.load.load1", $top =~ /load averages:\s*([^\s]+?),/); &print_pair(1, "packet.load.load5", $top =~ /load averages:\s*.+?,\s*([^\s]+?),/); - &print_pair(1, "packet.load.load15", $top =~ /load averages:\s*.+?,\s*.+?,\s*([^\s]+?)\s*/); + &print_pair(1, "packet.load.load15", $top =~ /load averages:\s*.+?,\s*.+?,\s*([^\s]+?)\s.*/); &print_pair(1, "packet.processes.total", $top =~ /([^\s]+?) processes:/); &print_pair(1, "packet.processes.sleeping", $top =~ / ([^\s]+?) sleeping/); &print_pair(1, "packet.processes.zombie", $top =~ / ([^\s]+?) zombie/); @@ -193,8 +193,9 @@ sub include_osver() { # sub to get system uptime. sub include_uptime() { - # Need a regexp guru to strip the junk on this line my($uptime) = `$uptimebin`; + $uptime =~ /up ([0-9]+) .*, ([0-9]+:[0-9]+)/; + $uptime = "$1:$2"; &print_pair(0, "packet.os.uptime", $uptime);