Skip to content
Snippets Groups Projects
Commit c2112fbb authored by Eric Sproul's avatar Eric Sproul
Browse files

Module for checking free memory remaining on Solaris

git-svn-id: https://labs.omniti.com/resmon/trunk@122 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55
parent 45928689
No related branches found
No related tags found
No related merge requests found
package Resmon::Module::SWAPSIZE;
use Resmon::Module;
use Resmon::ExtComm qw/cache_command/;
use vars qw/@ISA/;
@ISA = qw/Resmon::Module/;
sub handler {
my $arg = shift;
my $os = $arg->fresh_status();
return $os if $os;
my $object = $arg->{'object'};
my $output = cache_command("df -k /tmp", 30);
my ($line) = grep(/^swap/, split(/\n/, $output));
if($line =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\d+)%/) {
if($1 >= $arg->{'limit'}) {
return $arg->set_status("OK($1 k size)");
}
return $arg->set_status("BAD($1 k size)");
}
return $arg->set_status("BAD(no data)");
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment