diff --git a/centreon/plugins/misc.pm b/centreon/plugins/misc.pm index d76f347c2..ecde05994 100644 --- a/centreon/plugins/misc.pm +++ b/centreon/plugins/misc.pm @@ -372,7 +372,12 @@ sub change_seconds { { unit => 's', value => 1 }, ]; my %values = ('y' => 1, 'M' => 2, 'w' => 3, 'd' => 4, 'h' => 5, 'm' => 6, 's' => 7); - + my $sign = ''; + if ($options{value} <= 0) { + $sign = '-'; + $options{value} = abs($options{value}); + } + foreach (@$periods) { next if (defined($options{start}) && $values{$_->{unit}} < $values{$options{start}}); my $count = int($options{value} / $_->{value}); @@ -387,7 +392,7 @@ sub change_seconds { $str = $options{value}; $str .= $options{start} if (defined($options{start})); } - return $str; + return $sign . $str; } sub scale_bytesbit { diff --git a/storage/hp/p2000/xmlapi/mode/ntp.pm b/storage/hp/p2000/xmlapi/mode/ntp.pm index 8e3cf8924..8bdc789cb 100644 --- a/storage/hp/p2000/xmlapi/mode/ntp.pm +++ b/storage/hp/p2000/xmlapi/mode/ntp.pm @@ -97,7 +97,7 @@ sub set_counters { ]; $self->{maps_counters}->{contact} = [ - { label => 'contact-last-time', nlabel => 'ntp.contact.last.time.', set => { + { label => 'contact-last-time', nlabel => 'ntp.contact.last.time', set => { key_values => [ { name => 'contact_seconds' }, { name => 'contact_human' } ], output_template => 'last server contact: %s', output_use => 'contact_human',