| 21 |
|
# You'd be silly not to use this ;) |
| 22 |
|
use strict; |
| 23 |
|
|
| 24 |
+ |
# Path's |
| 25 |
+ |
my($topbin) = "/usr/local/sbin/top"; |
| 26 |
+ |
my($dfbin) = "/usr/bin/df"; |
| 27 |
+ |
my($usersbin) = "/usr/ucb/users"; |
| 28 |
+ |
my($unamebin) = "/usr/bin/uname"; |
| 29 |
+ |
|
| 30 |
|
# Run the following components: - |
| 31 |
|
&print_ident(); |
| 32 |
|
&include_osver(); |
| 80 |
|
sub include_disk() { |
| 81 |
|
|
| 82 |
|
# Run the df program. |
| 83 |
< |
my(@df) = `df -ak`; |
| 83 |
> |
my(@df) = `$dfbin -ak`; |
| 84 |
|
|
| 85 |
|
# Go through each line of the program, looking for each thing we want. |
| 86 |
|
my($partition_no) = 0; |
| 106 |
|
sub include_users() { |
| 107 |
|
|
| 108 |
|
# Find out all users on this machine. |
| 109 |
< |
my($users) = `users`; |
| 110 |
< |
my(@users) = split(/\s+/, $users); |
| 111 |
< |
|
| 112 |
< |
my($users_count) = $#users + 1; |
| 109 |
> |
my($users) = `$usersbin`; |
| 110 |
> |
chop($users); |
| 111 |
> |
my($users_count) = 0; |
| 112 |
> |
$users_count++ while $users =~ /\w+/g; |
| 113 |
|
my($users_list) = $users; |
| 114 |
|
|
| 115 |
|
&print_pair(1, "packet.users.count", $users_count); |
| 122 |
|
sub include_top() { |
| 123 |
|
|
| 124 |
|
# Find out some numbers from top. |
| 125 |
< |
my(@top) = `top -d2 -s1 0`; |
| 125 |
> |
my(@top) = `$topbin -d2 -s1 0`; |
| 126 |
|
my($top) = join(" ", @top); |
| 127 |
|
$top =~ s/\n//g; |
| 128 |
|
|
| 173 |
|
# Find out details about the operating system |
| 174 |
|
# If these values remain undefined, then the print_pair |
| 175 |
|
# function shall show the value to be the string "unknown". |
| 176 |
< |
my($os_name) = `uname -s`; |
| 177 |
< |
my($os_release) = `uname -r`; |
| 178 |
< |
my($os_platform) = `uname -m`; |
| 179 |
< |
my($os_sysname) = `uname -n`; |
| 180 |
< |
my($os_version) = `uname -v`; |
| 176 |
> |
my($os_name) = `$unamebin -s`; |
| 177 |
> |
my($os_release) = `$unamebin -r`; |
| 178 |
> |
my($os_platform) = `$unamebin -m`; |
| 179 |
> |
my($os_sysname) = `$unamebin -n`; |
| 180 |
> |
my($os_version) = `$unamebin -v`; |
| 181 |
|
|
| 182 |
|
&print_pair(0, "packet.os.name", $os_name); |
| 183 |
|
&print_pair(0, "packet.os.release", $os_release); |