| 21 |
|
# You'd be silly not to use this ;) |
| 22 |
|
use strict; |
| 23 |
|
|
| 24 |
+ |
&print_ident(); |
| 25 |
+ |
&include_osver(); |
| 26 |
|
&include_users(); |
| 27 |
|
&include_top(); |
| 28 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
+ |
# prints out an identifier for this version of statgrab.pl |
| 34 |
+ |
# the host should check this when reading data |
| 35 |
+ |
# means the host must be checked and updated to work with newer versions. |
| 36 |
+ |
sub print_ident() { |
| 37 |
+ |
print '# statgrab.pl $Revision$'; |
| 38 |
+ |
print "\n"; |
| 39 |
+ |
} |
| 40 |
|
|
| 41 |
|
# sub to print pairs of data, separated by a single space character. |
| 42 |
|
sub print_pair($$) { |
| 93 |
|
&print_pair("packet.memory.swap_in_use", $top =~ /([^\s]+?)[MG] swap in use/); |
| 94 |
|
&print_pair("packet.memory.swap_free", $top =~ /([^\s]+?)[MG] swap free/); |
| 95 |
|
|
| 96 |
+ |
} |
| 97 |
+ |
|
| 98 |
+ |
sub include_osver() { |
| 99 |
+ |
|
| 100 |
+ |
# Find out details about the operating system |
| 101 |
+ |
my($os_name) = `uname -s`; |
| 102 |
+ |
my($os_release) = `uname -r`; |
| 103 |
+ |
my($os_platform) = `uname -m`; |
| 104 |
+ |
my($os_sysname) = `uname -n`; |
| 105 |
+ |
my($os_version) = `uname -v`; |
| 106 |
+ |
|
| 107 |
+ |
&print_pair("packet.os.name", $os_name); |
| 108 |
+ |
&print_pair("packet.os.release", $os_release); |
| 109 |
+ |
&print_pair("packet.os.platform", $os_platform); |
| 110 |
+ |
&print_pair("packet.os.sysname", $os_sysname); |
| 111 |
+ |
&print_pair("packet.os.version", $os_version); |
| 112 |
+ |
|
| 113 |
|
} |