Fix #1537
This commit is contained in:
parent
75b05bedee
commit
f86f331f89
|
@ -85,10 +85,34 @@ sub new {
|
||||||
my ($class, %options) = @_;
|
my ($class, %options) = @_;
|
||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
|
$options{options}->add_options(arguments => {
|
||||||
|
'warning-errors:s' => { name => 'warning_errors' },
|
||||||
|
'critical-errors:s' => { name => 'critical_errors' },
|
||||||
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub check_options {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
foreach ('warning', 'critical') {
|
||||||
|
next if (!defined($options{option_results}->{$_ . '_errors'}) || $options{option_results}->{$_ . '_errors'} eq '');
|
||||||
|
foreach my $oid (keys %{$self->{oids_errors}}) {
|
||||||
|
$oid =~ /^oid_if(In|Out)(.*)$/;
|
||||||
|
if (!defined($options{option_results}->{$_ . '-instance-interface-packets-' . lc($1) . '-' . lc($2) . '-count'})) {
|
||||||
|
$options{option_results}->{$_ . '-instance-interface-packets-' . lc($1) . '-' . lc($2) . '-count'} = $options{option_results}->{$_ . '_errors'};
|
||||||
|
}
|
||||||
|
if (!defined($options{option_results}->{$_ . '-' . lc($1) . '-' . lc($2)})) {
|
||||||
|
$options{option_results}->{$_ . '-' . lc($1) . '-' . lc($2)} = $options{option_results}->{$_ . '_errors'};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$self->SUPER::check_options(%options);
|
||||||
|
}
|
||||||
|
|
||||||
sub load_errors {
|
sub load_errors {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
@ -159,9 +183,17 @@ Can used special variables like: %{admstatus}, %{opstatus}, %{duplexstatus}, %{d
|
||||||
Set critical threshold for status (Default: '%{admstatus} eq "up" and %{opstatus} ne "up"').
|
Set critical threshold for status (Default: '%{admstatus} eq "up" and %{opstatus} ne "up"').
|
||||||
Can used special variables like: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
|
Can used special variables like: %{admstatus}, %{opstatus}, %{duplexstatus}, %{display}
|
||||||
|
|
||||||
|
=item B<--warning-errors>
|
||||||
|
|
||||||
|
Set warning threshold for all error counters.
|
||||||
|
|
||||||
|
=item B<--critical-errors>
|
||||||
|
|
||||||
|
Set critical threshold for all error counters.
|
||||||
|
|
||||||
=item B<--warning-*>
|
=item B<--warning-*>
|
||||||
|
|
||||||
Threshold warning.
|
Threshold warning (will superseed --warning-errors).
|
||||||
Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down',
|
Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down',
|
||||||
'in-traffic', 'out-traffic', 'in-error', 'in-discard', 'out-error', 'out-discard',
|
'in-traffic', 'out-traffic', 'in-error', 'in-discard', 'out-error', 'out-discard',
|
||||||
'in-ucast' (%), 'in-bcast' (%), 'in-mcast' (%), 'out-ucast' (%), 'out-bcast' (%), 'out-mcast' (%),
|
'in-ucast' (%), 'in-bcast' (%), 'in-mcast' (%), 'out-ucast' (%), 'out-bcast' (%), 'out-mcast' (%),
|
||||||
|
@ -176,7 +208,7 @@ And also: 'in-tooshort' (%), 'in-toolong' (%), 'in-fcserror' (%), 'in-alignerror
|
||||||
|
|
||||||
=item B<--critical-*>
|
=item B<--critical-*>
|
||||||
|
|
||||||
Threshold critical.
|
Threshold critical (will superseed --warning-errors).
|
||||||
Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down',
|
Can be: 'total-port', 'total-admin-up', 'total-admin-down', 'total-oper-up', 'total-oper-down',
|
||||||
'in-traffic', 'out-traffic', 'in-error', 'in-discard', 'out-error', 'out-discard',
|
'in-traffic', 'out-traffic', 'in-error', 'in-discard', 'out-error', 'out-discard',
|
||||||
'in-ucast' (%), 'in-bcast' (%), 'in-mcast' (%), 'out-ucast' (%), 'out-bcast' (%), 'out-mcast' (%),
|
'in-ucast' (%), 'in-bcast' (%), 'in-mcast' (%), 'out-ucast' (%), 'out-bcast' (%), 'out-mcast' (%),
|
||||||
|
|
Loading…
Reference in New Issue