Skip to content

Commit 0347bb2

Browse files
authored
(plugin) snmp_standard::mode::uptime - Add 2 decimals to the perfdata (centreon#4731)
1 parent e847e29 commit 0347bb2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/snmp_standard/mode/uptime.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ sub custom_uptime_perfdata {
5252
$self->{output}->perfdata_add(
5353
label => 'uptime', unit => $self->{instance_mode}->{option_results}->{unit},
5454
nlabel => 'system.uptime.' . $unitdiv_long->{ $self->{instance_mode}->{option_results}->{unit} },
55-
value => floor($self->{result_values}->{uptime} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
55+
value => sprintf("%.2f", $self->{result_values}->{uptime} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
5656
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
5757
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}),
5858
min => 0
@@ -63,7 +63,7 @@ sub custom_uptime_threshold {
6363
my ($self, %options) = @_;
6464

6565
return $self->{perfdata}->threshold_check(
66-
value => floor($self->{result_values}->{uptime} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
66+
value => sprintf("%.2f", $self->{result_values}->{uptime} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
6767
threshold => [
6868
{ label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' },
6969
{ label => 'warning-'. $self->{thlabel}, exit_litteral => 'warning' },

0 commit comments

Comments
 (0)