Loss of generic color of sensor states

Hi,

As described in the Sensor Status Support documentation, LibreNMS simplifies sensor status monitoring by translating raw values into understandable, generic states that allow for consistent visualization and simplified analysis:
0 = Ok Severity::Ok => ‘label-success’ (green)
1 = Warning Severity::Warning => ‘label-warning’ (orange)
2 = Critical Severity::Error => ‘label-danger’ (red)
3 = Unknown Severity::Unknown => ‘label-default’ (gray)

Since version 25.5.0-15, these colors are no longer respected and seem to correspond to the severity colors:
0 = Unknown Severity::Unknown => ‘label-default’ (gray)
1 = Ok Severity::Ok => ‘label-success’ (green)
2 = Info Severity::Info => ‘label-info’ (light blue)
3 = Notice Severity::Notice => ‘label-primary’ (dark blue)
4 = Warning Severity::Warning => ‘label-warning’ (orange)
5 = Error Severity::Error => ‘label-danger’ (red)
Default => ‘label-default’ (gray)

Screenshot with Firefox (141.0 64 bits) : All labels turned gray when they were green !

I tried with the latest version released (25.7.0) but the problem is still there.

Is this a decision to change this principle and should we revise the YAML to adapt the colors?
Or is this a bug that will be fixed in a future version?

While waiting for your response, and to work around the problem in my environment, I modified the file: StateTranslation.php In the directory: /librenms/app/Models/ to return to the usual generic states:

public function severity(): Severity
{
//return Severity::tryFrom((int) $this->state_generic_value) ?? Severity::Unknown;
switch ((int) $this->state_generic_value) {
case 0: return Severity::Ok;
case 1: return Severity::Warning;
case 2: return Severity::Error;
default: return Severity::Unknown;
}
}

Thanks,

This is a stupid error. The backed values of the Severity Enum don’t match up with the generic backing values… You could have just sent your fix upstream to get it merged (I probably would have requested a more modern match statement instead though)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.