fix(storage::emc::datadomain::snmp): fixed issue in cleaning mode when default value for timezone is empty leading to unknown (#5631)

Refs: CTOR-1700

Co-authored-by: Lucie Dubrunfaut <ldubrunfaut@CNTR-PORT-A198.localdomain>
This commit is contained in:
Lucie Tirand 2025-07-01 14:45:57 +02:00 committed by GitHub
parent 860959c392
commit e18c959fc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -118,7 +118,7 @@ sub manage_selection {
if ($snmp_result->{$oid} =~ /\s+(\d+)\/(\d+)\/(\d+)\s+(\d+):(\d+):(\d+)/) {
my $dt = DateTime->new(year => $1, month => $2, day => $3, hour => $4, minute => $5, second => $6);
# if the equipment check is on another timezone than the system where the plugin is executed.
if (defined($self->{option_results}->{timezone})){
if (!centreon::plugins::misc::is_empty($self->{option_results}->{timezone})) {
eval {
$dt = $dt->set_time_zone($self->{option_results}->{timezone});
};
@ -161,7 +161,7 @@ Select the time unit for thresholds. May be 's' for seconds, 'm' for minutes, 'h
=item B<--timezone>
Set equipment timezone if different from Europe/London. Valid time zones can be found in C</usr/share/zoneinfo>.
Set equipment timezone if different from UTC. Valid time zones can be found in C</usr/share/zoneinfo>.
Format example : Europe/Paris and America/Los_Angeles
=item B<--warning-*> B<--critical-*>