change output format...

git-svn-id: http://svn.centreon.com/trunk/plugins-2.x@12267 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
Julien Mathis 2011-05-23 07:29:12 +00:00
parent 906ba968f7
commit 14305d6c2d
2 changed files with 8 additions and 10 deletions

View File

@ -194,7 +194,7 @@ $status = "WARNING" if ($warning[0] <= $un || $warning[1] <= $cinq || $warning[2
$status = "CRITICAL" if ($critical[0] <= $un || $critical[1] <= $cinq || $critical[2] <= $quinze);
# Print output
print "load average: ".$un.", ".$cinq.", ".$quinze.".|load1=".$un." load5=".$cinq." load15=".$quinze."\n";
print "Load average: ".$un.", ".$cinq.", ".$quinze.".|load1=".$un." load5=".$cinq." load15=".$quinze."\n";
exit $ERRORS{$status};
sub print_usage () {

View File

@ -230,7 +230,6 @@ my $total_memory_used = $swap_used + $realM_used - $cache_used;
my $total_memory_size = $swap_size + $realM_size;
# percentage of total, physical and swap memory used
if ($swap_size eq "0"){
$swap_size = 1;
}
@ -244,23 +243,22 @@ $percent_realM_used =~ s/\.[0-9]+//;
# return
if(($opt_s) && ($opt_s =~ /([0-9]+)/))
{
if(($percent_realM_used >= 99) && ($percent_swap_used > $swap_limit))
if(($opt_s) && ($opt_s =~ /([0-9]+)/)) {
if (($percent_realM_used >= 99) && ($percent_swap_used > $swap_limit))
{
print "swap threshold (".$opt_s."%) excedeed : total memory used : ".$percent_used."%, ram used : ".$percent_realM_used."%, swap used : ".$percent_swap_used."% | used=".$total_memory_used."o size=".$total_memory_size."o\n";
exit $ERRORS{'CRITICAL'};
print "Swap threshold (".$opt_s."%) excedeed : total memory used : ".$percent_used."%, ram used : ".$percent_realM_used."%, swap used : ".$percent_swap_used."% | used=".$total_memory_used."o size=".$total_memory_size."o\n";
exit $ERRORS{'CRITICAL'};
}
}
if ($percent_used >= $opt_c){
print "threshold (".$opt_c."%) excedeed : total memory used : ".$percent_used."%, ram used : ".$percent_realM_used."%, swap used : ".$percent_swap_used."% | used=".$total_memory_used."o size=".$total_memory_size."o\n";
print "Threshold (".$opt_c."%) excedeed : total memory used : ".$percent_used."%, ram used : ".$percent_realM_used."%, swap used : ".$percent_swap_used."% | used=".$total_memory_used."o size=".$total_memory_size."o\n";
exit $ERRORS{'CRITICAL'};
} elsif ($percent_used >= $opt_w){
print "threshold (".$opt_w."%) excedeed : total memory used : ".$percent_used."%, ram used : ".$percent_realM_used."%, swap used ".$percent_swap_used."% | used=".$total_memory_used."o size=".$total_memory_size."o\n";
print "Threshold (".$opt_w."%) excedeed : total memory used : ".$percent_used."%, ram used : ".$percent_realM_used."%, swap used ".$percent_swap_used."% | used=".$total_memory_used."o size=".$total_memory_size."o\n";
exit $ERRORS{'WARNING'};
} else {
print "total memory used : ".$percent_used."% ram used : ".$percent_realM_used."%, swap used ".$percent_swap_used."% | used=".$total_memory_used."o size=".$total_memory_size."o\n";
print "Total memory used : ".$percent_used."% ram used : ".$percent_realM_used."%, swap used ".$percent_swap_used."% | used=".$total_memory_used."o size=".$total_memory_size."o\n";
exit $ERRORS{'OK'};
}