fix 0 uptime value

This commit is contained in:
garnier-quentin 2020-02-13 14:28:41 +01:00
parent 13a4f415b0
commit 14c194723f
2 changed files with 19 additions and 13 deletions

View File

@ -392,6 +392,10 @@ sub change_seconds {
$str_append = ' ';
}
if ($str eq '') {
$str = $options{value};
$str .= $options{start} if (defined($options{start}));
}
return $str;
}

View File

@ -35,12 +35,12 @@ sub new {
bless $self, $class;
$options{options}->add_options(arguments => {
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"force-oid:s" => { name => 'force_oid' },
"check-overload" => { name => 'check_overload' },
"reboot-window:s" => { name => 'reboot_window', default => 5000 },
"unit:s" => { name => 'unit', default => 's' },
'warning:s' => { name => 'warning' },
'critical:s' => { name => 'critical' },
'force-oid:s' => { name => 'force_oid' },
'check-overload' => { name => 'check_overload' },
'reboot-window:s' => { name => 'reboot_window', default => 5000 },
'unit:s' => { name => 'unit', default => 's' },
});
$self->{statefile_cache} = centreon::plugins::statefile->new(%options);
@ -123,8 +123,10 @@ sub run {
$value = $self->check_overload(timeticks => $value);
$value = floor($value / 100);
my $exit_code = $self->{perfdata}->threshold_check(value => floor($value / $unitdiv->{$self->{option_results}->{unit}}),
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
my $exit_code = $self->{perfdata}->threshold_check(
value => floor($value / $unitdiv->{$self->{option_results}->{unit}}),
threshold => [ { label => 'critical', exit_litteral => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]
);
$self->{output}->perfdata_add(
label => 'uptime', unit => $self->{option_results}->{unit},
value => floor($value / $unitdiv->{$self->{option_results}->{unit}}),