--- projects/cms/source/host/generic/statgrab.pl 2001/02/05 17:43:45 1.28 +++ projects/cms/source/host/generic/statgrab.pl 2001/02/05 17:51:56 1.29 @@ -2,8 +2,8 @@ #----------------------------------------------------------------- # Machine statistics grabber -# $Author: tdb $ -# $Id: statgrab.pl,v 1.28 2001/02/05 17:43:45 tdb Exp $ +# $Author: pjm2 $ +# $Id: statgrab.pl,v 1.29 2001/02/05 17:51:56 pjm2 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.28 $'; + print 'version statgrab.pl $Revision: 1.29 $'; print "\n"; } @@ -124,9 +124,6 @@ sub include_top() { my($top) = join(" ", @top); $top =~ s/\n//g; - &print_pair(0, "packet.load.load1", $top =~ /load averages:\s*([^\s]+?),/); - &print_pair(0, "packet.load.load5", $top =~ /load averages:\s*.+?,\s*([^\s]+?),/); - &print_pair(0, "packet.load.load15", $top =~ /load averages:\s*.+?,\s*.+?,\s*([^\s]+?)\s/); &print_pair(0, "packet.processes.total", $top =~ /([^\s]+?) processes:/); &print_pair(0, "packet.processes.sleeping", $top =~ / ([^\s]+?) sleeping/); &print_pair(0, "packet.processes.zombie", $top =~ / ([^\s]+?) zombie/); @@ -207,6 +204,10 @@ sub include_uptime() { # grab the uptime my($uptime) = `$uptimebin`; + + &print_pair(0, "packet.load.load1", $uptime =~ /load average.?:\s*([^\s]+?),/); + &print_pair(0, "packet.load.load5", $uptime =~ /load average.?:\s*.+?,\s*([^\s]+?),/); + &print_pair(0, "packet.load.load15", $uptime =~ /load average.?:\s*.+?,\s*.+?,\s*([^\s]+)/); # work out the days, hours, and minutes