| 133 |
|
&print_pair(1, "packet.cpu.kernel", $top =~ /([^\s]+?)% kernel/); |
| 134 |
|
&print_pair(1, "packet.cpu.iowait", $top =~ /([^\s]+?)% iowait/); |
| 135 |
|
&print_pair(1, "packet.cpu.swap", $top =~ /([^\s]+?)% swap/); |
| 136 |
< |
&print_pair(1, "packet.memory.real", $top =~ /([^\s]+?)[MG] real/); |
| 137 |
< |
&print_pair(1, "packet.memory.free", $top =~ /([^\s]+?)[MG] free/); |
| 138 |
< |
&print_pair(1, "packet.memory.swap_in_use", $top =~ /([^\s]+?)[MG] swap in use/); |
| 139 |
< |
&print_pair(1, "packet.memory.swap_free", $top =~ /([^\s]+?)[MG] swap free/); |
| 140 |
< |
|
| 136 |
> |
|
| 137 |
> |
# The following need to be specified in megabytes. |
| 138 |
> |
# If they are preceeded by a G, then multiply by 1024. |
| 139 |
> |
|
| 140 |
> |
$top =~ /([^\s]+?)([MG]) real/; |
| 141 |
> |
my($real) = $1; |
| 142 |
> |
$real*=1024 if $2 eq "G"; |
| 143 |
> |
&print_pair(1, "packet.memory.real", $real); |
| 144 |
> |
|
| 145 |
> |
$top =~ /([^\s]+?)([MG]) free/; |
| 146 |
> |
my($free) = $1; |
| 147 |
> |
$free*=1024 if $2 eq "G"; |
| 148 |
> |
&print_pair(1, "packet.memory.free", $free); |
| 149 |
> |
|
| 150 |
> |
$top =~ /([^\s]+?)([MG]) swap in use/; |
| 151 |
> |
my($swap_in_use) = $1; |
| 152 |
> |
$swap_in_use*=1024 if $2 eq "G"; |
| 153 |
> |
# DO NOT print this one out... save it for in a moment... |
| 154 |
> |
|
| 155 |
> |
$top =~ /([^\s]+?)([MG]) swap free/; |
| 156 |
> |
my($swap_free) = $1; |
| 157 |
> |
$swap_free*=1024 if $2 eq "G"; |
| 158 |
> |
&print_pair(1, "packet.memory.swap_free", $swap_free); |
| 159 |
> |
|
| 160 |
> |
# AJ requested total swap instead of swap_in_use, so here we go! |
| 161 |
> |
&print_pair(1, "packet.memory.swap_total", $swap_free + $swap_in_use); |
| 162 |
|
} |
| 163 |
|
|
| 164 |
|
# sub to get details of the machine's operating system. |