From 73813266b3fc3e7465a7eb32410d2c85f2df5c85 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Mon, 27 Apr 2015 10:54:33 +0200 Subject: [PATCH] + Add unit for perfdatas --- centreon-plugins/apps/pfsense/snmp/mode/runtime.pm | 6 +++--- centreon-plugins/apps/tomcat/web/mode/memory.pm | 4 ++-- .../centreon/common/fastpath/mode/cpu.pm | 9 +++------ .../centreon/common/fastpath/mode/memory.pm | 3 +-- .../centreon/common/fortinet/fortigate/mode/cpu.pm | 8 ++++---- .../database/mysql/mode/databasessize.pm | 2 +- .../database/postgres/mode/connectiontime.pm | 2 +- centreon-plugins/database/postgres/mode/querytime.pm | 2 +- .../database/postgres/mode/tablespace.pm | 7 ++++--- .../network/alcatel/common/mode/flashmemory.pm | 2 +- centreon-plugins/network/aruba/common/mode/memory.pm | 4 ++-- centreon-plugins/network/cisco/common/mode/memory.pm | 2 +- centreon-plugins/network/hp/procurve/mode/memory.pm | 4 ++-- .../juniper/common/junos/mode/memoryrouting.pm | 2 +- .../network/juniper/common/screenos/mode/cpu.pm | 12 ++++++------ .../network/juniper/common/screenos/mode/memory.pm | 2 +- .../network/radware/alteon/common/mode/cpu.pm | 6 +++--- .../network/radware/alteon/common/mode/memory.pm | 2 +- centreon-plugins/network/redback/snmp/mode/cpu.pm | 6 +++--- centreon-plugins/network/ruggedcom/mode/memory.pm | 2 +- .../network/stonesoft/snmp/mode/memory.pm | 8 ++++---- .../network/stonesoft/snmp/mode/storage.pm | 2 +- centreon-plugins/os/linux/local/mode/cpu.pm | 2 +- centreon-plugins/os/linux/local/mode/memory.pm | 6 +++--- centreon-plugins/os/linux/local/mode/swap.pm | 2 +- centreon-plugins/os/linux/local/mode/uptime.pm | 4 ++-- centreon-plugins/os/windows/snmp/mode/memory.pm | 2 +- centreon-plugins/os/windows/snmp/mode/swap.pm | 2 +- centreon-plugins/snmp_standard/mode/memory.pm | 10 +++++----- centreon-plugins/snmp_standard/mode/swap.pm | 2 +- centreon-plugins/snmp_standard/mode/uptime.pm | 4 ++-- centreon-plugins/storage/netapp/mode/filesys.pm | 2 +- .../storage/panzura/snmp/mode/diskusagelocal.pm | 2 +- centreon-plugins/storage/panzura/snmp/mode/memory.pm | 2 +- centreon-plugins/storage/qnap/snmp/mode/memory.pm | 2 +- 35 files changed, 68 insertions(+), 71 deletions(-) diff --git a/centreon-plugins/apps/pfsense/snmp/mode/runtime.pm b/centreon-plugins/apps/pfsense/snmp/mode/runtime.pm index b221ddb33..d0d92d084 100644 --- a/centreon-plugins/apps/pfsense/snmp/mode/runtime.pm +++ b/centreon-plugins/apps/pfsense/snmp/mode/runtime.pm @@ -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'), diff --git a/centreon-plugins/apps/tomcat/web/mode/memory.pm b/centreon-plugins/apps/tomcat/web/mode/memory.pm index 4b3b0ed53..2338af787 100644 --- a/centreon-plugins/apps/tomcat/web/mode/memory.pm +++ b/centreon-plugins/apps/tomcat/web/mode/memory.pm @@ -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), diff --git a/centreon-plugins/centreon/common/fastpath/mode/cpu.pm b/centreon-plugins/centreon/common/fastpath/mode/cpu.pm index 937cfc652..aada0e377 100644 --- a/centreon-plugins/centreon/common/fastpath/mode/cpu.pm +++ b/centreon-plugins/centreon/common/fastpath/mode/cpu.pm @@ -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); diff --git a/centreon-plugins/centreon/common/fastpath/mode/memory.pm b/centreon-plugins/centreon/common/fastpath/mode/memory.pm index c1e16160c..840c59ed8 100644 --- a/centreon-plugins/centreon/common/fastpath/mode/memory.pm +++ b/centreon-plugins/centreon/common/fastpath/mode/memory.pm @@ -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); diff --git a/centreon-plugins/centreon/common/fortinet/fortigate/mode/cpu.pm b/centreon-plugins/centreon/common/fortinet/fortigate/mode/cpu.pm index cd78efcc1..a9c5d7862 100644 --- a/centreon-plugins/centreon/common/fortinet/fortigate/mode/cpu.pm +++ b/centreon-plugins/centreon/common/fortinet/fortigate/mode/cpu.pm @@ -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'), diff --git a/centreon-plugins/database/mysql/mode/databasessize.pm b/centreon-plugins/database/mysql/mode/databasessize.pm index a397f2922..bf9ea1c76 100644 --- a/centreon-plugins/database/mysql/mode/databasessize.pm +++ b/centreon-plugins/database/mysql/mode/databasessize.pm @@ -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'), diff --git a/centreon-plugins/database/postgres/mode/connectiontime.pm b/centreon-plugins/database/postgres/mode/connectiontime.pm index d3e7c4a47..a60afae92 100644 --- a/centreon-plugins/database/postgres/mode/connectiontime.pm +++ b/centreon-plugins/database/postgres/mode/connectiontime.pm @@ -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', diff --git a/centreon-plugins/database/postgres/mode/querytime.pm b/centreon-plugins/database/postgres/mode/querytime.pm index 1c0ee1fdd..f3504b99c 100644 --- a/centreon-plugins/database/postgres/mode/querytime.pm +++ b/centreon-plugins/database/postgres/mode/querytime.pm @@ -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})); diff --git a/centreon-plugins/database/postgres/mode/tablespace.pm b/centreon-plugins/database/postgres/mode/tablespace.pm index 1c65cb797..f03d6215a 100644 --- a/centreon-plugins/database/postgres/mode/tablespace.pm +++ b/centreon-plugins/database/postgres/mode/tablespace.pm @@ -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(); diff --git a/centreon-plugins/network/alcatel/common/mode/flashmemory.pm b/centreon-plugins/network/alcatel/common/mode/flashmemory.pm index 47b9e0a06..25298a67a 100644 --- a/centreon-plugins/network/alcatel/common/mode/flashmemory.pm +++ b/centreon-plugins/network/alcatel/common/mode/flashmemory.pm @@ -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), diff --git a/centreon-plugins/network/aruba/common/mode/memory.pm b/centreon-plugins/network/aruba/common/mode/memory.pm index 1a52f7c22..fcddfcffe 100644 --- a/centreon-plugins/network/aruba/common/mode/memory.pm +++ b/centreon-plugins/network/aruba/common/mode/memory.pm @@ -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), diff --git a/centreon-plugins/network/cisco/common/mode/memory.pm b/centreon-plugins/network/cisco/common/mode/memory.pm index 93747657f..dab782fec 100644 --- a/centreon-plugins/network/cisco/common/mode/memory.pm +++ b/centreon-plugins/network/cisco/common/mode/memory.pm @@ -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), diff --git a/centreon-plugins/network/hp/procurve/mode/memory.pm b/centreon-plugins/network/hp/procurve/mode/memory.pm index 5d72c78a6..40e6e9438 100644 --- a/centreon-plugins/network/hp/procurve/mode/memory.pm +++ b/centreon-plugins/network/hp/procurve/mode/memory.pm @@ -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), diff --git a/centreon-plugins/network/juniper/common/junos/mode/memoryrouting.pm b/centreon-plugins/network/juniper/common/junos/mode/memoryrouting.pm index 8b879333e..8e21a09af 100644 --- a/centreon-plugins/network/juniper/common/junos/mode/memoryrouting.pm +++ b/centreon-plugins/network/juniper/common/junos/mode/memoryrouting.pm @@ -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), diff --git a/centreon-plugins/network/juniper/common/screenos/mode/cpu.pm b/centreon-plugins/network/juniper/common/screenos/mode/cpu.pm index 1bb27cc30..d311eca68 100644 --- a/centreon-plugins/network/juniper/common/screenos/mode/cpu.pm +++ b/centreon-plugins/network/juniper/common/screenos/mode/cpu.pm @@ -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'), diff --git a/centreon-plugins/network/juniper/common/screenos/mode/memory.pm b/centreon-plugins/network/juniper/common/screenos/mode/memory.pm index af617da27..477332364 100644 --- a/centreon-plugins/network/juniper/common/screenos/mode/memory.pm +++ b/centreon-plugins/network/juniper/common/screenos/mode/memory.pm @@ -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), diff --git a/centreon-plugins/network/radware/alteon/common/mode/cpu.pm b/centreon-plugins/network/radware/alteon/common/mode/cpu.pm index f0b0b01f2..c076d6ec9 100644 --- a/centreon-plugins/network/radware/alteon/common/mode/cpu.pm +++ b/centreon-plugins/network/radware/alteon/common/mode/cpu.pm @@ -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'), diff --git a/centreon-plugins/network/radware/alteon/common/mode/memory.pm b/centreon-plugins/network/radware/alteon/common/mode/memory.pm index b5adb471d..578945171 100644 --- a/centreon-plugins/network/radware/alteon/common/mode/memory.pm +++ b/centreon-plugins/network/radware/alteon/common/mode/memory.pm @@ -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), diff --git a/centreon-plugins/network/redback/snmp/mode/cpu.pm b/centreon-plugins/network/redback/snmp/mode/cpu.pm index 7b12efc9b..51e864c96 100644 --- a/centreon-plugins/network/redback/snmp/mode/cpu.pm +++ b/centreon-plugins/network/redback/snmp/mode/cpu.pm @@ -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'), diff --git a/centreon-plugins/network/ruggedcom/mode/memory.pm b/centreon-plugins/network/ruggedcom/mode/memory.pm index 3df91f14e..58b1e846f 100644 --- a/centreon-plugins/network/ruggedcom/mode/memory.pm +++ b/centreon-plugins/network/ruggedcom/mode/memory.pm @@ -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), diff --git a/centreon-plugins/network/stonesoft/snmp/mode/memory.pm b/centreon-plugins/network/stonesoft/snmp/mode/memory.pm index c90ed0889..6dfd58466 100644 --- a/centreon-plugins/network/stonesoft/snmp/mode/memory.pm +++ b/centreon-plugins/network/stonesoft/snmp/mode/memory.pm @@ -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), diff --git a/centreon-plugins/network/stonesoft/snmp/mode/storage.pm b/centreon-plugins/network/stonesoft/snmp/mode/storage.pm index c6e4d3efb..2baa99f15 100644 --- a/centreon-plugins/network/stonesoft/snmp/mode/storage.pm +++ b/centreon-plugins/network/stonesoft/snmp/mode/storage.pm @@ -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); diff --git a/centreon-plugins/os/linux/local/mode/cpu.pm b/centreon-plugins/os/linux/local/mode/cpu.pm index 5eee43f49..c49ad1b60 100644 --- a/centreon-plugins/os/linux/local/mode/cpu.pm +++ b/centreon-plugins/os/linux/local/mode/cpu.pm @@ -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 => '%', diff --git a/centreon-plugins/os/linux/local/mode/memory.pm b/centreon-plugins/os/linux/local/mode/memory.pm index 13655208d..e737c3f5d 100644 --- a/centreon-plugins/os/linux/local/mode/memory.pm +++ b/centreon-plugins/os/linux/local/mode/memory.pm @@ -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), diff --git a/centreon-plugins/os/linux/local/mode/swap.pm b/centreon-plugins/os/linux/local/mode/swap.pm index 169d8dff1..48d40761c 100644 --- a/centreon-plugins/os/linux/local/mode/swap.pm +++ b/centreon-plugins/os/linux/local/mode/swap.pm @@ -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), diff --git a/centreon-plugins/os/linux/local/mode/uptime.pm b/centreon-plugins/os/linux/local/mode/uptime.pm index 9adc36d08..4c1282a25 100644 --- a/centreon-plugins/os/linux/local/mode/uptime.pm +++ b/centreon-plugins/os/linux/local/mode/uptime.pm @@ -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'), diff --git a/centreon-plugins/os/windows/snmp/mode/memory.pm b/centreon-plugins/os/windows/snmp/mode/memory.pm index 57421f74d..31e45911a 100644 --- a/centreon-plugins/os/windows/snmp/mode/memory.pm +++ b/centreon-plugins/os/windows/snmp/mode/memory.pm @@ -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), diff --git a/centreon-plugins/os/windows/snmp/mode/swap.pm b/centreon-plugins/os/windows/snmp/mode/swap.pm index 60b186650..facc2dfee 100644 --- a/centreon-plugins/os/windows/snmp/mode/swap.pm +++ b/centreon-plugins/os/windows/snmp/mode/swap.pm @@ -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), diff --git a/centreon-plugins/snmp_standard/mode/memory.pm b/centreon-plugins/snmp_standard/mode/memory.pm index 28c7e2ead..e111325c9 100644 --- a/centreon-plugins/snmp_standard/mode/memory.pm +++ b/centreon-plugins/snmp_standard/mode/memory.pm @@ -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), diff --git a/centreon-plugins/snmp_standard/mode/swap.pm b/centreon-plugins/snmp_standard/mode/swap.pm index 032b37a3d..e06431c94 100644 --- a/centreon-plugins/snmp_standard/mode/swap.pm +++ b/centreon-plugins/snmp_standard/mode/swap.pm @@ -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), diff --git a/centreon-plugins/snmp_standard/mode/uptime.pm b/centreon-plugins/snmp_standard/mode/uptime.pm index 4c9e3febe..bcd857de5 100644 --- a/centreon-plugins/snmp_standard/mode/uptime.pm +++ b/centreon-plugins/snmp_standard/mode/uptime.pm @@ -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'), diff --git a/centreon-plugins/storage/netapp/mode/filesys.pm b/centreon-plugins/storage/netapp/mode/filesys.pm index 9ad90abdd..956d09d08 100644 --- a/centreon-plugins/storage/netapp/mode/filesys.pm +++ b/centreon-plugins/storage/netapp/mode/filesys.pm @@ -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), diff --git a/centreon-plugins/storage/panzura/snmp/mode/diskusagelocal.pm b/centreon-plugins/storage/panzura/snmp/mode/diskusagelocal.pm index d35be397c..c11a09c11 100644 --- a/centreon-plugins/storage/panzura/snmp/mode/diskusagelocal.pm +++ b/centreon-plugins/storage/panzura/snmp/mode/diskusagelocal.pm @@ -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), diff --git a/centreon-plugins/storage/panzura/snmp/mode/memory.pm b/centreon-plugins/storage/panzura/snmp/mode/memory.pm index 43fc25bb6..ed7a52726 100644 --- a/centreon-plugins/storage/panzura/snmp/mode/memory.pm +++ b/centreon-plugins/storage/panzura/snmp/mode/memory.pm @@ -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), diff --git a/centreon-plugins/storage/qnap/snmp/mode/memory.pm b/centreon-plugins/storage/qnap/snmp/mode/memory.pm index fbdbceed9..315e31680 100644 --- a/centreon-plugins/storage/qnap/snmp/mode/memory.pm +++ b/centreon-plugins/storage/qnap/snmp/mode/memory.pm @@ -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),