Closed dcec closed 1 year ago
if ( $self->{fgHwSensorEntValue} =~ /^[0-9,.E]+$/ && $self->{fgHwSensorEntValue} == -1) {
# empty, this case is handled in the default sensor class
Do you have an example for a fgHwSensorEntValue which both matches ^[0-9,.E]+$ AND equals -1? Or at least one matching the regexp? Like this, the empty case will never be reached.
The PSU is good, thanks for that. As fgHwSensorEntValue can contain valuable information (it is a string and might show more values than ON or LOST), can you improve the Powersupply class as well?
if ($self->{fgHwSensorEntAlarmStatus} eq "true") {
$self->annotate_info($self->{fgHwSensorEntValue}) if defined $self->{fgHwSensorEntValue};
$self->add_critical();
}
You are right, on regexp i have to add the "-" like: if ( $self->{fgHwSensorEntValue} =~ /^[0-9,.E-]+$/ && $self->{fgHwSensorEntValue} == -1) {
The fgHwSensorEntValue contain ON or LOST, no other data:
info: checking sensors [POWERSUPPLY_1] fgHwSensorEntAlarmStatus: false fgHwSensorEntIndex: 1 fgHwSensorEntName: PSU [1] fgHwSensorEntValue: ON info: PSU [1] alarm status is false
[POWERSUPPLY_2] fgHwSensorEntAlarmStatus: true fgHwSensorEntIndex: 2 fgHwSensorEntName: PSU [2] fgHwSensorEntValue: LOST info: PSU [2] alarm status is true
have sense to replace
if ( $self->{fgHwSensorEntValue} == -1) {
with:
if ( $self->{fgHwSensorEntValue} =~ /^-1$/) {
Working fine also on FGT 40F with FortiOS 7.2
Fix PSU sensors on Fortigate FortiOS 7.0 #310