Hi all!
I’ve started monitoring our datacenter with LibreNMS, all is awesome, but I0m having some troubles with our Bladeshelter’s PDU.
They don’t show power usage but only network, CPU and memory :frowning, I think becaus it is recognized as a generic device…
Can someone help me looking in the right direction to monitor our power consumption and all other power data?
Here some (I hope) useful data:
-bash-4.2$ ./validate.php
Component |
Version |
LibreNMS |
1.63-152-ga184035 |
DB Schema |
2020_04_19_010532_eventlog_sensor_reference_cleanup (165) |
PHP |
7.3.18 |
Python |
3.6.8 |
MySQL |
5.5.65-MariaDB |
RRDTool |
1.4.8 |
SNMP |
NET-SNMP 5.7.2 |
==================================== |
|
[OK] Composer Version: 1.10.6
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
-bash-4.2$
Discovery: Untitled - LibreNMS
Poller: Untitled - LibreNMS
Thanks to all!
Thanks, this point me on the right direction.
I don’t know well as I need OID and SNMP, so I’ve tried this:
[root@dc1-mon-nms-001 ~]# snmpwalk -O n -c DC1 -v 1 172.21.69.220 |grep “1.3.6.1.4.1”
.1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.42610.1.4.4
[root@dc1-mon-nms-001 ~]#
So, I think that I must use .1.3.6.1.4.1.42610. as sysObjectId in my YAML to see all the power ports, right?
Run snmpget -c DC1 -v 1 172.21.69.220 sysObjectID.0
to know the objectid to use
Ok, yaml done, mib uploaded, rediscovered device and waited some poller event. Now device is well recognized, but no power consumption data, always network data only. Must I delete and re-add device? What I’m forgetting to do?
Wait a moment.
You have done the initial detection (OS Detection) but not yet the sensors detection.
Only uploading mibs does nothing, you have to work just a bit more. Now you have to check https://docs.librenms.org/Developing/os/Health-Information/
Ok, this require some time and concentration 
While i read this documentation and I write necessary files, thank you a lot for your help, I appreciate it a lot!
Updates when I’ve done this part!
I think I’m missing something…
What I read in “Health Information” is clear enough, but I’m unable to find oid tables to read…
MIB file doesn’t help me, neither a raw smpwalk…
I’m really a noob with snmp, this is my first work with it 
Is there a way to list oid tables? Some googling around it mame me to try something with snmptranslate, but no result, only errors.
What I do is directly search table
inside the mib file.
If there are no tables, dont worry! There is always a chair! (sorry for the bad joke).
Don’t be sorry, I laugh at your joke 
BTW, my try:
-bash-4.2$ grep -i table mibs/bladeshelter/PWT_1phase_MIB.mib
pduSnmpTrapsReceiversTable OBJECT-TYPE
::= { pduSnmpTrapsReceiversTable 1 }
pduEmailReceiversTable OBJECT-TYPE
::= { pduEmailReceiversTable 1 }
-- pduPwrMonitoringInletStatusTable
pduPwrMonitoringInletStatusTable OBJECT-TYPE
::= { pduPwrMonitoringInletStatusTable 1 }
-- pduPwrMonitoringInletCfgTable
pduPwrMonitoringInletCfgTable OBJECT-TYPE
::= { pduPwrMonitoringInletCfgTable 1 }
-- pduPwrMonitoringOutletStatusTablePduA
pduPwrMonitoringOutletStatusTablePduA OBJECT-TYPE
::= { pduPwrMonitoringOutletStatusTablePduA 1 }
-- pduPwrMonitoringOutletCfgTablePduA
pduPwrMonitoringOutletCfgTablePduA OBJECT-TYPE
::= { pduPwrMonitoringOutletCfgTablePduA 1 }
<snip>
So, I try:
-bash-4.2$ snmptable -c DC1 -v 1 172.21.69.220 pduPwrMonitoringInletStatusTable
pduPwrMonitoringInletStatusTable: Unknown Object Identifier (Sub-id not found: (top) -> pduPwrMonitoringInletStatusTable)
Oh boy… Another try!
-bash-4.2$ snmpwalk -c DC1 -v 1 172.21.69.220 pduPwrMonitoringInletStatusTable
pduPwrMonitoringInletStatusTable: Unknown Object Identifier (Sub-id not found: (top) -> pduPwrMonitoringInletStatusTable)
What?!
So, why not, a last try…
-bash-4.2$ snmpwalk -c DC1 -v 1 -M mibs/bladeshelter/PWT_1phase_MIB.mib 172.21.69.220 pduPwrMonitoringInletStatusTable
MIB search path: mibs/bladeshelter/PWT_1phase_MIB.mib
Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)
Cannot find module (HOST-RESOURCES-TYPES): At line 0 in (none)
Cannot find module (UCD-DISKIO-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)
Cannot find module (UDP-MIB): At line 0 in (none)
Cannot find module (MTA-MIB): At line 0 in (none)
Cannot find module (NETWORK-SERVICES-MIB): At line 0 in (none)
Cannot find module (SCTP-MIB): At line 0 in (none)
Cannot find module (RMON-MIB): At line 0 in (none)
Cannot find module (EtherLike-MIB): At line 0 in (none)
Cannot find module (LM-SENSORS-MIB): At line 0 in (none)
Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)
Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)
Cannot find module (DISMAN-SCHEDULE-MIB): At line 0 in (none)
Cannot find module (UCD-SNMP-MIB): At line 0 in (none)
Cannot find module (UCD-DEMO-MIB): At line 0 in (none)
Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none)
Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
Cannot find module (IPV6-ICMP-MIB): At line 0 in (none)
Cannot find module (IPV6-MIB): At line 0 in (none)
Cannot find module (IPV6-TCP-MIB): At line 0 in (none)
Cannot find module (IPV6-UDP-MIB): At line 0 in (none)
Cannot find module (IP-FORWARD-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-PASS-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-EXTEND-MIB): At line 0 in (none)
Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
Cannot find module (SNMPv2-TM): At line 0 in (none)
Cannot find module (NET-SNMP-VACM-MIB): At line 0 in (none)
pduPwrMonitoringInletStatusTable: Unknown Object Identifier (Sub-id not found: (top) -> pduPwrMonitoringInletStatusTable)
Missing modules???
[root@dc1-mon-nms-001 ~]# yum list installed |grep -i snmp
net-snmp.x86_64 1:5.7.2-48.el7_8 @updates
net-snmp-agent-libs.x86_64 1:5.7.2-48.el7_8 @updates
net-snmp-libs.x86_64 1:5.7.2-48.el7_8 @updates
net-snmp-utils.x86_64 1:5.7.2-48.el7_8 @updates
php-snmp.x86_64 7.3.18-1.el7.remi @remi-php73
So, i think there is a problem with modules… But which problem? :-/
Ok for those tables.
So now open PWT_1phase_MIB.mib, check the first line to know how to properly call the MIB:
For example, the standard DOCS-IF MIB first line looks like
DOCS-IF-MIB DEFINITIONS ::= BEGIN
So the MIB name is DOCS-IF-MIB.
Then, rename the file PWT_1phase_MIB.mib to whatever appears in that first line. Im going to say it looks like PWT-1PHASE-MIB so will use that as example for now.
The correct walk command, in your case, should be:
snmpwalk -c DC1 -v 1 -M mibs/bladeshelter -m PWT-1PHASE-MIB 172.21.69.220 pduPwrMonitoringInletStatusTable
If it says something about Cannot find module
(it shouldnt, but hey…) that means that for loading that OID it needs info from another MIB file that is not in the mibs/bladeshelter
directory. So add the directory containing that MIB to the -M argument of snmpwalk. Lets say it is in the main mibs
directory, then it will look like -M mibs/bladeshelter:mibs
(Note the :
between directories)
You are awesome.
It miss some mibs that I found in /usr/share/snmp/mibs/
(RFC1155-SMI.txt, RFC1213-MIB.txt and SNMPv2-SMI.txt).
And after your precious hints:
-bash-4.2$ snmpwalk -c DC1 -v 1 -M mibs/bladeshelter:/usr/share/snmp/mibs -m SPSv1-MIB 172.21.69.220 pduPwrMonitoringInletStatusTable
SPSv1-MIB::inletIndex.1 = INTEGER: 0
SPSv1-MIB::inletIndex.2 = INTEGER: 1
SPSv1-MIB::inletIndex.3 = INTEGER: 2
SPSv1-MIB::inletIndex.4 = INTEGER: 3
SPSv1-MIB::inletIndex.5 = INTEGER: 4
SPSv1-MIB::inletIndex.6 = INTEGER: 5
SPSv1-MIB::inletIndex.7 = INTEGER: 6
SPSv1-MIB::inletIndex.8 = INTEGER: 7
SPSv1-MIB::inletPowerAll.1 = INTEGER: 7078 0.1W
SPSv1-MIB::inletPowerAll.2 = INTEGER: 0 0.1W
SPSv1-MIB::inletPowerAll.3 = INTEGER: 0 0.1W
SPSv1-MIB::inletPowerAll.4 = INTEGER: 0 0.1W
SPSv1-MIB::inletPowerAll.5 = INTEGER: 0 0.1W
SPSv1-MIB::inletPowerAll.6 = INTEGER: 0 0.1W
SPSv1-MIB::inletPowerAll.7 = INTEGER: 0 0.1W
SPSv1-MIB::inletPowerAll.8 = INTEGER: 0 0.1W
SPSv1-MIB::inletResetFrom.1 = STRING: "10/09/2019 11:31:00"
SPSv1-MIB::inletResetFrom.2 = STRING: "10/09/2019 11:31:00"
SPSv1-MIB::inletResetFrom.3 = STRING: "10/09/2019 11:31:00"
SPSv1-MIB::inletResetFrom.4 = STRING: "10/09/2019 11:31:00"
SPSv1-MIB::inletResetFrom.5 = STRING: "01/01/1970 02:00:00"
SPSv1-MIB::inletResetFrom.6 = STRING: "01/01/1970 02:00:00"
SPSv1-MIB::inletResetFrom.7 = STRING: "01/01/1970 02:00:00"
SPSv1-MIB::inletResetFrom.8 = STRING: "01/01/1970 02:00:00"
SPSv1-MIB::inletEnergy.1 = INTEGER: 2697815 KWh
SPSv1-MIB::inletEnergy.2 = INTEGER: 0 KWh
<snip>
`
So, now I think I can see not only chairs, but also tables
and write my own health discovery yaml file 
Those mibs are in /opt/librenms/mibs
You cant use directories outsied librenms install dir ( /opt/librenms ).
I mean, you can, but you must not use them. Only those from librenms
Also, another step is required. Now you need to translate the OID containing the value to numeric oid (you use it in the discovery yaml as num_oid: )
Run snmptranslate -M mibs/bladeshelter:mibs -m SPSv1-MIB -On SPSv1-MIB::inletPowerAll
So, your it will look like:
mib: SPSv1-MIB
modules:
sensors:
power:
data:
-
oid: pduPwrMonitoringInletStatusTable
value: inletPowerAll
num_oid: '**THE NUMERIC OID YOU TRASNLATED**. {{ $index }}'
descr: 'Inlet {{ $index }}'
group: Inlets
Wonderful!
My result is:
mib: SPSv1-MIB
modules:
sensors:
power:
data:
-
oid: pduPwrMonitoringInletStatusTable
value: inletPowerAll
num_oid: '.1.3.6.1.4.1.42610.1.4.4.1.6.1.2.1.2 {{ $index }}'
descr: 'Inlet Power S{{ $index }} {{ $outletLabel }}'
group: 'Inlets'
current:
data:
-
oid: pduPwrMonitoringInletStatusTable
value: inletCurrPhase1
num_oid: '.1.3.6.1.4.1.42610.1.4.4.1.6.1.2.1.6.{{ $index }}'
descr: 'Inlet Current S{{ $index }} {{ $outletLabel }}'
group: 'Inlets'
voltage:
data:
-
oid: pduPwrMonitoringInletStatusTable
value: inletVoltPhase1
num_oid: '.1.3.6.1.4.1.42610.1.4.4.1.6.1.2.1.9.{{ $index }}'
descr: 'Inlet Voltage S{{ $index }} {{ $outletLabel }}'
group: 'Inlets'
power_consumed:
data:
-
oid: pduPwrMonitoringInletStatusTable
value: inletEnergy
num_oid: '.1.3.6.1.4.1.42610.1.4.4.1.6.1.2.1.4.{{ $index }}'
descr: 'Inlet Energy S{{ $index }} {{ $outletLabel }}'
group: 'Inlets'
So, I can monitor all data I need from the inlet. Right?
If all the data you want is there, yes!
How does it look in your dev?
I’ve done a “Rediscover Device” and a Discover under Capture two hours ago but nothing is changed. Did I must delete and re-add the device?
No, you shouldnt.
Manually discover the device with ./discovery.php -d -h DEVICEID -m sensors
and pbin the output
https://p.libren.ms/view/d037d629
ERRATA: I forget one parameter… Here the correct one!
https://p.libren.ms/view/666e66dd