+ Add unit for perfdatas

This commit is contained in:
garnier-quentin 2015-04-27 10:54:33 +02:00
parent f6b96e7a22
commit 73813266b3
35 changed files with 68 additions and 71 deletions

View File

@ -86,8 +86,8 @@ sub run {
if ($valueStatus == 1) {
my $exit_code = $self->{perfdata}->threshold_check(value => $valueRuntime,
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->perfdata_add(label => 'runtime',
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->perfdata_add(label => 'runtime', unit => 's',
value => floor($valueRuntime / 100),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
@ -97,7 +97,7 @@ sub run {
defined($self->{option_results}->{seconds}) ? floor($valueRuntime / 100) . " seconds" : floor($valueRuntime / 86400 / 100) . " days" ));
} else {
$self->{output}->perfdata_add(label => 'runtime',
$self->{output}->perfdata_add(label => 'runtime', unit => 's',
value => 0,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),

View File

@ -174,7 +174,7 @@ sub run {
$self->{output}->option_exit();
}
my $exit = $self->{perfdata}->threshold_check(value => $memUsed_prct, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my $exit = $self->{perfdata}->threshold_check(value => $memUsed_prct, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my ($memTotal_value, $memTotal_unit) = $self->{perfdata}->change_bytes(value => $memTotal);
my ($memFree_value, $memFree_unit) = $self->{perfdata}->change_bytes(value => $memFree);
@ -186,7 +186,7 @@ sub run {
short_msg => sprintf("Memory used %s (%.2f%%)",
$memUsed_value . " " . $memUsed_unit, $memUsed_prct));
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $memUsed,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $memTotal),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $memTotal),

View File

@ -126,21 +126,18 @@ sub run {
short_msg => sprintf("CPU Usage: %.2f%% (5sec), %.2f%% (1min), %.2f%% (5min)",
$cpu5sec, $cpu1min, $cpu5min));
$self->{output}->perfdata_add(label => "cpu_5s",
$self->{output}->perfdata_add(label => "cpu_5s", unit => '%',
value => $cpu5sec,
unit => '%',
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5s'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5s'),
min => 0, max => 100);
$self->{output}->perfdata_add(label => "cpu_1m",
$self->{output}->perfdata_add(label => "cpu_1m", unit => '%',
value => $cpu1min,
unit => '%',
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'),
min => 0, max => 100);
$self->{output}->perfdata_add(label => "cpu_5m",
$self->{output}->perfdata_add(label => "cpu_5m", unit => '%',
value => $cpu5min,
unit => '%',
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5m'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5m'),
min => 0, max => 100);

View File

@ -99,9 +99,8 @@ sub run {
$memory_available_value . " " . $memory_available_unit,
$memory_free_value . " " . $memory_free_unit, $prct_free));
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $memory_used,
unit => 'B',
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $memory_available, cast_int => 1),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $memory_available, cast_int => 1),
min => 0, max => $memory_available);

View File

@ -92,7 +92,7 @@ sub cpu_ha {
my $cpu_num = $1;
$self->{output}->output_add(long_msg => sprintf("CPU master $cpu_num Usage is %.2f%%", $self->{result}->{$oid_fgHaStatsCpuUsage}->{$key}));
$self->{output}->perfdata_add(label => 'cpu_master' . $cpu_num,
$self->{output}->perfdata_add(label => 'cpu_master' . $cpu_num, unit => '%',
value => sprintf("%.2f", $self->{result}->{$oid_fgHaStatsCpuUsage}->{$key}),
min => 0, max => 100);
}
@ -108,7 +108,7 @@ sub cpu_ha {
'master' : 'slave';
$self->{output}->output_add(long_msg => sprintf("CPU %s Usage is %.2f%%", $label, $self->{result}->{$oid_fgHaStatsCpuUsage}->{$key}));
$self->{output}->perfdata_add(label => 'cpu_' . $label,
$self->{output}->perfdata_add(label => 'cpu_' . $label, unit => '%',
value => sprintf("%.2f", $self->{result}->{$oid_fgHaStatsCpuUsage}->{$key}),
min => 0, max => 100);
}
@ -144,7 +144,7 @@ sub run {
$i++;
$self->{output}->output_add(long_msg => sprintf("CPU $cpu_num Usage is %.2f%%", $self->{result}->{$oid_cpu}->{$key}));
$self->{output}->perfdata_add(label => 'cpu' . $cpu_num,
$self->{output}->perfdata_add(label => 'cpu' . $cpu_num, unit => '%',
value => sprintf("%.2f", $self->{result}->{$oid_cpu}->{$key}),
min => 0, max => 100);
}
@ -154,7 +154,7 @@ sub run {
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit_code,
short_msg => sprintf("CPU(s) average usage is: %.2f%%", $avg_cpu));
$self->{output}->perfdata_add(label => 'total_cpu_avg',
$self->{output}->perfdata_add(label => 'total_cpu_avg', unit => '%',
value => sprintf("%.2f", $avg_cpu),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),

View File

@ -100,7 +100,7 @@ sub run {
$self->{output}->output_add(severity => $exit_code,
short_msg => sprintf("DB '" . $$row[0] . "' size: %s%s", $value, $value_unit));
}
$self->{output}->perfdata_add(label => $$row[0] . '_size',
$self->{output}->perfdata_add(label => $$row[0] . '_size', unit => 'B',
value => $$row[1],
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),

View File

@ -86,7 +86,7 @@ sub run {
} else {
my $milliseconds = $now2 - $now;
$milliseconds = floor($milliseconds * 1000);
my $exit_code = $self->{perfdata}->threshold_check(value => $milliseconds, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my $exit_code = $self->{perfdata}->threshold_check(value => $milliseconds, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit_code,
short_msg => sprintf("Connection established in %.3fs.", $milliseconds / 1000));
$self->{output}->perfdata_add(label => 'connection_time', unit => 'ms',

View File

@ -110,7 +110,7 @@ ORDER BY query_start, procpid DESC
next;
}
my $exit_code = $self->{perfdata}->threshold_check(value => $row->{seconds}, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my $exit_code = $self->{perfdata}->threshold_check(value => $row->{seconds}, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
if ($self->{output}->is_status(value => $exit_code, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(long_msg => sprintf("Request from client '%s' too long (%d sec) on database '%s': %s",
$row->{client_addr}, $row->{seconds}, $row->{datname}, $row->{current_query}));

View File

@ -91,13 +91,14 @@ sub run {
$self->{output}->output_add(severity => $exit_code,
short_msg => sprintf('Tablespace "%s" size is %s %s',$self->{option_results}->{tablespace}, $value, $value_unit));
$self->{output}->perfdata_add(label => $self->{option_results}->{tablespace},
$self->{output}->perfdata_add(label => $self->{option_results}->{tablespace}, unit => 'B',
value => $result,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'));
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),
min => 0);
} else {
$self->{output}->output_add(severity => 'UNKNOWN',
short_msg => sprintf('Table space "%s" is unknown ...',$self->{option_results}->{tablespace}));
short_msg => sprintf('Table space "%s" is unknown ...', $self->{option_results}->{tablespace}));
}
$self->{output}->display();

View File

@ -115,7 +115,7 @@ sub run {
$free_value . " " . $free_unit, $prct_free));
}
$self->{output}->perfdata_add(label => "used_" . $memory_name,
$self->{output}->perfdata_add(label => "used_" . $memory_name, unit => 'B',
value => $memory_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size),

View File

@ -117,13 +117,13 @@ sub run {
}
if ($mode == 1) {
$self->{output}->perfdata_add(label => "used_" . $memory_name,
$self->{output}->perfdata_add(label => "used_" . $memory_name, unit => 'B',
value => $memory_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size),
min => 0, max => $total_size);
} else {
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $memory_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size),

View File

@ -112,7 +112,7 @@ sub check_table_memory {
$free_value . " " . $free_unit, $prct_free));
}
$self->{output}->perfdata_add(label => "used_" . $memory_name,
$self->{output}->perfdata_add(label => "used_" . $memory_name, unit => 'B',
value => $memory_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size),

View File

@ -94,7 +94,7 @@ sub run {
my $prct_used = $memory_used * 100 / $total_size;
my $prct_free = 100 - $prct_used;
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my ($total_value, $total_unit) = $self->{perfdata}->change_bytes(value => $total_size);
my ($used_value, $used_unit) = $self->{perfdata}->change_bytes(value => $memory_used);
my ($free_value, $free_unit) = $self->{perfdata}->change_bytes(value => $memory_free);
@ -111,7 +111,7 @@ sub run {
$free_value . " " . $free_unit, $prct_free));
}
$self->{output}->perfdata_add(label => "used_" . $instance,
$self->{output}->perfdata_add(label => "used_" . $instance, unit => 'B',
value => $memory_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size),

View File

@ -134,7 +134,7 @@ sub run {
my $extra_label = '';
$extra_label = '_' . $description if ($multiple == 1);
$self->{output}->perfdata_add(label => "used" . $extra_label,
$self->{output}->perfdata_add(label => "used" . $extra_label, unit => 'B',
value => $memory_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size),

View File

@ -104,28 +104,28 @@ sub run {
my $cpu15min = $result->{$oid_nsResCpuLast15Min};
my $exit1 = $self->{perfdata}->threshold_check(value => $cpu1min,
threshold => [ { label => 'crit1min', 'exit_litteral' => 'critical' }, { label => 'warn1min', exit_litteral => 'warning' } ]);
threshold => [ { label => 'crit1min', exit_litteral => 'critical' }, { label => 'warn1min', exit_litteral => 'warning' } ]);
my $exit2 = $self->{perfdata}->threshold_check(value => $cpu5min,
threshold => [ { label => 'crit5min', 'exit_litteral' => 'critical' }, { label => 'warn5min', exit_litteral => 'warning' } ]);
threshold => [ { label => 'crit5min', exit_litteral => 'critical' }, { label => 'warn5min', exit_litteral => 'warning' } ]);
my $exit3 = $self->{perfdata}->threshold_check(value => $cpu15min,
threshold => [ { label => 'crit15min', 'exit_litteral' => 'critical' }, { label => 'warn15min', exit_litteral => 'warning' } ]);
threshold => [ { label => 'crit15min', exit_litteral => 'critical' }, { label => 'warn15min', exit_litteral => 'warning' } ]);
my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2, $exit3 ]);
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("CPU Usage: %.2f%% (1min), %.2f%% (5min), %.2f%% (15min)",
$cpu1min, $cpu5min, $cpu15min));
$self->{output}->perfdata_add(label => "cpu_1min",
$self->{output}->perfdata_add(label => "cpu_1min", unit => '%',
value => $cpu1min,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1min'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1min'),
min => 0, max => 100);
$self->{output}->perfdata_add(label => "cpu_5min",
$self->{output}->perfdata_add(label => "cpu_5min", unit => '%',
value => $cpu5min,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5min'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5min'),
min => 0, max => 100);
$self->{output}->perfdata_add(label => "cpu_15min",
$self->{output}->perfdata_add(label => "cpu_15min", unit => '%',
value => $cpu15min,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn15min'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit15min'),

View File

@ -101,7 +101,7 @@ sub run {
$free_value . " " . $free_unit, $prct_free,
$frag_value . " " . $frag_unit, $prct_frag));
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $memory_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size),

View File

@ -115,17 +115,17 @@ sub run {
short_msg => sprintf("MP CPU Usage: %.2f%% (1sec), %.2f%% (4sec), %.2f%% (64sec)",
$cpu1sec, $cpu4sec, $cpu64sec));
$self->{output}->perfdata_add(label => "cpu_1s",
$self->{output}->perfdata_add(label => "cpu_1s", unit => '%',
value => $cpu1sec,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1s'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1s'),
min => 0, max => 100);
$self->{output}->perfdata_add(label => "cpu_4s",
$self->{output}->perfdata_add(label => "cpu_4s", unit => '%',
value => $cpu4sec,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn4s'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit4s'),
min => 0, max => 100);
$self->{output}->perfdata_add(label => "cpu_64s",
$self->{output}->perfdata_add(label => "cpu_64s", unit => '%',
value => $cpu64sec,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn64s'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit64s'),

View File

@ -96,7 +96,7 @@ sub run {
$used_value . " " . $used_unit, $prct_used,
$free_value . " " . $free_unit, $prct_free));
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $memory_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size),

View File

@ -132,17 +132,17 @@ sub run {
short_msg => sprintf("CPU: %.2f%% (5sec), %.2f%% (1min), %.2f%% (5min)",
$cpu5sec, $cpu1min, $cpu5min));
$self->{output}->perfdata_add(label => "cpu_5s",
$self->{output}->perfdata_add(label => "cpu_5s", unit => '%',
value => $cpu5sec,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5s'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5s'),
min => 0, max => 100);
$self->{output}->perfdata_add(label => "cpu_1m",
$self->{output}->perfdata_add(label => "cpu_1m", unit => '%',
value => $cpu1min,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'),
min => 0, max => 100);
$self->{output}->perfdata_add(label => "cpu_5m",
$self->{output}->perfdata_add(label => "cpu_5m", unit => '%',
value => $cpu5min,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5m'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5m'),

View File

@ -93,7 +93,7 @@ sub run {
$used_value . " " . $used_unit, $prct_used,
$total_value . " " . $total_unit));
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1),

View File

@ -132,13 +132,13 @@ sub run {
$buffer_value . " " . $buffer_unit,
$cached_value . " " . $cached_unit));
$self->{output}->perfdata_add(label => "cached",
$self->{output}->perfdata_add(label => "cached", unit => 'B',
value => $cached_used,
min => 0);
$self->{output}->perfdata_add(label => "buffer",
$self->{output}->perfdata_add(label => "buffer", unit => 'B',
value => $buffer_used,
min => 0);
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $nobuf_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1),
@ -168,7 +168,7 @@ sub run {
$swap_used_value . " " . $swap_used_unit, $prct_used,
$swap_free_value . " " . $swap_free_unit, (100 - $prct_used)));
$self->{output}->perfdata_add(label => "swap",
$self->{output}->perfdata_add(label => "swap", unit => 'B',
value => $swap_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-swap', total => $total_size, cast_int => 1),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-swap', total => $total_size, cast_int => 1),

View File

@ -109,7 +109,7 @@ sub run {
$threshold_value = $prct_used;
$threshold_value = $prct_free if (defined($self->{option_results}->{free}));
}
$exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$exit = $self->{perfdata}->threshold_check(value => $threshold_value, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my ($total_size_value, $total_size_unit) = $self->{perfdata}->change_bytes(value => $total_size);
my ($total_used_value, $total_used_unit) = $self->{perfdata}->change_bytes(value => $total_used);

View File

@ -146,7 +146,7 @@ sub run {
if ($i > 0) {
my $avg_cpu = $cpu / $i;
my $exit_code = $self->{perfdata}->threshold_check(value => $avg_cpu,
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->output_add(severity => $exit_code,
short_msg => sprintf("CPU(s) average usage is: %.2f%%", $avg_cpu));
$self->{output}->perfdata_add(label => 'total_cpu_avg', unit => '%',

View File

@ -124,13 +124,13 @@ sub run {
$buffer_value . " " . $buffer_unit,
$cached_value . " " . $cached_unit));
$self->{output}->perfdata_add(label => "cached",
$self->{output}->perfdata_add(label => "cached", unit => 'B',
value => $cached_used,
min => 0);
$self->{output}->perfdata_add(label => "buffer",
$self->{output}->perfdata_add(label => "buffer", unit => 'B',
value => $buffer_used,
min => 0);
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $nobuf_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size),

View File

@ -133,7 +133,7 @@ sub run {
$swap_used_value . " " . $swap_used_unit, $prct_used,
$swap_free_value . " " . $swap_free_unit, (100 - $prct_used)));
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $swap_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size),

View File

@ -101,8 +101,8 @@ sub run {
}
my $exit_code = $self->{perfdata}->threshold_check(value => floor($uptime),
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->perfdata_add(label => 'uptime',
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->perfdata_add(label => 'uptime', unit => 's',
value => floor($uptime),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),

View File

@ -117,7 +117,7 @@ sub run {
$physical_used_value . " " . $physical_used_unit, $prct_used,
$physical_free_value . " " . $physical_free_unit, 100 - $prct_used));
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $physical_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1),

View File

@ -117,7 +117,7 @@ sub run {
$swap_used_value . " " . $swap_used_unit, $prct_used,
$swap_free_value . " " . $swap_free_unit, 100 - $prct_used));
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $swap_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1),

View File

@ -120,7 +120,7 @@ sub run {
my $total_size = $result->{$oid_memTotalReal} * 1024;
my $prct_used = $nobuf_used * 100 / $total_size;
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my $exit = $self->{perfdata}->threshold_check(value => $prct_used, threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my ($nobuf_value, $nobuf_unit) = $self->{perfdata}->change_bytes(value => $nobuf_used);
my ($buffer_value, $buffer_unit) = $self->{perfdata}->change_bytes(value => $buffer_used);
@ -134,13 +134,13 @@ sub run {
$cached_value . " " . $cached_unit,
$shared_value . " " . $shared_unit));
$self->{output}->perfdata_add(label => "cached",
$self->{output}->perfdata_add(label => "cached", unit => 'B',
value => $cached_used,
min => 0);
$self->{output}->perfdata_add(label => "buffer",
$self->{output}->perfdata_add(label => "buffer", unit => 'B',
value => $buffer_used,
min => 0);
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $nobuf_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1),
@ -170,7 +170,7 @@ sub run {
$swap_used_value . " " . $swap_used_unit, $prct_used,
$swap_free_value . " " . $swap_free_unit, (100 - $prct_used)));
$self->{output}->perfdata_add(label => "swap",
$self->{output}->perfdata_add(label => "swap", unit => 'B',
value => $swap_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-swap', total => $total_size, cast_int => 1),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-swap', total => $total_size, cast_int => 1),

View File

@ -109,7 +109,7 @@ sub run {
$swap_used_value . " " . $swap_used_unit, $prct_used,
$swap_free_value . " " . $swap_free_unit, (100 - $prct_used)));
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $swap_used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1),

View File

@ -96,8 +96,8 @@ sub run {
}
my $exit_code = $self->{perfdata}->threshold_check(value => floor($value / 100),
threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->perfdata_add(label => 'uptime',
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
$self->{output}->perfdata_add(label => 'uptime', unit => 's',
value => floor($value / 100),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical'),

View File

@ -204,7 +204,7 @@ sub run {
$total_options{total} = $total_size;
$total_options{cast_int} = 1;
}
$self->{output}->perfdata_add(label => $label . $extra_label, unit => 'o',
$self->{output}->perfdata_add(label => $label . $extra_label, unit => 'B',
value => $value_perf,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', %total_options),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', %total_options),

View File

@ -102,7 +102,7 @@ sub run {
$used_value . " " . $used_unit, $prct_used,
$free_value . " " . $free_unit, $prct_free));
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size),

View File

@ -103,7 +103,7 @@ sub run {
$used_value . " " . $used_unit, $prct_used,
$free_value . " " . $free_unit, $prct_free));
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => $used,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size),

View File

@ -117,7 +117,7 @@ sub run {
$used_value . " " . $used_unit, $prct_used,
$free_value . " " . $free_unit, $prct_free));
$self->{output}->perfdata_add(label => "used",
$self->{output}->perfdata_add(label => "used", unit => 'B',
value => int($memory_used),
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning', total => $total_size, cast_int => 1),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical', total => $total_size, cast_int => 1),