180 |
|
|
181 |
|
my(@statgrab) = `./statgrab.pl`; |
182 |
|
my(%packet); |
183 |
< |
for (my($i) = 0; $i < $#statgrab; $i++) { |
183 |
> |
for (my($i) = 0; $i <= $#statgrab; $i++) { |
184 |
|
$statgrab[$i] =~ /^([^\s]*) (.*)$/; |
185 |
|
$packet{$1} = $2; |
186 |
|
} |
190 |
|
my($disk_info) = "<disk>"; |
191 |
|
my($i) = 0; |
192 |
|
while (defined $packet{"packet.disk.p$i.attributes.mount"}) { |
193 |
< |
$disk_info .= "<p$i>"; |
194 |
< |
$disk_info .= qq/<name>$packet{"packet.disk.p$i.attributes.name"}<\/name>/; |
195 |
< |
$disk_info .= qq/<kbytes>$packet{"packet.disk.p$i.attributes.kbytes"}<\/kbytes>/; |
196 |
< |
$disk_info .= qq/<used>$packet{"packet.disk.p$i.attributes.used"}<\/used>/; |
197 |
< |
$disk_info .= qq/<avail>$packet{"packet.disk.p$i.attributes.avail"}<\/avail>/; |
198 |
< |
$disk_info .= qq/<mount>$packet{"packet.disk.p$i.attributes.mount"}<\/mount>/; |
199 |
< |
$disk_info .= "</p$i>"; |
193 |
> |
$disk_info .= "<p$i"; |
194 |
> |
$disk_info .= " name=\"" . $packet{"packet.disk.p$i.attributes.name"} . "\""; |
195 |
> |
$disk_info .= " kbytes=\"" . $packet{"packet.disk.p$i.attributes.kbytes"} . "\""; |
196 |
> |
$disk_info .= " used=\"" . $packet{"packet.disk.p$i.attributes.used"} . "\""; |
197 |
> |
$disk_info .= " avail=\"" . $packet{"packet.disk.p$i.attributes.avail"} . "\""; |
198 |
> |
$disk_info .= " mount=\"" . $packet{"packet.disk.p$i.attributes.mount"} . "\""; |
199 |
> |
$disk_info .= "></p$i>"; |
200 |
|
++$i; |
201 |
|
} |
202 |
|
$disk_info .= "</disk>"; |
247 |
|
<swap>$packet{"packet.cpu.swap"}</swap> |
248 |
|
</cpu> |
249 |
|
<memory> |
250 |
< |
<total>$packet{"packet.memory.real"}</total> |
250 |
> |
<total>$packet{"packet.memory.total"}</total> |
251 |
|
<free>$packet{"packet.memory.free"}</free> |
252 |
|
</memory> |
253 |
|
<swap> |
254 |
< |
<total>$packet{"packet.memory.swap_total"}</total> |
255 |
< |
<free>$packet{"packet.memory.swap_free"}</free> |
254 |
> |
<total>$packet{"packet.swap.total"}</total> |
255 |
> |
<free>$packet{"packet.swap.free"}</free> |
256 |
|
</swap> |
257 |
|
$disk_info |
258 |
|
</packet> |