--- projects/cms/source/host/generic/statgrab.pl 2001/03/21 10:51:32 1.42 +++ projects/cms/source/host/generic/statgrab.pl 2002/05/21 16:47:11 1.48 @@ -1,9 +1,29 @@ #!/usr/bin/perl -w +# +# i-scream central monitoring system +# http://www.i-scream.org.uk +# Copyright (C) 2000-2002 i-scream +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + #----------------------------------------------------------------- # Machine statistics grabber -# $Author: pjm2 $ -# $Id: statgrab.pl,v 1.42 2001/03/21 10:51:32 pjm2 Exp $ +# $Author: tdb $ +# $Id: statgrab.pl,v 1.48 2002/05/21 16:47:11 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 +98,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.42 $'; + print 'packet.version statgrab.pl $Revision: 1.48 $'; print "\n"; } @@ -105,7 +125,7 @@ sub print_pair($$$) { sub include_disk() { # Run the df program. - my(@df) = `$dfbin -ak`; + my(@df) = `$dfbin -akl`; # Go through each line of the program, looking for each thing we want. my($partition_no) = 0; @@ -268,7 +288,7 @@ sub include_top() { # The following need to be specified in megabytes. # If they are preceeded by a G, then multiply by 1024. - $top =~ /Mem:.*?([0-9]+)([KMG])\s+av/; + $top =~ /Mem:.*?([0-9]+)([KMG])\s+(av|total)/; my($real) = $1; $real*=1024 if $2 eq "G"; $real/=1024 if $2 eq "K"; @@ -280,7 +300,7 @@ sub include_top() { $free/=1024 if $2 eq "K"; &print_pair(0, "packet.memory.free", int($free)); - $top =~ /Swap:.*?([0-9]]+)([KMG])\s+av/; + $top =~ /Swap:.*?([0-9]+)([KMG])\s+(av|total)/; my($swap_total) = $1; $swap_total*=1024 if $2 eq "G"; $swap_total/=1024 if $2 eq "K";