--- projects/cms/source/host/generic/statgrab.pl 2001/03/03 21:26:55 1.36 +++ projects/cms/source/host/generic/statgrab.pl 2001/03/15 10:45:15 1.38 @@ -2,8 +2,8 @@ #----------------------------------------------------------------- # Machine statistics grabber -# $Author: tdb $ -# $Id: statgrab.pl,v 1.36 2001/03/03 21:26:55 tdb Exp $ +# $Author: pjm2 $ +# $Id: statgrab.pl,v 1.38 2001/03/15 10:45:15 pjm2 Exp $ # # A Perl script to return various information about a host machine # by examining the output of some common Unix/Linux commands. @@ -76,7 +76,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.36 $'; + print 'version statgrab.pl $Revision: 1.38 $'; print "\n"; } @@ -165,24 +165,28 @@ sub include_top() { # The following need to be specified in megabytes. # If they are preceeded by a G, then multiply by 1024. - $top =~ /([^\s]+?)([MG]) real/; + $top =~ /([^\s]+?)([KMG]) real/; my($real) = $1; $real*=1024 if $2 eq "G"; + $real/=1024 if $2 eq "K"; &print_pair(0, "packet.memory.total", $real); - $top =~ /([^\s]+?)([MG]) free/; + $top =~ /([^\s]+?)([KMG]) free/; my($free) = $1; $free*=1024 if $2 eq "G"; + $free/=1024 if $2 eq "K"; &print_pair(0, "packet.memory.free", $free); - $top =~ /([^\s]+?)([MG]) swap in use/; + $top =~ /([^\s]+?)([KMG]) swap in use/; my($swap_in_use) = $1; $swap_in_use*=1024 if $2 eq "G"; + $swap_in_use/=1024 if $2 eq "K"; # DO NOT print this one out... save it for in a moment... - $top =~ /([^\s]+?)([MG]) swap free/; + $top =~ /([^\s]+?)([KMG]) swap free/; my($swap_free) = $1; $swap_free*=1024 if $2 eq "G"; + $swap_free/=1024 if $2 eq "K"; &print_pair(0, "packet.swap.free", $swap_free); # AJ requested total swap instead of swap_in_use, so here we go! @@ -215,19 +219,22 @@ sub include_top() { #&print_pair(0, "packet.memory.total", $real); &print_pair(0, "packet.memory.total", 0); - $top =~ /([^\s]+?)([MG]) Free/; + $top =~ /([^\s]+?)([KMG]) Free/; my($free) = $1; $free*=1024 if $2 eq "G"; + $free/=1024 if $2 eq "K"; &print_pair(0, "packet.memory.free", $free); - $top =~ /Swap: ([^\s]+?)([MG]) Total/; + $top =~ /Swap: ([^\s]+?)([KMG]) Total/; my($swap_total) = $1; $swap_total*=1024 if $2 eq "G"; + $swap_total/=1024 if $2 eq "K"; &print_pair(0, "packet.swap.total", $swap_total); - $top =~ /Swap:.*, ([^\s]+?)([MG]) Free/; + $top =~ /Swap:.*, ([^\s]+?)([KMG]) Free/; my($swap_free) = $1; $swap_free*=1024 if $2 eq "G"; + $swap_free/=1024 if $2 eq "K"; &print_pair(0, "packet.swap.free", $swap_free); } elsif ($ostype eq "Linux") {