Fix #1682
This commit is contained in:
parent
c2510e70ff
commit
dc924a1788
|
@ -63,16 +63,19 @@ sub check_fan_envmon {
|
|||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_ciscoEnvMonFanStatusEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'fan', instance => $instance));
|
||||
next if ($self->check_filter(section => 'fan', instance => $instance, name => $result->{ciscoEnvMonFanStatusDescr}));
|
||||
next if ($result->{ciscoEnvMonFanState} =~ /not present/i &&
|
||||
$self->absent_problem(section => 'fan', instance => $instance));
|
||||
$self->absent_problem(section => 'fan', instance => $instance, name => $result->{ciscoEnvMonFanStatusDescr}));
|
||||
$self->{components}->{fan}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("fan '%s' status is %s [instance: %s].",
|
||||
$result->{ciscoEnvMonFanStatusDescr}, $result->{ciscoEnvMonFanState},
|
||||
$instance
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'fan', value => $result->{ciscoEnvMonFanState});
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"fan '%s' status is %s [instance: %s].",
|
||||
$result->{ciscoEnvMonFanStatusDescr}, $result->{ciscoEnvMonFanState},
|
||||
$instance
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'fan', instance => $instance, value => $result->{ciscoEnvMonFanState});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("fan '%s' status is %s",
|
||||
|
@ -94,12 +97,16 @@ sub check_fan_entity {
|
|||
my $fan_descr = $self->{results}->{$oid_entPhysicalDescr}->{$oid_entPhysicalDescr . '.' . $instance};
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cefcFanTrayOperStatus}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'fan', instance => $instance));
|
||||
next if ($self->check_filter(section => 'fan', instance => $instance, name => $fan_descr));
|
||||
|
||||
$self->{components}->{fan}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Fan '%s' status is %s [instance: %s]",
|
||||
$fan_descr, $result->{cefcFanTrayOperStatus}, $instance));
|
||||
my $exit = $self->get_severity(section => 'fan', value => $result->{cefcFanTrayOperStatus});
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"Fan '%s' status is %s [instance: %s]",
|
||||
$fan_descr, $result->{cefcFanTrayOperStatus}, $instance
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'fan', instance => $instance, value => $result->{cefcFanTrayOperStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Fan '%s/%s' status is %s", $fan_descr, $instance, $result->{cefcFanTrayOperStatus}));
|
||||
|
@ -118,4 +125,4 @@ sub check {
|
|||
check_fan_entity($self);
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -79,12 +79,12 @@ sub check {
|
|||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cefcModuleOperStatus}, instance => $instance);
|
||||
my $module_descr = $self->{results}->{$oid_entPhysicalDescr}->{$oid_entPhysicalDescr . '.' . $instance};
|
||||
|
||||
next if ($self->check_filter(section => 'module', instance => $instance));
|
||||
next if ($self->check_filter(section => 'module', instance => $instance, name => $module_descr));
|
||||
|
||||
$self->{components}->{module}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Module '%s' status is %s [instance: %s]",
|
||||
$module_descr, $result->{cefcModuleOperStatus}, $instance));
|
||||
my $exit = $self->get_severity(section => 'module', value => $result->{cefcModuleOperStatus});
|
||||
my $exit = $self->get_severity(section => 'module', instance => $instance, value => $result->{cefcModuleOperStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Module '%s/%s' status is %s", $module_descr,
|
||||
|
@ -93,4 +93,4 @@ sub check {
|
|||
}
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -61,12 +61,12 @@ sub check {
|
|||
next;
|
||||
}
|
||||
|
||||
next if ($self->check_filter(section => 'physical', instance => $instance));
|
||||
next if ($self->check_filter(section => 'physical', instance => $instance, name => $physical_descr));
|
||||
|
||||
$self->{components}->{physical}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Physical '%s' status is %s [instance: %s]",
|
||||
$physical_descr, $result->{cefcPhysicalStatus}, $instance));
|
||||
my $exit = $self->get_severity(section => 'physical', value => $result->{cefcPhysicalStatus});
|
||||
my $exit = $self->get_severity(section => 'physical', instance => $instance, value => $result->{cefcPhysicalStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Physical '%s/%s' status is %s", $physical_descr,
|
||||
|
@ -75,4 +75,4 @@ sub check {
|
|||
}
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -79,16 +79,16 @@ sub check_psu_envmon {
|
|||
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_ciscoEnvMonSupplyStatusEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'psu', instance => $instance));
|
||||
next if ($self->check_filter(section => 'psu', instance => $instance, name => $result->{ciscoEnvMonSupplyStatusDescr}));
|
||||
next if ($result->{ciscoEnvMonSupplyState} =~ /not present/i &&
|
||||
$self->absent_problem(section => 'psu', instance => $instance));
|
||||
$self->absent_problem(section => 'psu', instance => $instance, name => $result->{ciscoEnvMonSupplyStatusDescr}));
|
||||
$self->{components}->{psu}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is %s [instance: %s] [source: %s]",
|
||||
$result->{ciscoEnvMonSupplyStatusDescr}, $result->{ciscoEnvMonSupplyState},
|
||||
$instance, $result->{ciscoEnvMonSupplySource}
|
||||
));
|
||||
my $exit = $self->get_severity(section => 'psu', value => $result->{ciscoEnvMonSupplyState});
|
||||
my $exit = $self->get_severity(section => 'psu', instance => $instance, value => $result->{ciscoEnvMonSupplyState});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Power supply '%s' status is %s",
|
||||
|
@ -110,12 +110,12 @@ sub check_psu_entity {
|
|||
my $psu_descr = $self->{results}->{$oid_entPhysicalDescr}->{$oid_entPhysicalDescr . '.' . $instance};
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_cefcFRUPowerOperStatus}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'psu', instance => $instance));
|
||||
next if ($self->check_filter(section => 'psu', instance => $instance, name => $psu_descr));
|
||||
|
||||
$self->{components}->{psu}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("Power supply '%s' status is %s [instance: %s]",
|
||||
$psu_descr, $result->{cefcFRUPowerOperStatus}, $instance));
|
||||
my $exit = $self->get_severity(section => 'psu', value => $result->{cefcFRUPowerOperStatus});
|
||||
my $exit = $self->get_severity(section => 'psu', instance => $instance, value => $result->{cefcFRUPowerOperStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Power supply '%s/%s' status is %s", $psu_descr, $instance, $result->{cefcFRUPowerOperStatus}));
|
||||
|
@ -134,4 +134,4 @@ sub check {
|
|||
check_psu_entity($self);
|
||||
}
|
||||
|
||||
1;
|
||||
1;
|
||||
|
|
|
@ -59,22 +59,26 @@ sub check {
|
|||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_ciscoEnvMonTemperatureStatusEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'temperature', instance => $instance));
|
||||
next if ($self->check_filter(section => 'temperature', instance => $instance, name => $result->{ciscoEnvMonTemperatureStatusDescr}));
|
||||
$self->{components}->{temperature}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("Temperature '%s' status is %s [instance: %s] [value: %s C]",
|
||||
$result->{ciscoEnvMonTemperatureStatusDescr}, $result->{ciscoEnvMonTemperatureState},
|
||||
$instance, defined($result->{ciscoEnvMonTemperatureStatusValue}) ? $result->{ciscoEnvMonTemperatureStatusValue} : '-'));
|
||||
my $exit = $self->get_severity(section => 'temperature', value => $result->{ciscoEnvMonTemperatureState});
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"Temperature '%s' status is %s [instance: %s] [value: %s C]",
|
||||
$result->{ciscoEnvMonTemperatureStatusDescr}, $result->{ciscoEnvMonTemperatureState},
|
||||
$instance, defined($result->{ciscoEnvMonTemperatureStatusValue}) ? $result->{ciscoEnvMonTemperatureStatusValue} : '-'
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'temperature', instance => $instance, value => $result->{ciscoEnvMonTemperatureState});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Temperature '%s' status is %s",
|
||||
$result->{ciscoEnvMonTemperatureStatusDescr}, $result->{ciscoEnvMonTemperatureState}));
|
||||
}
|
||||
|
||||
|
||||
next if (!defined($result->{ciscoEnvMonTemperatureStatusValue}));
|
||||
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, value => $result->{ciscoEnvMonTemperatureStatusValue});
|
||||
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'temperature', instance => $instance, name => $result->{ciscoEnvMonTemperatureStatusDescr}, value => $result->{ciscoEnvMonTemperatureStatusValue});
|
||||
if ($checked == 0) {
|
||||
my $warn_th = undef;
|
||||
my $crit_th = '~:' . $result->{ciscoEnvMonTemperatureThreshold};
|
||||
|
|
|
@ -60,13 +60,13 @@ sub check {
|
|||
my $instance = $1;
|
||||
my $result = $self->{snmp}->map_instance(mapping => $mapping, results => $self->{results}->{$oid_ciscoEnvMonVoltageStatusEntry}, instance => $instance);
|
||||
|
||||
next if ($self->check_filter(section => 'voltage', instance => $instance));
|
||||
next if ($self->check_filter(section => 'voltage', instance => $instance, name => $result->{ciscoEnvMonVoltageStatusDescr}));
|
||||
$self->{components}->{voltage}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("Voltage '%s' status is %s [instance: %s] [value: %s C]",
|
||||
$result->{ciscoEnvMonVoltageStatusDescr}, $result->{ciscoEnvMonVoltageState},
|
||||
$instance, $result->{ciscoEnvMonVoltageStatusValue}));
|
||||
my $exit = $self->get_severity(section => 'voltage', value => $result->{ciscoEnvMonVoltageState});
|
||||
my $exit = $self->get_severity(section => 'voltage', instance => $instance, value => $result->{ciscoEnvMonVoltageState});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("Voltage '%s' status is %s",
|
||||
|
@ -74,7 +74,7 @@ sub check {
|
|||
}
|
||||
|
||||
$result->{ciscoEnvMonVoltageStatusValue} = $result->{ciscoEnvMonVoltageStatusValue} / 1000;
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'voltage', instance => $instance, value => $result->{ciscoEnvMonVoltageStatusValue});
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => 'voltage', instance => $instance, name => $result->{ciscoEnvMonVoltageStatusDescr}, value => $result->{ciscoEnvMonVoltageStatusValue});
|
||||
if ($checked == 0) {
|
||||
my $warn_th = undef;
|
||||
my $crit_th = ((defined($result->{ciscoEnvMonVoltageThresholdLow}) && $result->{ciscoEnvMonVoltageThresholdLow} =~ /\d/) ? sprintf("%.3f", $result->{ciscoEnvMonVoltageThresholdLow} / 1000) : 0) . ':' .
|
||||
|
|
|
@ -164,6 +164,10 @@ Can be: 'fan', 'psu', 'temperature', 'voltage', 'module', 'physical', 'sensor'.
|
|||
Exclude some parts (comma seperated list) (Example: --filter=fan --filter=psu)
|
||||
Can also exclude specific instance: --filter=fan,1
|
||||
|
||||
=item B<--add-name-instance>
|
||||
|
||||
Add literal description for instance value (used in filter, absent-problem and threshold options).
|
||||
|
||||
=item B<--absent-problem>
|
||||
|
||||
Return an error if an entity is not 'present' (default is skipping) (comma seperated list)
|
||||
|
|
Loading…
Reference in New Issue