$message .= $_;
if (/^Mem/) {
# top from the procps on Linux has this format:
- if (/^Mem:$kmb av,$kmb used,$kmb free,$kmb shrd,$kmb buff/) {
- ($memtotal,$memused,$memfree,$shared,$buffers) = ($1,$2,$3,$4,$5);
+ if (/^Mem:$kmb (av|total),$kmb used,$kmb free,($kmb shrd,)?$kmb buff/i) {
+ ($memtotal,$memused,$memfree,$shared,$buffers) = ($1,$3,$4,$7,$8);
&to_KB($memtotal,$memused,$memfree,$shared,$buffers);
$_ = <CMD>;
$message .= $_;
- if (/^Swap:$kmb av,$kmb used,$kmb free$kmb cached/) {
- ($swaptotal, $swapused, $swapfree, $cached) = ($1,$2,$3,$4);
+ if (/^Swap:$kmb (av|total),$kmb used,$kmb free,*$kmb cached/i) {
+ ($swaptotal, $swapused, $swapfree, $cached) = ($1,$3,$4,$5);
&to_KB($swaptotal, $swapused, $swapfree, $cached);
} else {
close CMD;