mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-29 08:34:46 +02:00
add unknown count component for hardware template (#2470)
This commit is contained in:
parent
b95ee6ca18
commit
b1556a6698
@ -121,6 +121,7 @@ sub new {
|
|||||||
if ($self->{count} == 1) {
|
if ($self->{count} == 1) {
|
||||||
foreach my $component (@{$self->{components_module}}) {
|
foreach my $component (@{$self->{components_module}}) {
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
|
'unknown-count-' . $component . ':s' => { name => 'unknown_count_' . $component },
|
||||||
'warning-count-' . $component . ':s' => { name => 'warning_count_' . $component },
|
'warning-count-' . $component . ':s' => { name => 'warning_count_' . $component },
|
||||||
'critical-count-' . $component . ':s' => { name => 'critical_count_' . $component }
|
'critical-count-' . $component . ':s' => { name => 'critical_count_' . $component }
|
||||||
});
|
});
|
||||||
@ -223,7 +224,7 @@ sub check_options {
|
|||||||
|
|
||||||
if ($self->{count} == 1) {
|
if ($self->{count} == 1) {
|
||||||
foreach my $comp (@{$self->{components_module}}) {
|
foreach my $comp (@{$self->{components_module}}) {
|
||||||
foreach my $threshold (('warning', 'critical')) {
|
foreach my $threshold (('warning', 'critical', 'unknown')) {
|
||||||
if (($self->{perfdata}->threshold_validate(label => $threshold . '-count-' . $comp, value => $self->{option_results}->{$threshold . '_count_' . $comp})) == 0) {
|
if (($self->{perfdata}->threshold_validate(label => $threshold . '-count-' . $comp, value => $self->{option_results}->{$threshold . '_count_' . $comp})) == 0) {
|
||||||
$self->{output}->add_option_msg(short_msg => "Wrong " . $threshold . " threshold '" . $self->{option_results}->{$threshold . '_count_' . $comp} . "'.");
|
$self->{output}->add_option_msg(short_msg => "Wrong " . $threshold . " threshold '" . $self->{option_results}->{$threshold . '_count_' . $comp} . "'.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
@ -415,8 +416,9 @@ sub get_severity_count {
|
|||||||
$status = $self->{perfdata}->threshold_check(
|
$status = $self->{perfdata}->threshold_check(
|
||||||
value => $options{value},
|
value => $options{value},
|
||||||
threshold => [
|
threshold => [
|
||||||
{ label => 'critical-count-' . $options{label}, 'exit_litteral' => 'critical' },
|
{ label => 'critical-count-' . $options{label}, exit_litteral => 'critical' },
|
||||||
{ label => 'warning-count-' . $options{label}, 'exit_litteral' => 'warning' }
|
{ label => 'warning-count-' . $options{label}, exit_litteral => 'warning' },
|
||||||
|
{ label => 'unknown-count-' . $options{label}, exit_litteral => 'unknown' },
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$thresholds->{critical} = $self->{perfdata}->get_perfdata_for_output(label => 'critical-count-' . $options{label});
|
$thresholds->{critical} = $self->{perfdata}->get_perfdata_for_output(label => 'critical-count-' . $options{label});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user