From 10740a77a75436cfe5c86b4e2487343f4c431a13 Mon Sep 17 00:00:00 2001 From: omercier <32134301+omercier@users.noreply.github.com> Date: Fri, 26 Jan 2024 11:50:04 +0100 Subject: [PATCH] fix(fatpack): adding the uptime module to the fatpack (#4849) --- .../pkg.json | 3 +- .../snmp/storage-synology-snmp.robot | 51 +++++++++++++++++-- .../synology_component_disk_critical.snmpwalk | 1 + .../synology_component_disk_failing.snmpwalk | 1 + .../snmp/synology_component_disk_ok.snmpwalk | 1 + .../synology_component_disk_warning.snmpwalk | 1 + 6 files changed, 52 insertions(+), 6 deletions(-) diff --git a/packaging/centreon-plugin-Hardware-Storage-Synology-Snmp/pkg.json b/packaging/centreon-plugin-Hardware-Storage-Synology-Snmp/pkg.json index aad8cdc6a..aa44258ec 100644 --- a/packaging/centreon-plugin-Hardware-Storage-Synology-Snmp/pkg.json +++ b/packaging/centreon-plugin-Hardware-Storage-Synology-Snmp/pkg.json @@ -10,6 +10,7 @@ "snmp_standard/mode/memory.pm", "snmp_standard/mode/loadaverage.pm", "snmp_standard/mode/storage.pm", + "snmp_standard/mode/uptime.pm", "storage/synology/snmp/" ] -} \ No newline at end of file +} diff --git a/tests/functional/snmp/storage-synology-snmp.robot b/tests/functional/snmp/storage-synology-snmp.robot index 6e5ac80b7..c1faa5f06 100644 --- a/tests/functional/snmp/storage-synology-snmp.robot +++ b/tests/functional/snmp/storage-synology-snmp.robot @@ -34,12 +34,33 @@ ${CMD} perl ${CENTREON_PLUGINS} --plugin=storage::synology: ... &{check_components_test3} ... &{check_components_test4} +&{uptime_t1} +... description=Uptime check expected to be OK +... snmpcommunity=synology_component_disk_ok +... warning= +... critical= +... expected_output=OK: System uptime is: 46m 5s | 'uptime'=2765.00s;;;0; +&{uptime_t2} +... description=Uptime check expected to be warning +... snmpcommunity=synology_component_disk_ok +... warning=10 +... critical= +... expected_output=WARNING: System uptime is: 46m 5s | 'uptime'=2765.00s;0:10;;0; +&{uptime_t3} +... description=Uptime check expected to be critical +... snmpcommunity=synology_component_disk_ok +... warning= +... critical=10 +... expected_output=CRITICAL: System uptime is: 46m 5s | 'uptime'=2765.00s;;0:10;0; + +@{uptime_tests} +... &{uptime_t1} +... &{uptime_t2} +... &{uptime_t3} *** Test Cases *** -Synology SNMP: Checking disk components - [Documentation] Monitor the different states of disk health +Components [Tags] storage synology snmp - Log To Console Synology SNMP: Checking disk components FOR ${check_components_test} IN @{check_components_tests} ${command} Catenate ... ${CMD} @@ -48,10 +69,30 @@ Synology SNMP: Checking disk components ... --snmp-version=2 ... --snmp-port=2024 ... --snmp-community=${check_components_test.snmpcommunity} + ${output} Run ${command} - Log To Console ${check_components_test.description} Should Be Equal As Strings ... ${check_components_test.expected_output} ... ${output} - ... Wrong output for components mode: ${check_components_test}.{\n}Command output:{\n}${output} + ... ${check_components_test.description} failed. Wrong output for components mode: ${check_components_test}.{\n}Command output:{\n}${output} + END + +Uptime + [Tags] storage synology snmp + FOR ${test_item} IN @{uptime_tests} + ${command} Catenate + ... ${CMD} + ... --mode=uptime + ... --hostname=127.0.0.1 + ... --snmp-version=2 + ... --snmp-port=2024 + ... --snmp-community=${test_item.snmpcommunity} + ... --warning-uptime=${test_item.warning} + ... --critical-uptime=${test_item.critical} + + ${output} Run ${command} + Should Be Equal As Strings + ... ${test_item.expected_output} + ... ${output} + ... ${test_item.description} failed. Wrong output for components mode: ${test_item}.{\n}Command output:{\n}${output} END diff --git a/tests/resources/snmp/synology_component_disk_critical.snmpwalk b/tests/resources/snmp/synology_component_disk_critical.snmpwalk index cc7e081a5..b57c024df 100644 --- a/tests/resources/snmp/synology_component_disk_critical.snmpwalk +++ b/tests/resources/snmp/synology_component_disk_critical.snmpwalk @@ -1,3 +1,4 @@ +.1.3.6.1.2.1.25.1.1.0 = 276532 .1.3.6.1.4.1.6574.1.1.0 = INTEGER: 1 .1.3.6.1.4.1.6574.1.3.0 = INTEGER: 1 .1.3.6.1.4.1.6574.1.4.1.0 = INTEGER: 1 diff --git a/tests/resources/snmp/synology_component_disk_failing.snmpwalk b/tests/resources/snmp/synology_component_disk_failing.snmpwalk index 54df78857..7efd3f94a 100644 --- a/tests/resources/snmp/synology_component_disk_failing.snmpwalk +++ b/tests/resources/snmp/synology_component_disk_failing.snmpwalk @@ -1,3 +1,4 @@ +.1.3.6.1.2.1.25.1.1.0 = 276532 .1.3.6.1.4.1.6574.1.1.0 = INTEGER: 1 .1.3.6.1.4.1.6574.1.3.0 = INTEGER: 1 .1.3.6.1.4.1.6574.1.4.1.0 = INTEGER: 1 diff --git a/tests/resources/snmp/synology_component_disk_ok.snmpwalk b/tests/resources/snmp/synology_component_disk_ok.snmpwalk index 92a3c9ebb..f8bfcabe6 100644 --- a/tests/resources/snmp/synology_component_disk_ok.snmpwalk +++ b/tests/resources/snmp/synology_component_disk_ok.snmpwalk @@ -1,3 +1,4 @@ +.1.3.6.1.2.1.25.1.1.0 = 276532 .1.3.6.1.4.1.6574.1.1.0 = INTEGER: 1 .1.3.6.1.4.1.6574.1.3.0 = INTEGER: 1 .1.3.6.1.4.1.6574.1.4.1.0 = INTEGER: 1 diff --git a/tests/resources/snmp/synology_component_disk_warning.snmpwalk b/tests/resources/snmp/synology_component_disk_warning.snmpwalk index 4a1ccdbdf..b925f9b92 100644 --- a/tests/resources/snmp/synology_component_disk_warning.snmpwalk +++ b/tests/resources/snmp/synology_component_disk_warning.snmpwalk @@ -1,3 +1,4 @@ +.1.3.6.1.2.1.25.1.1.0 = 276532 .1.3.6.1.4.1.6574.1.1.0 = INTEGER: 1 .1.3.6.1.4.1.6574.1.3.0 = INTEGER: 1 .1.3.6.1.4.1.6574.1.4.1.0 = INTEGER: 1