109 |
|
my($partition_no) = 0; |
110 |
|
for (my($i) = 0; $i < $#df; $i++) { |
111 |
|
my($line) = $df[$i]; |
112 |
< |
$line =~ /^(\/[^\s]*)\s*([0-9]*)\s*([0-9]*)\s*([0-9]*)\s*[^\s]*\s*(\/[^\s]*)\s*/; |
112 |
> |
$line =~ /^([^\s]*)\s*([0-9]*)\s*([0-9]*)\s*([0-9]*)\s*[^\s]*\s*(\/[^\s]*)\s*/; |
113 |
|
# $4 will not match unless everything before it does... |
114 |
|
if (defined $5) { |
115 |
|
my ($filesystem, $kbytes, $used, $avail, $mount) = ($1, $2, $3, $4, $5); |
195 |
|
&print_pair(0, "packet.processes.stopped", $top =~ / ([^\s]+?) stopped/); |
196 |
|
&print_pair(0, "packet.processes.cpu", $top =~ /([^\s]+?)\s*running/); |
197 |
|
&print_pair(0, "packet.cpu.idle", $top =~ /([^\s]+?)% idle/); |
198 |
– |
&print_pair(0, "packet.cpu.user", $top =~ /([^\s]+?)% user/); |
198 |
|
&print_pair(0, "packet.cpu.kernel", $top =~ /([^\s]+?)% system/); |
199 |
|
&print_pair(0, "packet.cpu.iowait", $top =~ /([^\s]+?)% interrupt/); |
200 |
|
&print_pair(0, "packet.cpu.swap", $top =~ /([^\s]+?)% swap/); |
201 |
+ |
|
202 |
+ |
# FreeBSD is a bit different, we need to get user and nice. |
203 |
+ |
my($user) = 0; |
204 |
+ |
if($top =~ /([^\s]+?)% user/) { $user += $1; } |
205 |
+ |
if($top =~ /([^\s]+?)% nice/) { $user += $1; } |
206 |
+ |
&print_pair(0, "packet.cpu.user", $user); |
207 |
|
|
208 |
|
# The following need to be specified in megabytes. |
209 |
|
# If they are preceeded by a G, then multiply by 1024. |
327 |
|
|
328 |
|
if ($uptime =~ /day.*,\s+([0-9]+):([0-9]+)/) { |
329 |
|
# normal |
330 |
< |
$uptime =~ /up\s+([0-9]+)\s+.*,\s+([0-9]+):([0-9]+)/; |
330 |
> |
$uptime =~ /up\s+([0-9]+)\s+[^\s]+,\s+([0-9]+):([0-9]+)/; |
331 |
|
$uptime = "$1:$2:$3"; |
332 |
|
} |
333 |
|
else { |
334 |
|
if ($uptime =~ /day/) { |
335 |
|
if ($uptime =~ /hr/) { |
336 |
|
# 0 minutes |
337 |
< |
$uptime =~ /up\s+([0-9]+)\s+.*,\s+([0-9]+)\s+.*,/; |
337 |
> |
$uptime =~ /up\s+([0-9]+)\s+[^\s]+,\s+([0-9]+)\s+[^\s]+,/; |
338 |
|
$uptime = "$1:$2:0"; |
339 |
|
} |
340 |
|
elsif ($uptime =~ /min/) { |
341 |
|
# 0 hours |
342 |
< |
$uptime =~ /up\s+([0-9]+)\s+.*,\s+([0-9]+)\s+.*,/; |
342 |
> |
$uptime =~ /up\s+([0-9]+)\s+[^\s]+,\s+([0-9]+)\s+[^\s]+,/; |
343 |
|
$uptime = "$1:0:$2"; |
344 |
|
} |
345 |
|
else { |