--- projects/cms/source/host/generic/statgrab.pl 2001/03/20 13:04:22 1.41 +++ projects/cms/source/host/generic/statgrab.pl 2001/03/21 15:38:01 1.43 @@ -3,7 +3,7 @@ #----------------------------------------------------------------- # Machine statistics grabber # $Author: tdb $ -# $Id: statgrab.pl,v 1.41 2001/03/20 13:04:22 tdb Exp $ +# $Id: statgrab.pl,v 1.43 2001/03/21 15:38:01 tdb Exp $ # # A Perl script to return various information about a host machine # by examining the output of some common Unix/Linux commands. @@ -78,7 +78,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.41 $'; + print 'version statgrab.pl $Revision: 1.43 $'; print "\n"; } @@ -268,25 +268,25 @@ sub include_top() { # The following need to be specified in megabytes. # If they are preceeded by a G, then multiply by 1024. - $top =~ / ([0-9]+?)([KMG]) av/; + $top =~ /Mem:.*?([0-9]+)([KMG])\s+av/; my($real) = $1; $real*=1024 if $2 eq "G"; $real/=1024 if $2 eq "K"; &print_pair(0, "packet.memory.total", int($real)); - $top =~ / ([0-9]+?)([KMG]) free/; + $top =~ /Mem:.*?([0-9]+)([KMG])\s+free/; my($free) = $1; $free*=1024 if $2 eq "G"; $free/=1024 if $2 eq "K"; &print_pair(0, "packet.memory.free", int($free)); - $top =~ /Swap:\s+([0-9]]+?)([KMG]) av/; + $top =~ /Swap:.*?([0-9]+)([KMG])\s+av/; my($swap_total) = $1; $swap_total*=1024 if $2 eq "G"; $swap_total/=1024 if $2 eq "K"; &print_pair(0, "packet.swap.total", int($swap_total)); - $top =~ /Swap:.*, ([0-9]+?)([KMG]) free/; + $top =~ /Swap:.*?([0-9]+)([KMG])\s+free/; my($swap_free) = $1; $swap_free*=1024 if $2 eq "G"; $swap_free/=1024 if $2 eq "K";