Fix #1547
This commit is contained in:
parent
f6a9795d10
commit
b4f2585702
|
@ -48,10 +48,11 @@ sub new {
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$self->{version} = '1.0';
|
$self->{version} = '1.0';
|
||||||
$options{options}->add_options(arguments =>
|
$options{options}->add_options(arguments => {
|
||||||
{
|
'role:s' => { name => 'role', default => 'primary' },
|
||||||
"role:s" => { name => 'role', default => 'primary' },
|
'filter-vrid:s' => { name => 'filter_vrid' },
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,11 +74,13 @@ sub run {
|
||||||
my $oid_cHsrpGrpStandbyState = ".1.3.6.1.4.1.9.9.106.1.2.1.1.15"; # HSRP Oper Status
|
my $oid_cHsrpGrpStandbyState = ".1.3.6.1.4.1.9.9.106.1.2.1.1.15"; # HSRP Oper Status
|
||||||
my $oid_cHsrpGrpEntryRowStatus = ".1.3.6.1.4.1.9.9.106.1.2.1.1.17"; # HSRP Admin Status
|
my $oid_cHsrpGrpEntryRowStatus = ".1.3.6.1.4.1.9.9.106.1.2.1.1.17"; # HSRP Admin Status
|
||||||
|
|
||||||
my $results = $self->{snmp}->get_multiple_table(oids => [
|
my $results = $self->{snmp}->get_multiple_table(oids =>
|
||||||
|
[
|
||||||
{ oid => $oid_cHsrpGrpStandbyState },
|
{ oid => $oid_cHsrpGrpStandbyState },
|
||||||
{ oid => $oid_cHsrpGrpEntryRowStatus },
|
{ oid => $oid_cHsrpGrpEntryRowStatus },
|
||||||
],
|
],
|
||||||
nothing_quit => 1);
|
nothing_quit => 1
|
||||||
|
);
|
||||||
|
|
||||||
$self->{output}->output_add(severity => 'OK',
|
$self->{output}->output_add(severity => 'OK',
|
||||||
short_msg => sprintf("Router is in its expected state : '%s'", $self->{option_results}->{role}));
|
short_msg => sprintf("Router is in its expected state : '%s'", $self->{option_results}->{role}));
|
||||||
|
@ -85,6 +88,12 @@ sub run {
|
||||||
$oid =~ /(\d+\.\d+)$/;
|
$oid =~ /(\d+\.\d+)$/;
|
||||||
my $vrid = $1;
|
my $vrid = $1;
|
||||||
|
|
||||||
|
if (defined($self->{option_results}->{filter_vrid}) && $self->{option_results}->{filter_vrid} ne '' &&
|
||||||
|
$vrid !~ /$self->{option_results}->{filter_vrid}/) {
|
||||||
|
$self->{output}->output_add(long_msg => "skipping vrid '" . $vrid . "': no matching filter.", debug => 1);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
my $operState = $results->{$oid_cHsrpGrpEntryRowStatus}->{$oid_cHsrpGrpEntryRowStatus . "." . $vrid};
|
my $operState = $results->{$oid_cHsrpGrpEntryRowStatus}->{$oid_cHsrpGrpEntryRowStatus . "." . $vrid};
|
||||||
my $adminState = $results->{$oid_cHsrpGrpStandbyState}->{$oid};
|
my $adminState = $results->{$oid_cHsrpGrpStandbyState}->{$oid};
|
||||||
|
|
||||||
|
@ -121,6 +130,10 @@ Check Cisco HSRP (CISCO-HSRP-MIB). Trigger a critical if not in the expected sta
|
||||||
|
|
||||||
=over 8
|
=over 8
|
||||||
|
|
||||||
|
=item B<--filter-vrid>
|
||||||
|
|
||||||
|
Filter VRID (can be a regexp).
|
||||||
|
|
||||||
=item B<--role>
|
=item B<--role>
|
||||||
|
|
||||||
If role is 'primary', an error if HSRPs are 'standby' states.
|
If role is 'primary', an error if HSRPs are 'standby' states.
|
||||||
|
|
Loading…
Reference in New Issue