#!/usr/local/bin/perl @results=`/usr/local/bin/top -n 0`; ($total, $free, $rest) = split /,/, $results[3], 3; ($blah, $total, $rest) = split / /, $total, 3; $total =~ s/M//; $free =~ s/ //; ($free, $blah) = split / /, $free, 2; $free =~ s/M//; $used=$total-$free; if ($used > 3584) { print "system memory CRITICAL: $used MB\n"; exit(2); } else { print "system memory OK: $used MB.\n"; exit (0); }