fix junos threshold overload instance
This commit is contained in:
parent
381abd5f3e
commit
8ead9bcf08
|
@ -41,7 +41,7 @@ sub check_alarm {
|
||||||
$options{name}, $options{value}, $options{instance}
|
$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)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
severity => $exit,
|
severity => $exit,
|
||||||
|
@ -66,7 +66,7 @@ sub check {
|
||||||
|
|
||||||
check_alarm($self, instance => 0, name => 'yellow', value => $map_alarm_states{$results->{$oid_jnxYellowAlarmState}})
|
check_alarm($self, instance => 0, name => 'yellow', value => $map_alarm_states{$results->{$oid_jnxYellowAlarmState}})
|
||||||
if (defined($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}));
|
if (defined($results->{$oid_jnxRedAlarmState}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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]",
|
$self->{output}->output_add(long_msg => sprintf("fru '%s' state is %s [instance: %s, type: %s, offline reason: %s]",
|
||||||
$name, $result->{jnxFruState},
|
$name, $result->{jnxFruState},
|
||||||
$instance, $map_fru_type{$type}, $result->{jnxFruOfflineReason}));
|
$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)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => sprintf("Fru '%s' state is %s [offline reason: %s]", $name, $result->{jnxFruState},
|
short_msg => sprintf("Fru '%s' state is %s [offline reason: %s]", $name, $result->{jnxFruState},
|
||||||
|
|
|
@ -44,18 +44,22 @@ sub check {
|
||||||
jnxOperatingState => { oid => '.1.3.6.1.4.1.2636.3.1.13.1.6', map => \%map_operating_states },
|
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 $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));
|
next if ($self->check_filter(section => 'operating', instance => $instance, name => $desc));
|
||||||
$self->{components}->{operating}->{total}++;
|
$self->{components}->{operating}->{total}++;
|
||||||
|
|
||||||
$self->{output}->output_add(long_msg => sprintf("operating '%s' state is %s [instance: %s]",
|
$self->{output}->output_add(long_msg => sprintf("operating '%s' state is %s [instance: %s]",
|
||||||
$desc, $result->{jnxOperatingState}, $instance));
|
$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)) {
|
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit,
|
$self->{output}->output_add(severity => $exit,
|
||||||
short_msg => sprintf("Operating '%s' state is %s",
|
short_msg => sprintf("Operating '%s' state is %s",
|
||||||
|
|
Loading…
Reference in New Issue