Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTOR-1241: Plugin(storage::emc::datadomain::snmp) - Mode(cleaning) : Wrong output when cleaning is running #5346

Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/storage/emc/datadomain/snmp/mode/cleaning.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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}
);
Expand Down
23 changes: 13 additions & 10 deletions tests/storage/emc/datadomain/snmp/cleaning.robot
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ 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+M \\\\d+w \\\\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: 3M 3w 17h 9m 7s | 'filesystems.cleaning.execution.last.weeks'=16w;;;0;
... 3 --warning-last-cleaning-execution='115' --critical-last-cleaning-execution='0' storage/emc/datadomain/snmp/slim-datadomain CRITICAL: cleaning last execution: 3M 3w 16h 52m 15s | 'filesystems.cleaning.execution.last.days'=113d;0:115;0:0;0;
... 4 ${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;
omercier marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.1.3.6.1.4.1.19746.1.3.5.1.1.2.0 = STRING: Cleaning: phase 5 of 6 (copy)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading