225 |
|
$swap_free*=1024 if $2 eq "G"; |
226 |
|
&print_pair(0, "packet.swap.free", $swap_free); |
227 |
|
} |
228 |
+ |
elsif ($ostype eq "Linux") { |
229 |
+ |
&print_pair(0, "packet.processes.total", $top =~ /([^\s]+?) processes:/); |
230 |
+ |
&print_pair(0, "packet.processes.sleeping", $top =~ / ([^\s]+?) sleeping/); |
231 |
+ |
&print_pair(0, "packet.processes.zombie", $top =~ / ([^\s]+?) zombie/); |
232 |
+ |
&print_pair(0, "packet.processes.stopped", $top =~ / ([^\s]+?) stopped/); |
233 |
+ |
&print_pair(0, "packet.processes.cpu", $top =~ /([^\s]+?)\s*running/); |
234 |
+ |
&print_pair(0, "packet.cpu.idle", $top =~ /([^\s]+?)% idle/); |
235 |
+ |
&print_pair(0, "packet.cpu.user", $top =~ /([^\s]+?)% user/); |
236 |
+ |
&print_pair(0, "packet.cpu.kernel", $top =~ /([^\s]+?)% system/); |
237 |
+ |
&print_pair(0, "packet.cpu.iowait", $top =~ /([^\s]+?)% interrupt/); |
238 |
+ |
&print_pair(0, "packet.cpu.swap", $top =~ /([^\s]+?)% swap/); |
239 |
+ |
|
240 |
+ |
# The following need to be specified in megabytes. |
241 |
+ |
# If they are preceeded by a G, then multiply by 1024. |
242 |
+ |
|
243 |
+ |
$top =~ / ([^\s]+?)([KMG]) av/; |
244 |
+ |
my($real) = $1; |
245 |
+ |
$real*=1024 if $2 eq "G"; |
246 |
+ |
$real/=1024 if $2 eq "K"; |
247 |
+ |
&print_pair(0, "packet.memory.total", int($real)); |
248 |
+ |
|
249 |
+ |
$top =~ / ([^\s]+?)([KMG]) free/; |
250 |
+ |
my($free) = $1; |
251 |
+ |
$free*=1024 if $2 eq "G"; |
252 |
+ |
$free/=1024 if $2 eq "K"; |
253 |
+ |
&print_pair(0, "packet.memory.free", int($free)); |
254 |
+ |
|
255 |
+ |
$top =~ /Swap:\s+([^\s]+?)([KMG]) av/; |
256 |
+ |
my($swap_total) = $1; |
257 |
+ |
$swap_total*=1024 if $2 eq "G"; |
258 |
+ |
$swap_total/=1024 if $2 eq "K"; |
259 |
+ |
&print_pair(0, "packet.swap.total", int($swap_total)); |
260 |
+ |
|
261 |
+ |
$top =~ /Swap:.*, ([^\s]+?)([KMG]) free/; |
262 |
+ |
my($swap_free) = $1; |
263 |
+ |
$swap_free*=1024 if $2 eq "G"; |
264 |
+ |
$swap_free/=1024 if $2 eq "K"; |
265 |
+ |
&print_pair(0, "packet.swap.free", int($swap_free)); |
266 |
+ |
} |
267 |
|
else { |
268 |
|
# we could have some catchall here |
269 |
+ |
# but as it stands this means we'll just skip top stuff |
270 |
+ |
# for unknown systems |
271 |
|
} |
272 |
|
} |
273 |
|
|
322 |
|
|
323 |
|
if ($uptime =~ /day.*,\s+([0-9]+):([0-9]+)/) { |
324 |
|
# normal |
325 |
< |
$uptime =~ /up\s+([0-9]+)\s+.*,\s+([0-9]+):([0-9]+)/; |
325 |
> |
$uptime =~ /up\s+([0-9]+)\s+[^\s]+,\s+([0-9]+):([0-9]+)/; |
326 |
|
$uptime = "$1:$2:$3"; |
327 |
|
} |
328 |
|
else { |
329 |
|
if ($uptime =~ /day/) { |
330 |
|
if ($uptime =~ /hr/) { |
331 |
|
# 0 minutes |
332 |
< |
$uptime =~ /up\s+([0-9]+)\s+.*,\s+([0-9]+)\s+.*,/; |
332 |
> |
$uptime =~ /up\s+([0-9]+)\s+[^\s]+,\s+([0-9]+)\s+[^\s]+,/; |
333 |
|
$uptime = "$1:$2:0"; |
334 |
|
} |
335 |
|
elsif ($uptime =~ /min/) { |
336 |
|
# 0 hours |
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:0:$2"; |
339 |
|
} |
340 |
|
else { |