add unknown thresholds
This commit is contained in:
parent
3effd636c5
commit
ca4bb673e1
|
@ -203,7 +203,7 @@ sub check_options {
|
||||||
push @$change_macros_opt, 'unknown-' . $_->{label}, 'warning-' . $_->{label}, 'critical-' . $_->{label}
|
push @$change_macros_opt, 'unknown-' . $_->{label}, 'warning-' . $_->{label}, 'critical-' . $_->{label}
|
||||||
if (defined($_->{type}) && $_->{type} == 2);
|
if (defined($_->{type}) && $_->{type} == 2);
|
||||||
$_->{obj}->{instance_mode} = $self;
|
$_->{obj}->{instance_mode} = $self;
|
||||||
$_->{obj}->init(option_results => $self->{option_results});
|
$_->{obj}->init(option_results => $self->{option_results}) if (!defined($_->{type}) || $_->{type} != 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,14 @@ sub new {
|
||||||
|
|
||||||
sub init {
|
sub init {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
my $unkn = defined($self->{threshold_unkn}) ? $self->{threshold_unkn} : 'unknown-' . $self->{thlabel};
|
||||||
my $warn = defined($self->{threshold_warn}) ? $self->{threshold_warn} : 'warning-' . $self->{thlabel};
|
my $warn = defined($self->{threshold_warn}) ? $self->{threshold_warn} : 'warning-' . $self->{thlabel};
|
||||||
my $crit = defined($self->{threshold_crit}) ? $self->{threshold_crit} : 'critical-' . $self->{thlabel};
|
my $crit = defined($self->{threshold_crit}) ? $self->{threshold_crit} : 'critical-' . $self->{thlabel};
|
||||||
|
|
||||||
|
if (($self->{perfdata}->threshold_validate(label => $unkn, value => $options{option_results}->{$unkn})) == 0) {
|
||||||
|
$self->{output}->add_option_msg(short_msg => "Wrong $unkn threshold '" . $options{option_results}->{$unkn} . "'.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
if (($self->{perfdata}->threshold_validate(label => $warn, value => $options{option_results}->{$warn})) == 0) {
|
if (($self->{perfdata}->threshold_validate(label => $warn, value => $options{option_results}->{$warn})) == 0) {
|
||||||
$self->{output}->add_option_msg(short_msg => "Wrong $warn threshold '" . $options{option_results}->{$warn} . "'.");
|
$self->{output}->add_option_msg(short_msg => "Wrong $warn threshold '" . $options{option_results}->{$warn} . "'.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
|
@ -108,6 +113,7 @@ sub threshold_check {
|
||||||
return &{$self->{closure_custom_threshold_check}}($self, %options);
|
return &{$self->{closure_custom_threshold_check}}($self, %options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $unkn = defined($self->{threshold_unkn}) ? $self->{threshold_unkn} : 'unknown-' . $self->{thlabel};
|
||||||
my $warn = defined($self->{threshold_warn}) ? $self->{threshold_warn} : 'warning-' . $self->{thlabel};
|
my $warn = defined($self->{threshold_warn}) ? $self->{threshold_warn} : 'warning-' . $self->{thlabel};
|
||||||
my $crit = defined($self->{threshold_crit}) ? $self->{threshold_crit} : 'critical-' . $self->{thlabel};
|
my $crit = defined($self->{threshold_crit}) ? $self->{threshold_crit} : 'critical-' . $self->{thlabel};
|
||||||
|
|
||||||
|
@ -121,7 +127,8 @@ sub threshold_check {
|
||||||
return $self->{perfdata}->threshold_check(
|
return $self->{perfdata}->threshold_check(
|
||||||
value => $value, threshold => [
|
value => $value, threshold => [
|
||||||
{ label => $crit, exit_litteral => 'critical' },
|
{ label => $crit, exit_litteral => 'critical' },
|
||||||
{ label => $warn, exit_litteral => 'warning' }
|
{ label => $warn, exit_litteral => 'warning' },
|
||||||
|
{ label => $unkn, exit_litteral => 'unknown' }
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,16 +323,6 @@ sub new {
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub check_options {
|
|
||||||
my ($self, %options) = @_;
|
|
||||||
$self->SUPER::check_options(%options);
|
|
||||||
|
|
||||||
$self->change_macros(macros => [
|
|
||||||
'unknown_status', 'warning_status', 'critical_status',
|
|
||||||
'unknown_interface_status', 'warning_interface_status', 'critical_interface_status'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
my $map_trunk_status = {
|
my $map_trunk_status = {
|
||||||
0 => 'up',
|
0 => 'up',
|
||||||
1 => 'down',
|
1 => 'down',
|
||||||
|
|
Loading…
Reference in New Issue