Add Power values for Cisco switches

I want to add current power values to more devices in our comms room, can anyone help with this? Mainly Cisco devices to see how much power they are using.
the power shows correctly for some of my HP and DELL servers but not cisco?

Hi @karl_newman
If the values are available over SNMP, then they can be added. You can do it yourself directly (links in the Issue Template) or you can open an issue in GitHub with all the requested data, and list the OIDs that contains the data you would like to add (but this will take a long time to be merged, cause we have a lot of pending issues in the pipe).
Bye

It’s not straightforward from a dig about the SNMP tree as the recorded units vary from device to device.

On the devices where it’s available you start at 1.3.6.1.4.1.9.9.117.1.1 (cefcFRUPower)

cefcTotalAvailableCurrent  1.3.6.1.4.1.9.9.117.1.1.1.1.3
cefcTotalDrawnCurrent      1.3.6.1.4.1.9.9.117.1.1.1.1.4

On a (e.g.) Cat4900M this gives you:

.1.3.6.1.4.1.9.9.117.1.1.1.1.3.9 8000
.1.3.6.1.4.1.9.9.117.1.1.1.1.4.9 5658

but the units are defined at 1.3.6.1.4.1.9.9.117.1.1.1.1.2 (cefcPowerUnits)

On the same switch the value is:

.1.3.6.1.4.1.9.9.117.1.1.1.1.2.9 "centiAmpsAt12V"

For the values above that gives you a calculation of:

8000 x 0.01 x 12 = 960W
5658 x 0.01 x 12 = 679W

Matching the output of the IOS sh power command. So far so good…

But on a Cat6k the OIDs give you:

.1.3.6.1.4.1.9.9.117.1.1.1.1.2.1017 "centiAmpsAt42v"
.1.3.6.1.4.1.9.9.117.1.1.1.1.2.2017 "centiAmpsAt42v"
.1.3.6.1.4.1.9.9.117.1.1.1.1.3.1017 6598
.1.3.6.1.4.1.9.9.117.1.1.1.1.3.2017 6598
.1.3.6.1.4.1.9.9.117.1.1.1.1.4.1017 3796
.1.3.6.1.4.1.9.9.117.1.1.1.1.4.2017 3796

Which changes the calculation for that device to:

6598 x 0.01 x 42 = 2771.16W
3796 x 0.01 x 42 = 1594.32W

According to the structure you describe, this can be achieved via PHP code only, not YAML.

You can have a look at this directory of your LibreNMS install for power sensor discovery:
/opt/librenms/includes/discovery/sensors/power

Each of the files in this directory are named after the “os” of the device you want to discover. Your file would need to be named “cisco.inc.php” to be properly called.
In this file, you would need to :

  • Check if you have data in the expected part of the SNMP tree
  • Compute the exact OID
  • Adapt the “multiplier” and “divisor” value according to the centiampsAtXXX value so you get the proper WATT value
  • Call the “discover_sensor” function to register your sensor.

Then the polling itself will run automagically after discover sensor is done correctly.

You should probably open a git PullRequest, so we can follow your code write, and help you in case needed.

Bye

1 Like

Thanks very much for your responses, i will look through and let you know how i got on.

thanks