+ mode radlan 'cpu': add unit '%'

This commit is contained in:
garnier-quentin 2015-05-26 17:21:20 +02:00
parent c0b3ec4d49
commit c4863abca5
1 changed files with 6 additions and 6 deletions

View File

@ -107,28 +107,28 @@ sub run {
my $cpu5min = $self->{result}->{$oid_rlCpuUtilDuringLast5Minutes};
my $exit1 = $self->{perfdata}->threshold_check(value => $cpu1sec,
threshold => [ { label => 'crit1s', 'exit_litteral' => 'critical' }, { label => 'warn1s', exit_litteral => 'warning' } ]);
threshold => [ { label => 'crit1s', exit_litteral => 'critical' }, { label => 'warn1s', exit_litteral => 'warning' } ]);
my $exit2 = $self->{perfdata}->threshold_check(value => $cpu1min,
threshold => [ { label => 'crit1m', 'exit_litteral' => 'critical' }, { label => 'warn1m', exit_litteral => 'warning' } ]);
threshold => [ { label => 'crit1m', exit_litteral => 'critical' }, { label => 'warn1m', exit_litteral => 'warning' } ]);
my $exit3 = $self->{perfdata}->threshold_check(value => $cpu5min,
threshold => [ { label => 'crit5m', 'exit_litteral' => 'critical' }, { label => 'warn5m', exit_litteral => 'warning' } ]);
threshold => [ { label => 'crit5m', exit_litteral => 'critical' }, { label => 'warn5m', exit_litteral => 'warning' } ]);
my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2, $exit3 ]);
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("CPU Usage: %.2f%% (1sec), %.2f%% (1min), %.2f%% (5min)",
$cpu1sec, $cpu1min, $cpu5min));
$self->{output}->perfdata_add(label => "cpu_1s",
$self->{output}->perfdata_add(label => "cpu_1s", unit => '%',
value => $cpu1sec,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1s'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1s'),
min => 0, max => 100);
$self->{output}->perfdata_add(label => "cpu_1m",
$self->{output}->perfdata_add(label => "cpu_1m", unit => '%',
value => $cpu1min,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'),
min => 0, max => 100);
$self->{output}->perfdata_add(label => "cpu_5m",
$self->{output}->perfdata_add(label => "cpu_5m", unit => '%',
value => $cpu5min,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5m'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5m'),