(plugin) snmp_standard::mode::uptime - Add 2 decimals to the perfdata (#4731)
This commit is contained in:
parent
e847e29b41
commit
0347bb2cf4
|
@ -52,7 +52,7 @@ sub custom_uptime_perfdata {
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'uptime', unit => $self->{instance_mode}->{option_results}->{unit},
|
label => 'uptime', unit => $self->{instance_mode}->{option_results}->{unit},
|
||||||
nlabel => 'system.uptime.' . $unitdiv_long->{ $self->{instance_mode}->{option_results}->{unit} },
|
nlabel => 'system.uptime.' . $unitdiv_long->{ $self->{instance_mode}->{option_results}->{unit} },
|
||||||
value => floor($self->{result_values}->{uptime} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
|
value => sprintf("%.2f", $self->{result_values}->{uptime} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}),
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}),
|
||||||
min => 0
|
min => 0
|
||||||
|
@ -63,7 +63,7 @@ sub custom_uptime_threshold {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
return $self->{perfdata}->threshold_check(
|
return $self->{perfdata}->threshold_check(
|
||||||
value => floor($self->{result_values}->{uptime} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
|
value => sprintf("%.2f", $self->{result_values}->{uptime} / $unitdiv->{ $self->{instance_mode}->{option_results}->{unit} }),
|
||||||
threshold => [
|
threshold => [
|
||||||
{ label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' },
|
{ label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' },
|
||||||
{ label => 'warning-'. $self->{thlabel}, exit_litteral => 'warning' },
|
{ label => 'warning-'. $self->{thlabel}, exit_litteral => 'warning' },
|
||||||
|
|
Loading…
Reference in New Issue