--- projects/cms/source/host/generic/statgrab.pl 2001/01/19 19:37:59 1.1 +++ projects/cms/source/host/generic/statgrab.pl 2001/01/20 20:04:46 1.3 @@ -2,8 +2,8 @@ #----------------------------------------------------------------- # Machine statistics grabber -# $Author: pjm2 $ -# $Id: statgrab.pl,v 1.1 2001/01/19 19:37:59 pjm2 Exp $ +# $Author: tdb $ +# $Id: statgrab.pl,v 1.3 2001/01/20 20:04:46 tdb Exp $ # # A Perl script to return various information about a host machine # by examining the output of some common Unix/Linux commands. @@ -21,6 +21,8 @@ $| = 1; # You'd be silly not to use this ;) use strict; +&print_ident(); +&include_osver(); &include_users(); &include_top(); @@ -28,6 +30,13 @@ exit(0); +# prints out an identifier for this version of statgrab.pl +# 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 '# statgrab.pl $Revision: 1.3 $'; + print "\n"; +} # sub to print pairs of data, separated by a single space character. sub print_pair($$) { @@ -84,4 +93,21 @@ sub include_top() { &print_pair("packet.memory.swap_in_use", $top =~ /([^\s]+?)[MG] swap in use/); &print_pair("packet.memory.swap_free", $top =~ /([^\s]+?)[MG] swap free/); +} + +sub include_osver() { + + # Find out details about the operating system + my($os_name) = `uname -s`; + my($os_release) = `uname -r`; + my($os_platform) = `uname -m`; + my($os_sysname) = `uname -n`; + my($os_version) = `uname -v`; + + &print_pair("packet.os.name", $os_name); + &print_pair("packet.os.release", $os_release); + &print_pair("packet.os.platform", $os_platform); + &print_pair("packet.os.sysname", $os_sysname); + &print_pair("packet.os.version", $os_version); + }