165 |
|
# The following need to be specified in megabytes. |
166 |
|
# If they are preceeded by a G, then multiply by 1024. |
167 |
|
|
168 |
< |
$top =~ /([^\s]+?)([MG]) real/; |
168 |
> |
$top =~ /([^\s]+?)([KMG]) real/; |
169 |
|
my($real) = $1; |
170 |
|
$real*=1024 if $2 eq "G"; |
171 |
+ |
$real/=1024 if $2 eq "K"; |
172 |
|
&print_pair(0, "packet.memory.total", $real); |
173 |
|
|
174 |
< |
$top =~ /([^\s]+?)([MG]) free/; |
174 |
> |
$top =~ /([^\s]+?)([KMG]) free/; |
175 |
|
my($free) = $1; |
176 |
|
$free*=1024 if $2 eq "G"; |
177 |
+ |
$free/=1024 if $2 eq "K"; |
178 |
|
&print_pair(0, "packet.memory.free", $free); |
179 |
|
|
180 |
< |
$top =~ /([^\s]+?)([MG]) swap in use/; |
180 |
> |
$top =~ /([^\s]+?)([KMG]) swap in use/; |
181 |
|
my($swap_in_use) = $1; |
182 |
|
$swap_in_use*=1024 if $2 eq "G"; |
183 |
+ |
$swap_in_use/=1024 if $2 eq "K"; |
184 |
|
# DO NOT print this one out... save it for in a moment... |
185 |
|
|
186 |
< |
$top =~ /([^\s]+?)([MG]) swap free/; |
186 |
> |
$top =~ /([^\s]+?)([KMG]) swap free/; |
187 |
|
my($swap_free) = $1; |
188 |
|
$swap_free*=1024 if $2 eq "G"; |
189 |
+ |
$swap_free/=1024 if $2 eq "K"; |
190 |
|
&print_pair(0, "packet.swap.free", $swap_free); |
191 |
|
|
192 |
|
# AJ requested total swap instead of swap_in_use, so here we go! |
219 |
|
#&print_pair(0, "packet.memory.total", $real); |
220 |
|
&print_pair(0, "packet.memory.total", 0); |
221 |
|
|
222 |
< |
$top =~ /([^\s]+?)([MG]) Free/; |
222 |
> |
$top =~ /([^\s]+?)([KMG]) Free/; |
223 |
|
my($free) = $1; |
224 |
|
$free*=1024 if $2 eq "G"; |
225 |
+ |
$free/=1024 if $2 eq "K"; |
226 |
|
&print_pair(0, "packet.memory.free", $free); |
227 |
|
|
228 |
< |
$top =~ /Swap: ([^\s]+?)([MG]) Total/; |
228 |
> |
$top =~ /Swap: ([^\s]+?)([KMG]) Total/; |
229 |
|
my($swap_total) = $1; |
230 |
|
$swap_total*=1024 if $2 eq "G"; |
231 |
+ |
$swap_total/=1024 if $2 eq "K"; |
232 |
|
&print_pair(0, "packet.swap.total", $swap_total); |
233 |
|
|
234 |
< |
$top =~ /Swap:.*, ([^\s]+?)([MG]) Free/; |
234 |
> |
$top =~ /Swap:.*, ([^\s]+?)([KMG]) Free/; |
235 |
|
my($swap_free) = $1; |
236 |
|
$swap_free*=1024 if $2 eq "G"; |
237 |
+ |
$swap_free/=1024 if $2 eq "K"; |
238 |
|
&print_pair(0, "packet.swap.free", $swap_free); |
239 |
|
} |
240 |
|
elsif ($ostype eq "Linux") { |