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 },
|
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 },
|
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' },
|
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';
|
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});
|
$result->{swSensorInfo} = centreon::plugins::misc::trim($result->{swSensorInfo});
|
||||||
$self->{components}->{sensor}->{total}++;
|
$self->{components}->{sensor}->{total}++;
|
||||||
$self->{output}->output_add(long_msg => sprintf("%s sensor '%s' status is '%s' [instance = %s]",
|
$self->{output}->output_add(
|
||||||
$result->{swSensorType}, $result->{swSensorInfo}, $result->{swSensorStatus}, $instance));
|
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});
|
my $exit = $self->get_severity(section => 'sensor', value => $result->{swSensorStatus});
|
||||||
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(
|
||||||
short_msg => sprintf("%s sensor '%s' status is '%s'", $result->{swSensorType}, $result->{swSensorInfo}));
|
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') {
|
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});
|
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)) {
|
if (!$self->{output}->is_status(value => $exit2, compare => 'ok', litteral => 1)) {
|
||||||
$self->{output}->output_add(severity => $exit2,
|
$self->{output}->output_add(
|
||||||
short_msg => sprintf("%s sensor '%s' is %s %s", $result->{swSensorType}, $result->{swSensorInfo}, $result->{swSensorValue},
|
severity => $exit2,
|
||||||
$map_unit{$result->{swSensorType}}));
|
short_msg => sprintf(
|
||||||
|
"%s sensor '%s' is %s %s",
|
||||||
|
$result->{swSensorType}, $result->{swSensorInfo}, $result->{swSensorValue},
|
||||||
|
$map_unit{$result->{swSensorType}}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{output}->perfdata_add(
|
$self->{output}->perfdata_add(
|
||||||
label => 'sensor', unit => $map_unit{$result->{swSensorType}},
|
label => 'sensor', unit => $map_unit{$result->{swSensorType}},
|
||||||
nlabel => 'hardware.sensor.' . $result->{swSensorType} . '.' . $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 = {
|
my $mapping_global = {
|
||||||
swFirmwareVersion => { oid => '.1.3.6.1.4.1.1588.2.1.1.1.1.6' },
|
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';
|
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->{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}
|
$result->{swOperStatus}, $result->{swFirmwareVersion}
|
||||||
));
|
)
|
||||||
|
);
|
||||||
my $exit = $self->get_severity(section => 'switch', value => $result->{swOperStatus});
|
my $exit = $self->get_severity(section => 'switch', value => $result->{swOperStatus});
|
||||||
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(
|
||||||
short_msg => sprintf("switch operational status is '%s'",
|
severity => $exit,
|
||||||
$result->{swOperStatus}));
|
short_msg => sprintf(
|
||||||
|
"switch operational status is '%s'",
|
||||||
|
$result->{swOperStatus}
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue