Fix #5698
This commit is contained in:
parent
a74fcae555
commit
b6ce5716e3
|
@ -178,19 +178,28 @@ sub perfdata {
|
|||
my $crit = defined($self->{threshold_crit}) ? $self->{threshold_crit} : 'critical-' . $self->{label};
|
||||
|
||||
foreach my $perf (@{$self->{perfdatas}}) {
|
||||
my ($label, $extra_label) = ($self->{label}, '');
|
||||
my ($label, $extra_label, $min, $max, $th_total) = ($self->{label}, '');
|
||||
my $template = '%s';
|
||||
|
||||
$template = $perf->{template} if (defined($perf->{template}));
|
||||
$label = $perf->{label} if (defined($perf->{label}));
|
||||
if (defined($perf->{min})) {
|
||||
$min = ($perf->{min} =~ /[^0-9]/) ? $self->{result_values}->{$perf->{min}} : $perf->{min};
|
||||
}
|
||||
if (defined($perf->{max})) {
|
||||
$max = ($perf->{max} =~ /[^0-9]/) ? $self->{result_values}->{$perf->{max}} : $perf->{max};
|
||||
}
|
||||
if (defined($perf->{threshold_total})) {
|
||||
$th_total = ($perf->{threshold_total} =~ /[^0-9]/) ? $self->{result_values}->{$perf->{threshold_total}} : $perf->{threshold_total};
|
||||
}
|
||||
|
||||
$extra_label .= '_' . $self->{instance} if ($perf->{label_extra_instance} == 1 &&
|
||||
(!defined($options{extra_instance}) || $options{extra_instance} != 0));
|
||||
$self->{output}->perfdata_add(label => $label . $extra_label, unit => $perf->{unit},
|
||||
value => sprintf($template, $self->{result_values}->{$perf->{value}}),
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => $warn),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => $crit),
|
||||
min => $perf->{min}, max => $perf->{max});
|
||||
warning => $self->{perfdata}->get_perfdata_for_output(label => $warn, total => $th_total),
|
||||
critical => $self->{perfdata}->get_perfdata_for_output(label => $crit, total => $th_total),
|
||||
min => $min, max => $max);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ sub run {
|
|||
$self->{new_datas}->{last_timestamp} = time();
|
||||
|
||||
foreach my $name (sort @{$self->{volume_name_selected}}) {
|
||||
my ($short_msg, $long_msg) = ('', '');
|
||||
my ($short_msg, $short_msg_append, $long_msg, $long_msg_append) = ('', '', '', '');
|
||||
my @exits;
|
||||
foreach (sort keys %{$maps_counters}) {
|
||||
$maps_counters->{$_}->{obj}->set(instance => $name);
|
||||
|
@ -245,32 +245,35 @@ sub run {
|
|||
new_datas => $self->{new_datas});
|
||||
|
||||
if ($value_check != 0) {
|
||||
$long_msg .= ' ' . $maps_counters->{$_}->{obj}->output_error();
|
||||
$long_msg .= $long_msg_append . $maps_counters->{$_}->{obj}->output_error();
|
||||
$long_msg_append = ', ';
|
||||
next;
|
||||
}
|
||||
my $exit2 = $maps_counters->{$_}->{obj}->threshold_check();
|
||||
push @exits, $exit2;
|
||||
|
||||
my $output = $maps_counters->{$_}->{obj}->output();
|
||||
$long_msg .= ' ' . $output;
|
||||
$long_msg .= $long_msg_append . $output;
|
||||
$long_msg_append = ', ';
|
||||
|
||||
if (!$self->{output}->is_status(litteral => 1, value => $exit2, compare => 'ok')) {
|
||||
$short_msg .= ' ' . $output;
|
||||
$short_msg .= $short_msg_append . $output;
|
||||
$short_msg_append = ', ';
|
||||
}
|
||||
|
||||
$maps_counters->{$_}->{obj}->perfdata(extra_instance => $multiple);
|
||||
}
|
||||
|
||||
$self->{output}->output_add(long_msg => "Volume '$name':$long_msg");
|
||||
$self->{output}->output_add(long_msg => "Volume '$name' $long_msg");
|
||||
my $exit = $self->{output}->get_most_critical(status => [ @exits ]);
|
||||
if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => "Volume '$name':$short_msg"
|
||||
short_msg => "Volume '$name' $short_msg"
|
||||
);
|
||||
}
|
||||
|
||||
if ($multiple == 0) {
|
||||
$self->{output}->output_add(short_msg => "Volume '$name':$long_msg");
|
||||
$self->{output}->output_add(short_msg => "Volume '$name' $long_msg");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue