From 243ad5cc2fee953c7a0c2b69565bfe240ecbbe9c Mon Sep 17 00:00:00 2001 From: Kevin Duret Date: Fri, 29 Aug 2014 15:39:54 +0200 Subject: [PATCH] Fix for CIMC --- .../hardware/server/cisco/ucs/mode/faults.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/centreon-plugins/hardware/server/cisco/ucs/mode/faults.pm b/centreon-plugins/hardware/server/cisco/ucs/mode/faults.pm index 55a3eda99..44e6b606f 100644 --- a/centreon-plugins/hardware/server/cisco/ucs/mode/faults.pm +++ b/centreon-plugins/hardware/server/cisco/ucs/mode/faults.pm @@ -105,10 +105,16 @@ sub check_options { sub get_timestamp { my ($self, %options) = @_; - my $value = unpack('H*', $options{value}); - $value =~ /^([0-9a-z]{4})([0-9a-z]{2})([0-9a-z]{2})([0-9a-z]{2})([0-9a-z]{2})([0-9a-z]{2})/; + my $currentTmsp = 0; + my $value = $options{value}; + if ($value =~ /^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/) { + $currentTmsp = mktime($6, $5, $4, $3, $2 - 1, $1 - 1900); + } else { + $value = unpack('H*', $value); + $value =~ /^([0-9a-z]{4})([0-9a-z]{2})([0-9a-z]{2})([0-9a-z]{2})([0-9a-z]{2})([0-9a-z]{2})/; + $currentTmsp = mktime(hex($6), hex($5), hex($4), hex($3), hex($2) - 1, hex($1) - 1900); + } - my $currentTmsp = mktime(hex($6), hex($5), hex($4), hex($3), hex($2) - 1, hex($1) - 1900); return $currentTmsp; } @@ -230,4 +236,4 @@ Event older (current time - retention time) is not checked (in seconds). =back =cut - \ No newline at end of file +