Fix #6008
This commit is contained in:
parent
b7f04e1341
commit
0d1e0af937
|
@ -62,6 +62,7 @@ sub new {
|
||||||
{
|
{
|
||||||
"warning:s" => { name => 'warning' },
|
"warning:s" => { name => 'warning' },
|
||||||
"critical:s" => { name => 'critical' },
|
"critical:s" => { name => 'critical' },
|
||||||
|
"filter:s" => { name => 'filter' },
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
|
@ -132,6 +133,11 @@ sub run {
|
||||||
$self->{output}->output_add(long_msg => "Marker supply '$descr': no level but some space remaining.");
|
$self->{output}->output_add(long_msg => "Marker supply '$descr': no level but some space remaining.");
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
if (defined($self->{option_results}->{filter}) && $self->{option_results}->{filter} ne '' &&
|
||||||
|
$instance !~ /$self->{option_results}->{filter}/) {
|
||||||
|
$self->{output}->output_add(long_msg => "Skipping marker supply '$descr' (instance: $instance): filter.");
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
my $prct_value = $current_value;
|
my $prct_value = $current_value;
|
||||||
if ($unit_managed{$unit} == 1) {
|
if ($unit_managed{$unit} == 1) {
|
||||||
|
@ -139,7 +145,7 @@ sub run {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $exit = $self->{perfdata}->threshold_check(value => $prct_value, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
my $exit = $self->{perfdata}->threshold_check(value => $prct_value, threshold => [ { label => 'critical', 'exit_litteral' => 'critical' }, { label => 'warning', exit_litteral => 'warning' } ]);
|
||||||
$self->{output}->output_add(long_msg => sprintf("Marker supply '%s': %.2f %%", $descr, $prct_value));
|
$self->{output}->output_add(long_msg => sprintf("Marker supply '%s': %.2f %% [instance: '%s']", $descr, $prct_value, $hrDeviceIndex . '.' . $prtMarkerSuppliesIndex));
|
||||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => sprintf("Marker supply '%s': %.2f %%", $descr, $prct_value));
|
short_msg => sprintf("Marker supply '%s': %.2f %%", $descr, $prct_value));
|
||||||
|
@ -149,7 +155,7 @@ sub run {
|
||||||
if ($result->{$oid_prtMarkerSuppliesColorantIndex . '.' . $instance} != 0) {
|
if ($result->{$oid_prtMarkerSuppliesColorantIndex . '.' . $instance} != 0) {
|
||||||
$label = $result2->{$oid_prtMarkerColorantValue . '.' . $hrDeviceIndex . '.' . $result->{$oid_prtMarkerSuppliesColorantIndex . '.' . $instance}};
|
$label = $result2->{$oid_prtMarkerColorantValue . '.' . $hrDeviceIndex . '.' . $result->{$oid_prtMarkerSuppliesColorantIndex . '.' . $instance}};
|
||||||
if (defined($perf_label->{$label})) {
|
if (defined($perf_label->{$label})) {
|
||||||
$label .= '#' . $hrDeviceIndex . '#' . $result->{$oid_prtMarkerSuppliesColorantIndex . '.' . $instance};
|
$label .= '#' . $hrDeviceIndex . '#' . $prtMarkerSuppliesIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$perf_label->{$label} = 1;
|
$perf_label->{$label} = 1;
|
||||||
|
@ -183,6 +189,10 @@ Threshold warning in percent.
|
||||||
|
|
||||||
Threshold critical in percent.
|
Threshold critical in percent.
|
||||||
|
|
||||||
|
=item B<--filter>
|
||||||
|
|
||||||
|
Filter maker supply instance.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
Loading…
Reference in New Issue