fix(emc::datadomain) : mode cleaning - wrong output when cleaning is running CTOR-1241(#5346)

CTOR-1241
This commit is contained in:
Lucie Dubrunfaut 2024-12-23 11:36:06 +01:00 committed by GitHub
parent 884c6c22c1
commit f1ab4d9ab1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 12 deletions

View File

@ -116,10 +116,14 @@ sub manage_selection {
if ($self->{global}->{lastExecSeconds} == -1 || $self->{global}->{lastExecSeconds} > $lastExecSeconds) { if ($self->{global}->{lastExecSeconds} == -1 || $self->{global}->{lastExecSeconds} > $lastExecSeconds) {
$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( $self->{global}->{lastExecHuman} = centreon::plugins::misc::change_seconds(
value => $self->{global}->{lastExecSeconds} value => $self->{global}->{lastExecSeconds}
); );

View File

@ -20,15 +20,19 @@ cleaning ${tc}
... --hostname=${HOSTNAME} ... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION} ... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT} ... --snmp-port=${SNMPPORT}
... --snmp-community=storage/emc/datadomain/snmp/slim-datadomain ... --snmp-community=${snmp_community}
... --snmp-timeout=1 ... --snmp-timeout=5
... ${extra_options} ... ${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 -- Examples: tc extra_options snmp_community expected_result --
... 1 --verbose OK: cleaning last execution: never | 'filesystems.cleaning.execution.last.days'=-1d;;;0; ... 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='h' OK: cleaning last execution: never | 'filesystems.cleaning.execution.last.hours'=-1h;;;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 --unit='s' OK: cleaning last execution: never | 'filesystems.cleaning.execution.last.seconds'=-1s;;;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 --unit='w' OK: cleaning last execution: never | 'filesystems.cleaning.execution.last.weeks'=-1w;;;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 --warning-last-cleaning-execution='' --critical-last-cleaning-execution='' OK: cleaning last execution: never | 'filesystems.cleaning.execution.last.days'=-1d;;;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;

View File

@ -0,0 +1 @@
.1.3.6.1.4.1.19746.1.3.5.1.1.2.0 = STRING: Cleaning: phase 5 of 6 (copy)

View File

@ -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.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.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.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.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.2 = STRING: Anonymized 005
.1.3.6.1.4.1.19746.1.4.1.1.1.2.3 = STRING: Anonymized 122 .1.3.6.1.4.1.19746.1.4.1.1.1.2.3 = STRING: Anonymized 122