fix junos threshold overload instance

This commit is contained in:
Colin Gagnaire 2019-07-29 10:27:32 +02:00
parent 381abd5f3e
commit 8ead9bcf08
3 changed files with 11 additions and 7 deletions

View File

@ -41,7 +41,7 @@ sub check_alarm {
$options{name}, $options{value}, $options{instance}
)
);
my $exit = $self->get_severity(section => 'alarm', value => $options{value});
my $exit = $self->get_severity(section => 'alarm', instance => $options{instance}, value => $options{value});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(
severity => $exit,
@ -66,7 +66,7 @@ sub check {
check_alarm($self, instance => 0, name => 'yellow', value => $map_alarm_states{$results->{$oid_jnxYellowAlarmState}})
if (defined($results->{$oid_jnxYellowAlarmState}));
check_alarm($self, instance => 0, name => 'red', value => $map_alarm_states{$results->{$oid_jnxRedAlarmState}})
check_alarm($self, instance => 1, name => 'red', value => $map_alarm_states{$results->{$oid_jnxRedAlarmState}})
if (defined($results->{$oid_jnxRedAlarmState}));
}

View File

@ -93,7 +93,7 @@ sub check {
$self->{output}->output_add(long_msg => sprintf("fru '%s' state is %s [instance: %s, type: %s, offline reason: %s]",
$name, $result->{jnxFruState},
$instance, $map_fru_type{$type}, $result->{jnxFruOfflineReason}));
my $exit = $self->get_severity(section => 'fru', value => $result->{jnxFruState});
my $exit = $self->get_severity(section => 'fru', instance => $instance, value => $result->{jnxFruState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Fru '%s' state is %s [offline reason: %s]", $name, $result->{jnxFruState},

View File

@ -44,18 +44,22 @@ sub check {
jnxOperatingState => { oid => '.1.3.6.1.4.1.2636.3.1.13.1.6', map => \%map_operating_states },
};
my $results = $self->{snmp}->get_table(oid => $self->{oids_operating}->{jnxOperatingEntry}, start => $mapping->{jnxOperatingState}->{oid}, end => $mapping->{jnxOperatingState}->{oid});
my $results = $self->{snmp}->get_table(oid => $self->{oids_operating}->{jnxOperatingEntry},
start => $mapping->{jnxOperatingState}->{oid}, end => $mapping->{jnxOperatingState}->{oid});
foreach my $instance (sort $self->get_instances(oid_entry => $self->{oids_operating}->{jnxOperatingEntry}, oid_name => $self->{oids_operating}->{jnxOperatingDescr})) {
foreach my $instance (sort $self->get_instances(oid_entry => $self->{oids_operating}->{jnxOperatingEntry},
oid_name => $self->{oids_operating}->{jnxOperatingDescr})) {
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $results, instance => $instance);
my $desc = $self->get_cache(oid_entry => $self->{oids_operating}->{jnxOperatingEntry}, oid_name => $self->{oids_operating}->{jnxOperatingDescr}, instance => $instance);
my $desc = $self->get_cache(oid_entry => $self->{oids_operating}->{jnxOperatingEntry},
oid_name => $self->{oids_operating}->{jnxOperatingDescr}, instance => $instance);
next if ($self->check_filter(section => 'operating', instance => $instance, name => $desc));
$self->{components}->{operating}->{total}++;
$self->{output}->output_add(long_msg => sprintf("operating '%s' state is %s [instance: %s]",
$desc, $result->{jnxOperatingState}, $instance));
my $exit = $self->get_severity(section => 'operating', value => $result->{jnxOperatingState});
my $exit = $self->get_severity(section => 'operating', instance => $instance,
value => $result->{jnxOperatingState});
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("Operating '%s' state is %s",