fix(plugin): fixed an error in the recognition of the product version (#4919)
This commit is contained in:
parent
5677f1a502
commit
a71e4e5c63
|
@ -153,7 +153,7 @@ sub manage_selection {
|
|||
my $snmp_result = $options{snmp}->get_leef(
|
||||
oids => [ map($_->{oid} . '.0', values(%{$mapping->{$label}})) ]
|
||||
);
|
||||
if (!defined($snmp_result->{ $mapping->{netvision6}->{status} . '.0' })) {
|
||||
if (!defined($snmp_result->{ $mapping->{netvision6}->{status}->{oid} . '.0' })) {
|
||||
$label = 'netvision5';
|
||||
$snmp_result = $options{snmp}->get_leef(
|
||||
oids => [ map($_->{oid} . '.0', values(%{$mapping->{$label}})) ],
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
*** Settings ***
|
||||
Documentation Hardware UPS Socomec Netvision SNMP plugin
|
||||
|
||||
Library OperatingSystem
|
||||
Library String
|
||||
Library Examples
|
||||
|
||||
Test Timeout 120s
|
||||
|
||||
|
||||
*** Variables ***
|
||||
${CENTREON_PLUGINS} ${CURDIR}${/}..${/}..${/}..${/}src${/}centreon_plugins.pl
|
||||
|
||||
${CMD} perl ${CENTREON_PLUGINS} --plugin=hardware::ups::socomec::netvision::snmp::plugin
|
||||
|
||||
*** Test Cases ***
|
||||
Battery ${tc}/4
|
||||
[Tags] hardware UPS snmp
|
||||
${command} Catenate
|
||||
... ${CMD}
|
||||
... --mode=battery
|
||||
... --hostname=127.0.0.1
|
||||
... --snmp-version=2c
|
||||
... --snmp-port=2024
|
||||
... --snmp-community=hardware/ups/socomec/netvision/snmp/mode/battery
|
||||
|
||||
# Append options to command
|
||||
${opt} Append Option --warning-temperature ${w_temperature}
|
||||
${command} Catenate ${command} ${opt}
|
||||
${opt} Append Option --critical-temperature ${c_temperature}
|
||||
${command} Catenate ${command} ${opt}
|
||||
|
||||
${output} Run ${command}
|
||||
${output} Strip String ${output}
|
||||
Should Be Equal As Strings
|
||||
... ${output}
|
||||
... ${expected_result}
|
||||
... Wrong output result for compliance of ${expected_result}{\n}Command output:{\n}${output}{\n}{\n}{\n}
|
||||
|
||||
Examples: tc w_temperature c_temperature expected_result --
|
||||
... 1 30 50 OK: battery status is normal - charge remaining: 100% (0 minutes remaining) | 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=0;;;0; 'battery.voltage.volt'=339.1V;;;; 'battery.temperature.celsius'=22C;0:30;0:50;;
|
||||
... 2 20 50 WARNING: temperature: 22 C | 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=0;;;0; 'battery.voltage.volt'=339.1V;;;; 'battery.temperature.celsius'=22C;0:20;0:50;;
|
||||
... 3 10 20 CRITICAL: temperature: 22 C | 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=0;;;0; 'battery.voltage.volt'=339.1V;;;; 'battery.temperature.celsius'=22C;0:10;0:20;;
|
||||
... 4 _empty_ _empty_ OK: battery status is normal - charge remaining: 100% (0 minutes remaining) | 'battery.charge.remaining.percent'=100%;;;0;100 'battery.charge.remaining.minutes'=0;;;0; 'battery.voltage.volt'=339.1V;;;; 'battery.temperature.celsius'=22C;;;;
|
||||
|
||||
*** Keywords ***
|
||||
Append Option
|
||||
[Documentation] Concatenates the first argument (option) with the second (value) after having replaced the value with "" if its content is '_empty_'
|
||||
[Arguments] ${option} ${value}
|
||||
${value} Set Variable If '${value}' == '_empty_' '' ${value}
|
||||
[return] ${option}=${value}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
.1.3.6.1.4.1.4555.1.1.7.1.2.1.0 = INTEGER: 2
|
||||
.1.3.6.1.4.1.4555.1.1.7.1.2.3.0 = INTEGER: 0
|
||||
.1.3.6.1.4.1.4555.1.1.7.1.2.4.0 = INTEGER: 100
|
||||
.1.3.6.1.4.1.4555.1.1.7.1.2.5.0 = INTEGER: 3391
|
||||
.1.3.6.1.4.1.4555.1.1.7.1.2.6.0 = INTEGER: 220
|
||||
.1.3.6.1.4.1.4555.1.1.7.1.2.8.0 = INTEGER: 0
|
||||
.1.3.6.1.4.1.4555.1.1.1.1.2.1.0 = INTEGER: 2
|
||||
.1.3.6.1.4.1.4555.1.1.1.1.2.3.0 = INTEGER: 0
|
||||
.1.3.6.1.4.1.4555.1.1.1.1.2.4.0 = INTEGER: 100
|
||||
.1.3.6.1.4.1.4555.1.1.1.1.2.5.0 = INTEGER: 3391
|
||||
.1.3.6.1.4.1.4555.1.1.1.1.2.6.0 = INTEGER: 22
|
Loading…
Reference in New Issue