Problem discovering/polling SNR values for new OS

Tags: #<Tag:0x00007fb054247730> #<Tag:0x00007fb054247668>

I’ve added discovery for a new OS/device, but I’m having issues with discovering/polling the SNR value of the SHDSL ports. If I snmpwalk the OID directly I get the current SNR value in dB, but for some reason I can’t get LibreNMS to display it correctly. In LibreNMS it just shows as 0 dB.

When I look at the debug output it looks like discovery.php returns the correct SNR values, but poller.php for some reason doesn’t.

[[email protected] ~]$ ./validate.php 
Component | Version
--------- | -------
LibreNMS  | 21.5.1-20-g70023c0b5
DB Schema | 2021_04_08_151101_add_foreign_keys_to_port_group_port_table (208)
PHP       | 7.4.16
Python    | 3.6.8
MySQL     | 10.3.28-MariaDB
RRDTool   | 1.7.0
SNMP      | NET-SNMP 5.8

[OK]    Composer Version: 2.0.14
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct

If I walk the OID directly it shows the correct values:

[[email protected] ~]$ snmpwalk -v2c -c public -m mibs/westermo/HDSL2-SHDSL-LINE-MIB shdslmodem01 hdsl2ShdslEndpointCurrSnrMgn
HDSL2-SHDSL-LINE-MIB::hdsl2ShdslEndpointCurrSnrMgn.4096.0.0.wirePair1 = INTEGER: 26 dB
HDSL2-SHDSL-LINE-MIB::hdsl2ShdslEndpointCurrSnrMgn.4097.xtuC.0.wirePair1 = INTEGER: 0 dB

[[email protected] ~]$ snmpwalk -v2c -c public -m mibs/westermo/HDSL2-SHDSL-LINE-MIB -On shdslmodem01 hdsl2ShdslEndpointCurrSnrMgn
. = INTEGER: 26 dB
. = INTEGER: 0 dB

Discovery YAML files:

[[email protected] definitions]$ cat weos.yaml 
os: weos
text: 'Westermo WeOS'
type: network
icon: westermo
group: westermo
mib_dir: westermo
    - { graph: device_bits, text: 'Device Traffic' }
    - sysObjectID:
        - .
    sensors: true
    sensors: true

[[email protected] definitions]$ cat discovery/weos.yaml 
        version: SNMPv2-SMI::mib-
        hardware: SNMPv2-SMI::mib-
        serial: SNMPv2-SMI::mib-
                        - ifName
                    oid: hdsl2ShdslEndpointCurrSnrMgn
                    num_oid: '.{{ $index }}'
                    descr: 'Port {{ $ifName }}'

Output from discovery.php:

Output from poller.php:

I’d appreciate any help to resolve this. When I get everything to work properly I can hopefully assist in adding this device to the LibreNMS repo. Thanks.

I’m trying to teach myself to add a new OS and saw something similar with my dBm and Temp sensors - discovery would get a value, then polling would return zero, and debugging didn’t look to show anything off.

I’ve tried so many things and am a long way off getting what I want working such that I don’t quite know what sequence of events was the critical bit, but I know my main areas of error were with the index of tables, and specifying a value - as an example, my working ones now look like this:

                    oid: snMspsSfpTable
                    value: snMspsSfpRxPower
                    num_oid: '.{{ $index }}'
                    divisor: 10
                    descr: '{{ $ifName }} Receive Power'
                    index: 'snMspsSfpRxPower.{{ $index }}'

From some searching I found the below indicating what you’re accessing is a table, so you could try something like:

                    oid: hdsl2ShdslEndpointCurrTable
                    num_oid: '.{{ $index }}'
                    value: hdsl2ShdslEndpointCurrSnrMgn
                    index: 'hdsl2ShdslEndpointCurrSnrMgn.{{ $index }}'
                    descr: 'Port {{ $ifName }}'

Not sure if that is the cause or something else wrong as I’m still swimming with this and it’s a bit of a black box to me, so keen to learn more! (hdsl2ShdslEndpointCurrTable) (hdsl2ShdslEndpointCurrEntry) (hdsl2ShdslEndpointCurrAtn) (hdsl2ShdslEndpointCurrSnrMgn) (hdsl2ShdslEndpointCurrStatus) (hdsl2ShdslEndpointES) (hdsl2ShdslEndpointSES) (hdsl2ShdslEndpointCRCanomalies) (hdsl2ShdslEndpointLOSWS) (hdsl2ShdslEndpointUAS) (hdsl2ShdslEndpointCurr15MinTimeElapsed) (hdsl2ShdslEndpointCurr15MinES) (hdsl2ShdslEndpointCurr15MinSES) (hdsl2ShdslEndpointCurr15MinCRCanomalies) (hdsl2ShdslEndpointCurr15MinLOSWS) (hdsl2ShdslEndpointCurr15MinUAS) (hdsl2ShdslEndpointCurr1DayTimeElapsed) (hdsl2ShdslEndpointCurr1DayES) (hdsl2ShdslEndpointCurr1DaySES) (hdsl2ShdslEndpointCurr1DayCRCanomalies) (hdsl2ShdslEndpointCurr1DayLOSWS) (hdsl2ShdslEndpointCurr1DayUAS) (hdsl2ShdslEndpointCurrTipRingReversal) (hdsl2ShdslEndpointCurrActivationState)

