diff --git a/src/storage/emc/datadomain/snmp/mode/cleaning.pm b/src/storage/emc/datadomain/snmp/mode/cleaning.pm index 191f656826..762925ce47 100644 --- a/src/storage/emc/datadomain/snmp/mode/cleaning.pm +++ b/src/storage/emc/datadomain/snmp/mode/cleaning.pm @@ -116,10 +116,14 @@ sub manage_selection { if ($self->{global}->{lastExecSeconds} == -1 || $self->{global}->{lastExecSeconds} > $lastExecSeconds) { $self->{global}->{lastExecSeconds} = $lastExecSeconds; } + } elsif ($snmp_result->{$oid} =~ /Cleaning: phase (\d+) of (\d+) \(([^)]+)\)/) { + $self->{global}->{lastExecHuman} = "running (phase $1 of $2 : $3)"; + $self->{global}->{lastExecSeconds} = 0; } } - if ($self->{global}->{lastExecSeconds} != -1) { + # If there is a lastExecSeconds set (if above in the looop) and this is not a cleaning running (elsif above) + if ($self->{global}->{lastExecSeconds} > 0 || ($self->{global}->{lastExecSeconds} == 0 && $self->{global}->{lastExecHuman} eq "never")) { $self->{global}->{lastExecHuman} = centreon::plugins::misc::change_seconds( value => $self->{global}->{lastExecSeconds} ); diff --git a/tests/storage/emc/datadomain/snmp/cleaning.robot b/tests/storage/emc/datadomain/snmp/cleaning.robot index ed7b68d42d..161db0b71d 100644 --- a/tests/storage/emc/datadomain/snmp/cleaning.robot +++ b/tests/storage/emc/datadomain/snmp/cleaning.robot @@ -20,15 +20,19 @@ cleaning ${tc} ... --hostname=${HOSTNAME} ... --snmp-version=${SNMPVERSION} ... --snmp-port=${SNMPPORT} - ... --snmp-community=storage/emc/datadomain/snmp/slim-datadomain - ... --snmp-timeout=1 + ... --snmp-community=${snmp_community} + ... --snmp-timeout=5 ... ${extra_options} - - Ctn Run Command And Check Result As Strings ${command} ${expected_result} + + # first run to build cache + Run ${command} + # second run to control the output + Ctn Run Command And Check Result As Regexp ${command} ${expected_result} + - Examples: tc extra_options expected_result -- - ... 1 --verbose OK: cleaning last execution: never | 'filesystems.cleaning.execution.last.days'=-1d;;;0; - ... 2 --unit='h' OK: cleaning last execution: never | 'filesystems.cleaning.execution.last.hours'=-1h;;;0; - ... 3 --unit='s' OK: cleaning last execution: never | 'filesystems.cleaning.execution.last.seconds'=-1s;;;0; - ... 4 --unit='w' OK: cleaning last execution: never | 'filesystems.cleaning.execution.last.weeks'=-1w;;;0; - ... 5 --warning-last-cleaning-execution='' --critical-last-cleaning-execution='' OK: cleaning last execution: never | 'filesystems.cleaning.execution.last.days'=-1d;;;0; + Examples: tc extra_options snmp_community expected_result -- + ... 1 ${EMPTY} storage/emc/datadomain/snmp/slim-datadomain OK: cleaning last execution: (\\\\d+[yY]] )?(\\\\d+M )?(\\\\d+w )?(\\\\d+d )?(\\\\d+h )?(\\\\d+m )?(\\\\d+s )?\\\\| 'filesystems.cleaning.execution.last.days'=\\\\d+d;;;0;$ + ... 2 --unit='w' storage/emc/datadomain/snmp/slim-datadomain OK: cleaning last execution: (\\\\d+[yY]] )?(\\\\d+M )?(\\\\d+w )?(\\\\d+d )?(\\\\d+h )?(\\\\d+m )?(\\\\d+s )?\\\\| 'filesystems.cleaning.execution.last.weeks'=\\\\d+w;;;0;$ + ... 3 --warning-last-cleaning-execution='115' storage/emc/datadomain/snmp/slim-datadomain WARNING: cleaning last execution: (\\\\d+[yY]] )?(\\\\d+M )?(\\\\d+w )?(\\\\d+d )?(\\\\d+h )?(\\\\d+m )?(\\\\d+s )?\\\\| 'filesystems.cleaning.execution.last.days'=\\\\d+d;0:115;;0; + ... 4 --critical-last-cleaning-execution='0' storage/emc/datadomain/snmp/slim-datadomain CRITICAL: cleaning last execution: (\\\\d+[yY]] )?(\\\\d+M )?(\\\\d+w )?(\\\\d+d )?(\\\\d+h )?(\\\\d+m )?(\\\\d+s )?\\\\| 'filesystems.cleaning.execution.last.days'=\\\\d+d;;0:0;0; + ... 5 ${EMPTY} storage/emc/datadomain/snmp/slim-datadomain-cleaning-running OK: cleaning last execution: running \\\\(phase 5 of 6 : copy\\\\) \\\\| 'filesystems.cleaning.execution.last.days'=0d;;;0; diff --git a/tests/storage/emc/datadomain/snmp/slim-datadomain-cleaning-running.snmpwalk b/tests/storage/emc/datadomain/snmp/slim-datadomain-cleaning-running.snmpwalk new file mode 100644 index 0000000000..3f0e126c9f --- /dev/null +++ b/tests/storage/emc/datadomain/snmp/slim-datadomain-cleaning-running.snmpwalk @@ -0,0 +1 @@ +.1.3.6.1.4.1.19746.1.3.5.1.1.2.0 = STRING: Cleaning: phase 5 of 6 (copy) \ No newline at end of file diff --git a/tests/storage/emc/datadomain/snmp/slim-datadomain.snmpwalk b/tests/storage/emc/datadomain/snmp/slim-datadomain.snmpwalk index 2f5417c84e..43df86852f 100644 --- a/tests/storage/emc/datadomain/snmp/slim-datadomain.snmpwalk +++ b/tests/storage/emc/datadomain/snmp/slim-datadomain.snmpwalk @@ -14972,7 +14972,7 @@ .1.3.6.1.4.1.19746.1.3.2.1.1.9.3 = STRING: Anonymized 098 .1.3.6.1.4.1.19746.1.3.2.1.1.9.4 = STRING: Anonymized 136 .1.3.6.1.4.1.19746.1.3.2.1.1.9.5 = STRING: Anonymized 207 -.1.3.6.1.4.1.19746.1.3.5.1.1.2.0 = STRING: Anonymized 176 +.1.3.6.1.4.1.19746.1.3.5.1.1.2.0 = STRING: "Cleaning finished at 2024/08/27 13:58:59." .1.3.6.1.4.1.19746.1.4.1.1.1.2.1 = STRING: Anonymized 018 .1.3.6.1.4.1.19746.1.4.1.1.1.2.2 = STRING: Anonymized 005 .1.3.6.1.4.1.19746.1.4.1.1.1.2.3 = STRING: Anonymized 122