From c53fc751fa0c6f765a8a0b39bb127d5d77af4c88 Mon Sep 17 00:00:00 2001 From: UrBnW <40244829+UrBnW@users.noreply.github.com> Date: Fri, 17 Apr 2020 10:49:03 +0200 Subject: [PATCH 1/3] Blade/Flex use same time units --- .../centreon/common/ibm/nos/snmp/mode/cpu.pm | 6 ++--- .../lenovo/flexsystem/snmp/mode/cpu.pm | 26 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/centreon-plugins/centreon/common/ibm/nos/snmp/mode/cpu.pm b/centreon-plugins/centreon/common/ibm/nos/snmp/mode/cpu.pm index 786883678..5260d01e6 100644 --- a/centreon-plugins/centreon/common/ibm/nos/snmp/mode/cpu.pm +++ b/centreon-plugins/centreon/common/ibm/nos/snmp/mode/cpu.pm @@ -35,7 +35,7 @@ sub set_counters { $self->{maps_counters}->{cpu} = [ { label => 'average-1m', nlabel => 'cpu.utilization.1m.percentage', set => { key_values => [ { name => 'average_1m' } ], - output_template => '%.2f %% (1min)', + output_template => '%.2f %% (1m)', perfdatas => [ { value => 'average_1m_absolute', template => '%.2f', min => 0, max => 100, unit => '%' } @@ -44,7 +44,7 @@ sub set_counters { }, { label => 'average-5m', nlabel => 'cpu.utilization.5m.percentage', set => { key_values => [ { name => 'average_5m' } ], - output_template => '%.2f %% (5min)', + output_template => '%.2f %% (5m)', perfdatas => [ { value => 'average_5m_absolute', template => '%.2f', min => 0, max => 100, unit => '%' } @@ -94,7 +94,7 @@ Check CPU usage (over the last minute). =item B<--warning-*> B<--critical-*> Thresholds. -Can be: 'average-1min' (%), 'average-5min' (%). +Can be: 'average-1m' (%), 'average-5m' (%). =back diff --git a/centreon-plugins/network/lenovo/flexsystem/snmp/mode/cpu.pm b/centreon-plugins/network/lenovo/flexsystem/snmp/mode/cpu.pm index c297f0eb3..9f3e87c16 100644 --- a/centreon-plugins/network/lenovo/flexsystem/snmp/mode/cpu.pm +++ b/centreon-plugins/network/lenovo/flexsystem/snmp/mode/cpu.pm @@ -33,20 +33,20 @@ sub set_counters { ]; $self->{maps_counters}->{cpu} = [ - { label => 'average-1min', nlabel => 'switch.cpu.utilization.1min.percentage', set => { - key_values => [ { name => 'average_1min' }, { name => 'display' } ], - output_template => '%.2f %% (1min)', + { label => 'average-1m', nlabel => 'switch.cpu.utilization.1m.percentage', set => { + key_values => [ { name => 'average_1m' }, { name => 'display' } ], + output_template => '%.2f %% (1m)', perfdatas => [ - { value => 'average_1min_absolute', template => '%.2f', + { value => 'average_1m_absolute', template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 } ] } }, - { label => 'average-5min', nlabel => 'switch.cpu.utilization.5min.percentage', set => { - key_values => [ { name => 'average_5min' }, { name => 'display' } ], - output_template => '%.2f %% (5min)', + { label => 'average-5m', nlabel => 'switch.cpu.utilization.5m.percentage', set => { + key_values => [ { name => 'average_5m' }, { name => 'display' } ], + output_template => '%.2f %% (5m)', perfdatas => [ - { value => 'average_5min_absolute', template => '%.2f', + { value => 'average_5m_absolute', template => '%.2f', min => 0, max => 100, unit => '%', label_extra_instance => 1 } ] } @@ -73,8 +73,8 @@ sub new { } my $mapping = { - average_1min => { oid => '.1.3.6.1.4.1.20301.2.5.1.2.2.12.1.1.5' }, # mpCpuStatsUtil1MinuteSwRev - average_5min => { oid => '.1.3.6.1.4.1.20301.2.5.1.2.2.12.1.1.6' } # mpCpuStatsUtil5MinutesSwRev + average_1m => { oid => '.1.3.6.1.4.1.20301.2.5.1.2.2.12.1.1.5' }, # mpCpuStatsUtil1MinuteSwRev + average_5m => { oid => '.1.3.6.1.4.1.20301.2.5.1.2.2.12.1.1.6' } # mpCpuStatsUtil5MinutesSwRev }; my $oid_mpCpuStatsRevTableEntry = '.1.3.6.1.4.1.20301.2.5.1.2.2.12.1.1'; @@ -84,13 +84,13 @@ sub manage_selection { my $snmp_result = $options{snmp}->get_table( oid => $oid_mpCpuStatsRevTableEntry, - start => $mapping->{average_1min}->{oid}, + start => $mapping->{average_1m}->{oid}, nothing_quit => 1 ); $self->{cpu} = {}; foreach my $oid (keys %$snmp_result) { - next if ($oid !~ /^$mapping->{average_1min}->{oid}\.(.*)$/); + next if ($oid !~ /^$mapping->{average_1m}->{oid}\.(.*)$/); my $instance = $1; my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $instance); @@ -124,7 +124,7 @@ Filter switch number. =item B<--warning-*> B<--critical-*> Thresholds. -Can be: 'average-1min' (%), 'average-5min' (%). +Can be: 'average-1m' (%), 'average-5m' (%). =back From b2bdc1057899f7c435f2d64c80502e982f44606d Mon Sep 17 00:00:00 2001 From: UrBnW <40244829+UrBnW@users.noreply.github.com> Date: Fri, 17 Apr 2020 10:56:30 +0200 Subject: [PATCH 2/3] Blade/Flex fix labels --- .../network/lenovo/flexsystem/snmp/mode/cpu.pm | 6 +++--- .../network/lenovo/flexsystem/snmp/mode/memory.pm | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/centreon-plugins/network/lenovo/flexsystem/snmp/mode/cpu.pm b/centreon-plugins/network/lenovo/flexsystem/snmp/mode/cpu.pm index 9f3e87c16..869d1bdb6 100644 --- a/centreon-plugins/network/lenovo/flexsystem/snmp/mode/cpu.pm +++ b/centreon-plugins/network/lenovo/flexsystem/snmp/mode/cpu.pm @@ -33,7 +33,7 @@ sub set_counters { ]; $self->{maps_counters}->{cpu} = [ - { label => 'average-1m', nlabel => 'switch.cpu.utilization.1m.percentage', set => { + { label => 'average-1m', nlabel => 'cpu.utilization.1m.percentage', set => { key_values => [ { name => 'average_1m' }, { name => 'display' } ], output_template => '%.2f %% (1m)', perfdatas => [ @@ -42,7 +42,7 @@ sub set_counters { ] } }, - { label => 'average-5m', nlabel => 'switch.cpu.utilization.5m.percentage', set => { + { label => 'average-5m', nlabel => 'cpu.utilization.5m.percentage', set => { key_values => [ { name => 'average_5m' }, { name => 'display' } ], output_template => '%.2f %% (5m)', perfdatas => [ @@ -100,7 +100,7 @@ sub manage_selection { next; } - $self->{cpu}->{$instance} = { + $self->{cpu}->{'switch' . $instance} = { display => $instance, %$result }; diff --git a/centreon-plugins/network/lenovo/flexsystem/snmp/mode/memory.pm b/centreon-plugins/network/lenovo/flexsystem/snmp/mode/memory.pm index c3eae2c60..aeddb4205 100644 --- a/centreon-plugins/network/lenovo/flexsystem/snmp/mode/memory.pm +++ b/centreon-plugins/network/lenovo/flexsystem/snmp/mode/memory.pm @@ -46,7 +46,7 @@ sub set_counters { ]; $self->{maps_counters}->{memory} = [ - { label => 'usage', nlabel => 'switch.memory.usage.bytes', set => { + { label => 'usage', nlabel => 'memory.usage.bytes', set => { key_values => [ { name => 'used' }, { name => 'free' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, { name => 'display' } ], closure_custom_output => $self->can('custom_usage_output'), perfdatas => [ @@ -55,7 +55,7 @@ sub set_counters { ] } }, - { label => 'usage-free', display_ok => 0, nlabel => 'switch.memory.free.bytes', set => { + { label => 'usage-free', display_ok => 0, nlabel => 'memory.free.bytes', set => { key_values => [ { name => 'free' }, { name => 'used' }, { name => 'prct_used' }, { name => 'prct_free' }, { name => 'total' }, { name => 'display' } ], closure_custom_output => $self->can('custom_usage_output'), perfdatas => [ @@ -64,7 +64,7 @@ sub set_counters { ] } }, - { label => 'usage-prct', display_ok => 0, nlabel => 'switch.memory.usage.percentage', set => { + { label => 'usage-prct', display_ok => 0, nlabel => 'memory.usage.percentage', set => { key_values => [ { name => 'prct_used' }, { name => 'display' } ], output_template => 'Ram Used : %.2f %%', perfdatas => [ @@ -124,7 +124,7 @@ sub manage_selection { } my $prct_used = ($result->{total} - $result->{free}) * 100 / $result->{total}; - $self->{memory}->{$instance} = { + $self->{memory}->{'switch' . $instance} = { display => $instance, prct_used => $prct_used, prct_free => 100 - $prct_used, From fbf1ba837fea1c7af6068d92e3a6cc759c5922b4 Mon Sep 17 00:00:00 2001 From: UrBnW <40244829+UrBnW@users.noreply.github.com> Date: Fri, 17 Apr 2020 10:59:37 +0200 Subject: [PATCH 3/3] Typo --- .../lenovo/flexsystem/snmp/mode/components/temperature.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/centreon-plugins/network/lenovo/flexsystem/snmp/mode/components/temperature.pm b/centreon-plugins/network/lenovo/flexsystem/snmp/mode/components/temperature.pm index 76bc6ca46..b590cc986 100644 --- a/centreon-plugins/network/lenovo/flexsystem/snmp/mode/components/temperature.pm +++ b/centreon-plugins/network/lenovo/flexsystem/snmp/mode/components/temperature.pm @@ -96,7 +96,7 @@ sub check { } $self->{output}->perfdata_add( nlabel => 'hardware.temperature.celsius', unit => 'C', - instances => 'switch=' . $instance, + instances => 'switch' . $instance, value => $temperature, warning => $warn, critical => $crit