fix(brocade/snmp): hardware mode - missing status (#2845)
This commit is contained in:
parent
c9b47b1d48
commit
ec0aa833fe
|
@ -133,7 +133,7 @@ my $mapping = {
|
|||
swSensorType => { oid => '.1.3.6.1.4.1.1588.2.1.1.1.1.22.1.2', map => \%map_type },
|
||||
swSensorStatus => { oid => '.1.3.6.1.4.1.1588.2.1.1.1.1.22.1.3', map => \%map_status },
|
||||
swSensorValue => { oid => '.1.3.6.1.4.1.1588.2.1.1.1.1.22.1.4' },
|
||||
swSensorInfo => { oid => '.1.3.6.1.4.1.1588.2.1.1.1.1.22.1.5' },
|
||||
swSensorInfo => { oid => '.1.3.6.1.4.1.1588.2.1.1.1.1.22.1.5' }
|
||||
};
|
||||
my $oid_swSensorEntry = '.1.3.6.1.4.1.1588.2.1.1.1.1.22.1';
|
||||
|
||||
|
@ -161,21 +161,33 @@ sub check {
|
|||
|
||||
$result->{swSensorInfo} = centreon::plugins::misc::trim($result->{swSensorInfo});
|
||||
$self->{components}->{sensor}->{total}++;
|
||||
$self->{output}->output_add(long_msg => sprintf("%s sensor '%s' status is '%s' [instance = %s]",
|
||||
$result->{swSensorType}, $result->{swSensorInfo}, $result->{swSensorStatus}, $instance));
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"%s sensor '%s' status is '%s' [instance = %s]",
|
||||
$result->{swSensorType}, $result->{swSensorInfo}, $result->{swSensorStatus}, $instance
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'sensor', value => $result->{swSensorStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("%s sensor '%s' status is '%s'", $result->{swSensorType}, $result->{swSensorInfo}));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf("%s sensor '%s' status is '%s'", $result->{swSensorType}, $result->{swSensorInfo}, $result->{swSensorStatus})
|
||||
);
|
||||
}
|
||||
|
||||
if ($result->{swSensorValue} > 0 && $result->{swSensorType} ne 'power-supply') {
|
||||
my ($exit2, $warn, $crit, $checked) = $self->get_severity_numeric(section => $result->{swSensorType}, instance => $instance, value => $result->{swSensorValue});
|
||||
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit2,
|
||||
short_msg => sprintf("%s sensor '%s' is %s %s", $result->{swSensorType}, $result->{swSensorInfo}, $result->{swSensorValue},
|
||||
$map_unit{$result->{swSensorType}}));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit2,
|
||||
short_msg => sprintf(
|
||||
"%s sensor '%s' is %s %s",
|
||||
$result->{swSensorType}, $result->{swSensorInfo}, $result->{swSensorValue},
|
||||
$map_unit{$result->{swSensorType}}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$self->{output}->perfdata_add(
|
||||
label => 'sensor', unit => $map_unit{$result->{swSensorType}},
|
||||
nlabel => 'hardware.sensor.' . $result->{swSensorType} . '.' . $map_unit{$result->{swSensorType}},
|
||||
|
@ -199,7 +211,7 @@ my %map_oper_status = (1 => 'online', 2 => 'offline', 3 => 'testing', 4 => 'faul
|
|||
|
||||
my $mapping_global = {
|
||||
swFirmwareVersion => { oid => '.1.3.6.1.4.1.1588.2.1.1.1.1.6' },
|
||||
swOperStatus => { oid => '.1.3.6.1.4.1.1588.2.1.1.1.1.7', map => \%map_oper_status },
|
||||
swOperStatus => { oid => '.1.3.6.1.4.1.1588.2.1.1.1.1.7', map => \%map_oper_status }
|
||||
};
|
||||
my $oid_swSystem = '.1.3.6.1.4.1.1588.2.1.1.1.1';
|
||||
|
||||
|
@ -221,14 +233,21 @@ sub check {
|
|||
|
||||
$self->{components}->{switch}->{total}++;
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("switch operational status is '%s' [firmware: %s].",
|
||||
$self->{output}->output_add(
|
||||
long_msg => sprintf(
|
||||
"switch operational status is '%s' [firmware: %s].",
|
||||
$result->{swOperStatus}, $result->{swFirmwareVersion}
|
||||
));
|
||||
)
|
||||
);
|
||||
my $exit = $self->get_severity(section => 'switch', value => $result->{swOperStatus});
|
||||
if (!$self->{output}->is_status(value => $exit, compare => 'ok', litteral => 1)) {
|
||||
$self->{output}->output_add(severity => $exit,
|
||||
short_msg => sprintf("switch operational status is '%s'",
|
||||
$result->{swOperStatus}));
|
||||
$self->{output}->output_add(
|
||||
severity => $exit,
|
||||
short_msg => sprintf(
|
||||
"switch operational status is '%s'",
|
||||
$result->{swOperStatus}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue