ArubaOS-CX Power Supply status support

I’m trying to add power supply state sensor support for ArubaOS-CX 6300 switches. I’m not sure where to or how to add support, as this sensor seems to be picked up already, but as a power (wattage) sensor and not a state sensor.

LibreNMS detects the power sensor. It shows up in inventory and it shows me the wattage readout (eg. PSU1 uses 35 watts). The SNMP walk shows:

ENTITY-SENSOR-MIB::entPhySensorType.107401 = INTEGER: watts(6)
ENTITY-SENSOR-MIB::entPhySensorScale.107401 = INTEGER: units(9)
ENTITY-SENSOR-MIB::entPhySensorPrecision.107401 = INTEGER: 0
ENTITY-SENSOR-MIB::entPhySensorValue.107401 = INTEGER: 4
ENTITY-SENSOR-MIB::entPhySensorOperStatus.107401 = INTEGER: ok(1)
ENTITY-SENSOR-MIB::entPhySensorUnitsDisplay.107401 = STRING: Watts
ENTITY-SENSOR-MIB::entPhySensorValueTimeStamp.107401 = Timeticks: (722945) 2:00:29.45
ENTITY-SENSOR-MIB::entPhySensorValueUpdateRate.107401 = Gauge32: 0 millisecond

What I need here is a sensor for ‘entPhySensorOperStatus’. This is either 1 (ok) or 2 (nonoperational) (when I pull the power cable from this PSU).

The value of 2 (nonoperational) is interesting, as there is also a check in sensors/entity-sensor.inc.php to explicitly ignore a sensor with operational status nonoperational:

        // Check for valid sensors
        if (isset($entry['entPhySensorOperStatus']) && ($entry['entPhySensorOperStatus'] === 'unavailable' || $entry['entPhySensorOperStatus'] === 'nonoperational')) {
            $valid_sensor = false;
        }

My questions are:

  • Should I attempt to write state sensor support for this sensor in the first place, given the possible ‘nonoperational’ as status when i pull the power cable on a PSU?
  • Should I ammend/improve includes/discovery/sensors/entity-sensor.inc.php?
  • Or should I add a new file in includes/discovery/sensors/state/arubaos-cx.php ?
  • Or should I add a new file in includes/discovery/entity-physical/arubaos-cx.php ?

Any advise is appreciated!

Hello

I think I see that you would be making a conceptual error.

As far as I know

ENTITY-SENSOR-MIB::entPhySensorOperStatus.107401 = INTEGER: ok(1)

Indicates that when power is being served, the status is OK and not FAILING

The function of said OID is not to record that it is operational or not, but on the contrary, that when it is operational it does it correctly or not.

However, you could use it, as your device’s firmware surely does, for a state calculation using a logical rule, which you should see where to apply.

IF 
ENTITY-SENSOR-MIB::entPhySensorOperStatus = OK 
OR 
ENTITY-SENSOR-MIB::entPhySensorOperStatus = FAIL 
THEN 
power on the port is active.
ELSE
power on the port not is active.

I hope this observation helps you.

Regards

The function of said OID is not to record that it is operational or not, but on the contrary, that when it is operational it does it correctly or not.

There are 2 OIDs that change value when I pull the plug on a power supply:

ENTITY-SENSOR-MIB::entPhySensorOperStatus.107401 = INTEGER: ok(1)
ENTITY-SENSOR-MIB::entPhySensorOperStatus.107401 = INTEGER: nonoperational(3)

and:

ENTITY-STATE-MIB::entStateOper.113002 = INTEGER: enabled(3)
ENTITY-STATE-MIB::entStateOper.113002 = INTEGER: disabled(2)

You mean I should use entStateOper instead?

Physical entity 113002 is of class ‘powerSupply’ (6).

ENTITY-STATE-MIB::entStateLastChanged.113002 = STRING:
ENTITY-STATE-MIB::entStateAdmin.113002 = INTEGER: unlocked(4)
ENTITY-STATE-MIB::entStateOper.113002 = INTEGER: enabled(3)
ENTITY-STATE-MIB::entStateUsage.113002 = INTEGER: active(3)
ENTITY-STATE-MIB::entStateAlarm.113002 = BITS:
ENTITY-STATE-MIB::entStateStandby.113002 = INTEGER: providingService(4)

However, besides entStateOper these values do not change when I pull a plug
For example, the entStateAlarm doesn’t show anything

And if so, do you have an answer regarding my question on how/where I should add state support for this sensor?

1 Like

entPhySensorOperStatus seems to make more sense.

You would need to add the info to the state sensor in this file includes/definitions/discovery/arubaos-cx.yaml