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
.1.3.6.1.2.1.10.48.1.5.1.2.4096.0.0.1 = INTEGER: 26 dB
.1.3.6.1.2.1.10.48.1.5.1.2.4097.1.0.1 = 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
over:
    - { graph: device_bits, text: 'Device Traffic' }
discovery:
    - sysObjectID:
        - .1.3.6.1.4.1.16177
poller_modules:
    sensors: true
discovery_modules:
    sensors: true

[[email protected] definitions]$ cat discovery/weos.yaml 
mib: HDSL2-SHDSL-LINE-MIB
modules:
    os:
        version: SNMPv2-SMI::mib-2.47.1.1.1.1.10.5
        hardware: SNMPv2-SMI::mib-2.47.1.1.1.1.13.5
        serial: SNMPv2-SMI::mib-2.47.1.1.1.1.11.5
    sensors:
        pre-cache:
            data:
                -
                    oid:
                        - ifName
        snr:
            data:
                -
                    oid: hdsl2ShdslEndpointCurrSnrMgn
                    num_oid: '.1.3.6.1.2.1.10.48.1.5.1.2.{{ $index }}'
                    descr: 'Port {{ $ifName }}'

Output from discovery.php:
https://p.libren.ms/view/f95da886

Output from poller.php:
https://p.libren.ms/view/fa2d7950

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: '.1.3.6.1.4.1.4329.20.1.1.1.1.46.10.1.32.{{ $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: '.1.3.6.1.2.1.10.48.1.5.1.2.{{ $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!

https://cric.grenoble.cnrs.fr/Administrateurs/Outils/MIBS/?module=HDSL2-SHDSL-LINE-MIB&fournisseur=ietf:

1.3.6.1.2.1.10.48.1.5 (hdsl2ShdslEndpointCurrTable)
1.3.6.1.2.1.10.48.1.5.1 (hdsl2ShdslEndpointCurrEntry)
1.3.6.1.2.1.10.48.1.5.1.1 (hdsl2ShdslEndpointCurrAtn)
1.3.6.1.2.1.10.48.1.5.1.2 (hdsl2ShdslEndpointCurrSnrMgn)
1.3.6.1.2.1.10.48.1.5.1.3 (hdsl2ShdslEndpointCurrStatus)
1.3.6.1.2.1.10.48.1.5.1.4 (hdsl2ShdslEndpointES)
1.3.6.1.2.1.10.48.1.5.1.5 (hdsl2ShdslEndpointSES)
1.3.6.1.2.1.10.48.1.5.1.6 (hdsl2ShdslEndpointCRCanomalies)
1.3.6.1.2.1.10.48.1.5.1.7 (hdsl2ShdslEndpointLOSWS)
1.3.6.1.2.1.10.48.1.5.1.8 (hdsl2ShdslEndpointUAS)
1.3.6.1.2.1.10.48.1.5.1.9 (hdsl2ShdslEndpointCurr15MinTimeElapsed)
1.3.6.1.2.1.10.48.1.5.1.10 (hdsl2ShdslEndpointCurr15MinES)
1.3.6.1.2.1.10.48.1.5.1.11 (hdsl2ShdslEndpointCurr15MinSES)
1.3.6.1.2.1.10.48.1.5.1.12 (hdsl2ShdslEndpointCurr15MinCRCanomalies)
1.3.6.1.2.1.10.48.1.5.1.13 (hdsl2ShdslEndpointCurr15MinLOSWS)
1.3.6.1.2.1.10.48.1.5.1.14 (hdsl2ShdslEndpointCurr15MinUAS)
1.3.6.1.2.1.10.48.1.5.1.15 (hdsl2ShdslEndpointCurr1DayTimeElapsed)
1.3.6.1.2.1.10.48.1.5.1.16 (hdsl2ShdslEndpointCurr1DayES)
1.3.6.1.2.1.10.48.1.5.1.17 (hdsl2ShdslEndpointCurr1DaySES)
1.3.6.1.2.1.10.48.1.5.1.18 (hdsl2ShdslEndpointCurr1DayCRCanomalies)
1.3.6.1.2.1.10.48.1.5.1.19 (hdsl2ShdslEndpointCurr1DayLOSWS)
1.3.6.1.2.1.10.48.1.5.1.20 (hdsl2ShdslEndpointCurr1DayUAS)
1.3.6.1.2.1.10.48.1.5.1.21 (hdsl2ShdslEndpointCurrTipRingReversal)
1.3.6.1.2.1.10.48.1.5.1.22 (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' '.1.3.6.1.2.1.10.48.1.5.1.2.4096.0.0.wirePair1' '.1.3.6.1.2.1.10.48.1.5.1.2.4097.xtuC.networkSide.wirePair1']
Exitcode: 1  
.1.3.6.1.2.1.10.48.1.5.1.2.4096.0.0.wirePair1: Unknown Object Identifier (Sub-id not found: transmission -> wirePair1)
.1.3.6.1.2.1.10.48.1.5.1.2.4097.xtuC.networkSide.wirePair1: Unknown Object Identifier (Sub-id not found: transmission -> xtuC.networkSide.wirePair1)  
  
.1.3.6.1.2.1.10.48.1.5.1.2.4096.0.0.wirePair1: Unknown Object Identifier (Sub-id not found: transmission -> wirePair1)
.1.3.6.1.2.1.10.48.1.5.1.2.4097.xtuC.networkSide.wirePair1: Unknown Object Identifier (Sub-id not found: transmission -> xtuC.networkSide.wirePair1)  
Checking (snmp) snr Port 1/1... 
Checking (snmp) snr Port 1/2... 
0 SNR
0 SNR

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 .1.3.6.1.2.1.10.48.1.5.1.2.4097.xtuC.networkSide.wirePair1
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.

        snr:
            data:
                -
                    oid: hdsl2ShdslEndpointCurrTable
                    num_oid: '.1.3.6.1.2.1.10.48.1.5.1.2.4096.0.0.1'
                    value: hdsl2ShdslEndpointCurrSnrMgn
                    index: 'hdsl2ShdslEndpointCurrSnrMgn.{{ $index }}'
                    descr: 'Port {{ $ifName }}'

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

.1.3.6.1.2.1.10.48.1.5.1.2.4096.0.0.1 = INTEGER: 26 dB
.1.3.6.1.2.1.10.48.1.5.1.2.4097.1.0.1 = 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.