mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-28 16:14:21 +02:00
Fix #5698
This commit is contained in:
parent
3c4d55cf7c
commit
2df04beafe
@ -178,19 +178,28 @@ sub perfdata {
|
|||||||
my $crit = defined($self->{threshold_crit}) ? $self->{threshold_crit} : 'critical-' . $self->{label};
|
my $crit = defined($self->{threshold_crit}) ? $self->{threshold_crit} : 'critical-' . $self->{label};
|
||||||
|
|
||||||
foreach my $perf (@{$self->{perfdatas}}) {
|
foreach my $perf (@{$self->{perfdatas}}) {
|
||||||
my ($label, $extra_label) = ($self->{label}, '');
|
my ($label, $extra_label, $min, $max, $th_total) = ($self->{label}, '');
|
||||||
my $template = '%s';
|
my $template = '%s';
|
||||||
|
|
||||||
$template = $perf->{template} if (defined($perf->{template}));
|
$template = $perf->{template} if (defined($perf->{template}));
|
||||||
$label = $perf->{label} if (defined($perf->{label}));
|
$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 &&
|
$extra_label .= '_' . $self->{instance} if ($perf->{label_extra_instance} == 1 &&
|
||||||
(!defined($options{extra_instance}) || $options{extra_instance} != 0));
|
(!defined($options{extra_instance}) || $options{extra_instance} != 0));
|
||||||
$self->{output}->perfdata_add(label => $label . $extra_label, unit => $perf->{unit},
|
$self->{output}->perfdata_add(label => $label . $extra_label, unit => $perf->{unit},
|
||||||
value => sprintf($template, $self->{result_values}->{$perf->{value}}),
|
value => sprintf($template, $self->{result_values}->{$perf->{value}}),
|
||||||
warning => $self->{perfdata}->get_perfdata_for_output(label => $warn),
|
warning => $self->{perfdata}->get_perfdata_for_output(label => $warn, total => $th_total),
|
||||||
critical => $self->{perfdata}->get_perfdata_for_output(label => $crit),
|
critical => $self->{perfdata}->get_perfdata_for_output(label => $crit, total => $th_total),
|
||||||
min => $perf->{min}, max => $perf->{max});
|
min => $min, max => $max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ sub run {
|
|||||||
$self->{new_datas}->{last_timestamp} = time();
|
$self->{new_datas}->{last_timestamp} = time();
|
||||||
|
|
||||||
foreach my $name (sort @{$self->{volume_name_selected}}) {
|
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;
|
my @exits;
|
||||||
foreach (sort keys %{$maps_counters}) {
|
foreach (sort keys %{$maps_counters}) {
|
||||||
$maps_counters->{$_}->{obj}->set(instance => $name);
|
$maps_counters->{$_}->{obj}->set(instance => $name);
|
||||||
@ -245,32 +245,35 @@ sub run {
|
|||||||
new_datas => $self->{new_datas});
|
new_datas => $self->{new_datas});
|
||||||
|
|
||||||
if ($value_check != 0) {
|
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;
|
next;
|
||||||
}
|
}
|
||||||
my $exit2 = $maps_counters->{$_}->{obj}->threshold_check();
|
my $exit2 = $maps_counters->{$_}->{obj}->threshold_check();
|
||||||
push @exits, $exit2;
|
push @exits, $exit2;
|
||||||
|
|
||||||
my $output = $maps_counters->{$_}->{obj}->output();
|
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')) {
|
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);
|
$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 ]);
|
my $exit = $self->{output}->get_most_critical(status => [ @exits ]);
|
||||||
if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) {
|
if (!$self->{output}->is_status(litteral => 1, value => $exit, compare => 'ok')) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => "Volume '$name':$short_msg"
|
short_msg => "Volume '$name' $short_msg"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($multiple == 0) {
|
if ($multiple == 0) {
|
||||||
$self->{output}->output_add(short_msg => "Volume '$name':$long_msg");
|
$self->{output}->output_add(short_msg => "Volume '$name' $long_msg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user