Thanks for your reply @rhinoau.
I tried with your example and with that code I’m also getting the correct SNR value when discovering, but polling still return zero.

However, I noticed one thing when looking at the debug output when running discovery.php and poller.php. It seems like the poller don’t know about the OID/MIB because it says Unkown Object Identifier. The poller doesn’t specify what MIB-file to use?
See output below.

Output from discovery.php (works fine):

SNMP['/usr/bin/snmpbulkwalk' '-Cr50' '-v2c' '-c' 'COMMUNITY' '-OteQUs' '-Ih' '-m' 'HDSL2-SHDSL-LINE-MIB' '-M' '/opt/librenms/mibs:/opt/librenms/mibs/westermo' 'udp:HOSTNAME:161' 'hdsl2ShdslEndpointCurrTable']
hdsl2ShdslEndpointCurrAtn.4096.0.0.wirePair1 = 0
hdsl2ShdslEndpointCurrAtn.4097.xtuC.networkSide.wirePair1 = 0
hdsl2ShdslEndpointCurrSnrMgn.4096.0.0.wirePair1 = 0
hdsl2ShdslEndpointCurrSnrMgn.4097.xtuC.networkSide.wirePair1 = 26  

Output from poller.php (errors)

SNMP['/usr/bin/snmpget' '-v2c' '-c' 'COMMUNITY' '-OUQnte' '-M' '/opt/librenms/mibs:/opt/librenms/mibs/westermo' 'udp:HOSTNAME:161' '.' '.']
Exitcode: 1  
. Unknown Object Identifier (Sub-id not found: transmission -> wirePair1)
. Unknown Object Identifier (Sub-id not found: transmission -> xtuC.networkSide.wirePair1)  
. Unknown Object Identifier (Sub-id not found: transmission -> wirePair1)
. Unknown Object Identifier (Sub-id not found: transmission -> xtuC.networkSide.wirePair1)  
Checking (snmp) snr Port 1/1... 
Checking (snmp) snr Port 1/2... 

If I try to snmpget the OID directly it works fine when I specify what MIB-file to use:

[[email protected] ~]$ snmpget -v2c -c public -m /opt/librenms/mibs/HDSL2-SHDSL-LINE-MIB shdslmodem01 .
MIB search path: /opt/librenms/.snmp/mibs:/usr/share/snmp/mibs
HDSL2-SHDSL-LINE-MIB::hdsl2ShdslEndpointCurrSnrMgn.4097.xtuC.networkSide.wirePair1 = INTEGER: 26 dB

Do I have to specify the MIB-files used for polling somewhere? In the LibreNMS docs I can only find that you have to specify MIB-files in the discovery .yaml files.

Edit: I tried to enable the MIB polling module but it doesn’t seem to help :confused:

Yep I’m pretty confused too! I’m pretty rusty on the internals of SNMP and MIBs, but in all my testing I’ve never seen a device return table indexes as text on my sensors. Those definitions of utux, networkside, wirePair etc. look correctly defined in the MIB though, maybe it’s getting stuck translating between for some reason.

When I look at my polling debug examples, I see flags ‘-OUQnte’ and no reference to a text element in any example. For some reason the wirepair etc. parts are still in text when it’s expecting them in numerics perhaps.

For a comparison out of interest, what happens if you overwrite the flag to remove the ‘n’? Trying something within the data block like: snmp_flags: ‘-OUQte’

I tried without the “n” flag as you suggested, but unfortunately it doesn’t make a difference. As far as I know the “n” flag is just for printing the OIDs numerically.

I believe the issue is that when LibreNMS run the polling, it doesn’t include “-m HDSL2-SHDSL-LINE-MIB” in the snmpget command, so it simply doesn’t know about the OID and therefore cannot poll it. Hence the “Unknown Object Identifier” errors in the poller.php output I posted previously.

Maybe there’s no way to resolve this using yaml, but instead we’d have to use the advanced health discovery and write the code in PHP?

I’m still having issues with this one. Tried several different snmp_flags in the data block without luck, but thanks for the tip @rhinoau because I didn’t know you could set snmp_flags there before.

I’ve done some experiments specifying the num_oid manually without using {{ $index }} and now it does actually discover and poll the values correctly, sort of… only problem is that it returns the value of port 1 for both ports.

                    oid: hdsl2ShdslEndpointCurrTable
                    num_oid: '.'
                    value: hdsl2ShdslEndpointCurrSnrMgn
                    index: 'hdsl2ShdslEndpointCurrSnrMgn.{{ $index }}'
                    descr: 'Port {{ $ifName }}'

These are the two OID:s that I’m trying to poll:

. = INTEGER: 26 dB
. = INTEGER: 0 dB

Is there a way to modify my YAML config to poll these two OIDs as two separate “ports”?
I tried to just duplicate the above and change the num_oid to the 2nd one, but that didn’t work…

Do you have a branch or draft pull request containing these definitions along with the test data that I can look at? Would be keen to see what I can get from my side seeing as I’m trying to improve my understanding of exactly this while progressing mine: Add OS Support for Siemens Scalance X Switching by rhinoau · Pull Request #12938 · librenms/librenms · GitHub

Unfortunately I don’t have that at the moment. I’d have to go through the snmprec and exclude some information before I can share it on the internet.

To be honest… at the moment I’m just thinking about giving up and not monitoring the SNR values at all, as I can’t seem to get it to work :frowning:

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