librenms icon indicating copy to clipboard operation
librenms copied to clipboard

Added support for new device OS Westermo WeOS

Open OSIRIS-REx opened this issue 1 year ago • 6 comments

Added support for new device OS Westermo WeOS, SHDSL devices

DO NOT DELETE THE UNDERLYING TEXT

Please note

Please read this information carefully. You can run ./lnms dev:check to check your code before submitting.

  • [x] Have you followed our code guidelines?
  • [x] If my Pull Request does some changes/fixes/enhancements in the WebUI, I have inserted a screenshot of it.
  • [x] If my Pull Request makes discovery/polling/yaml changes, I have added/updated test data.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926 After you are done testing, you can remove the changes with ./scripts/github-remove. If there are schema changes, you can ask on discord how to revert.

OSIRIS-REx avatar Dec 28 '23 15:12 OSIRIS-REx

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Dec 28 '23 15:12 CLAassistant

I have made some changes to the discovery sensor in YAML and it's now discovering and polling the SNR values correctly. One of the issues was that the index included strings, so I had to set snmp_flags: '-OQUsbe'.

However, there's still an issue with Descr that I cannot figure out how to set properly. The issue seem to be that the index for the SNR-value is not the same as the ifName index. So it doesn't know what port (ifName) to use. Do you have any ideas how to solve it in YAML?

LibreNMS screenshot

Some snmpwalk output:

[librenms]$ snmpwalk -v2c -c public -M /opt/librenms/mibs -m HDSL2-SHDSL-LINE-MIB <HOSTNAME> ifName
IF-MIB::ifName.1 = STRING: lo
IF-MIB::ifName.5 = STRING: vlan1
IF-MIB::ifName.6 = STRING: vlan42
IF-MIB::ifName.7 = STRING: vlan71
IF-MIB::ifName.4096 = STRING: 1/1
IF-MIB::ifName.4097 = STRING: 1/2
IF-MIB::ifName.4098 = STRING: 2/1
IF-MIB::ifName.4099 = STRING: 2/2
IF-MIB::ifName.4100 = STRING: 2/3
IF-MIB::ifName.4101 = STRING: 2/4

[librenms]$ snmpwalk -v2c -c public -M /opt/librenms/mibs -m HDSL2-SHDSL-LINE-MIB <HOSTNAME> hdsl2ShdslEndpointCurrSnrMgn 
HDSL2-SHDSL-LINE-MIB::hdsl2ShdslEndpointCurrSnrMgn.4096.0.networkSide.wirePair1 = INTEGER: 27 dB
HDSL2-SHDSL-LINE-MIB::hdsl2ShdslEndpointCurrSnrMgn.4097.xtuC.networkSide.wirePair1 = INTEGER: 26 dB

[librenms]$ snmpwalk -v2c -c public -M /opt/librenms/mibs -m HDSL2-SHDSL-LINE-MIB <HOSTNAME> hdsl2ShdslEndpointCurrSnrMgn -On
.1.3.6.1.2.1.10.48.1.5.1.2.4096.0.1.1 = INTEGER: 27 dB
.1.3.6.1.2.1.10.48.1.5.1.2.4097.1.1.1 = INTEGER: 26 dB

Discovery debugging:

Snr: Dynamic Discovery (snr):  
array (
  'data' => 
  array (
    0 => 
    array (
      'oid' => 'hdsl2ShdslEndpointCurrTable',
      'value' => 'hdsl2ShdslEndpointCurrSnrMgn',
      'num_oid' => '.1.3.6.1.2.1.10.48.1.5.1.2.{{ $index }}',
      'snmp_flags' => '-OQUsbe',
      'descr' => 'DSL {{ $ifName }} SNR',
      'index' => 'snr-{{ $index }}',
      'low_limit' => 6,
      'low_warn_limit' => 10,
      'warn_limit' => 98,
      'high_limit' => 99,
    ),
  ),
)  
Data hdsl2ShdslEndpointCurrTable:  
array (
  '4096.0.1.1' => 
  array (
    'hdsl2ShdslEndpointCurrAtn' => '0',
    'hdsl2ShdslEndpointCurrSnrMgn' => '27',
  ),
  '4097.1.1.1' => 
  array (
    'hdsl2ShdslEndpointCurrAtn' => '0',
    'hdsl2ShdslEndpointCurrSnrMgn' => '26',
  ),
)  
Sensor fetched value: 27  
YamlDiscovery: No variable available to replace ifName index: 4096.0.1.1  
DSL  SNR: Cur 27, Low: 6, Low Warn: 10, Warn: 98, High: 99
Discover sensor: .1.3.6.1.2.1.10.48.1.5.1.2.4096.0.1.1, snr-4096.0.1.1, weos, DSL  SNR, snmp, 1, 1, , 27, (limits: LL: 6, LW: 10, W: 98, H: 99), rrd_type = GAUGE  
SQL[SELECT COUNT(sensor_id) FROM `sensors` WHERE `poller_type`= ? AND `sensor_class` = ? AND `device_id` = ? AND sensor_type = ? AND `sensor_index` = ? ["snmp","snr",3,"weos","snr-4096.0.1.1"] 0.23ms] 
  
SQL[INSERT IGNORE INTO `sensors` (`poller_type`,`sensor_class`,`device_id`,`sensor_oid`,`sensor_index`,`sensor_type`,`sensor_descr`,`sensor_divisor`,`sensor_multiplier`,`sensor_limit`,`sensor_limit_warn`,`sensor_limit_low`,`sensor_limit_low_warn`,`sensor_current`,`entPhysicalIndex`,`entPhysicalIndex_measured`,`user_func`,`group`,`rrd_type`)  VALUES (:poller_type,:sensor_class,:device_id,:sensor_oid,:sensor_index,:sensor_type,:sensor_descr,:sensor_divisor,:sensor_multiplier,:sensor_limit,:sensor_limit_warn,:sensor_limit_low,:sensor_limit_low_warn,:sensor_current,:entPhysicalIndex,:entPhysicalIndex_measured,:user_func,:group,:rrd_type) {"poller_type":"snmp","sensor_class":"snr","device_id":3,"sensor_oid":".1.3.6.1.2.1.10.48.1.5.1.2.4096.0.1.1","sensor_index":"snr-4096.0.1.1","sensor_type":"weos","sensor_descr":"DSL  SNR","sensor_divisor":1,"sensor_multiplier":1,"sensor_limit":99,"sensor_limit_warn":98,"sensor_limit_low":6,"sensor_limit_low_warn":10,"sensor_current":27,"entPhysicalIndex":null,"entPhysicalIndex_measured":null,"user_func":null,"group":null,"rrd_type":"GAUGE"} 0.24ms] 
  
( 73 inserted )  
+SQL[insert into `eventlog` (`reference`, `type`, `datetime`, `severity`, `message`, `username`, `device_id`) values (?, ?, ?, ?, ?, ?, ?) ["73","sensor","2024-02-08 14:09:35",3,"Sensor Added: snr weos snr-4096.0.1.1 DSL  SNR","",3] 0.18ms] 
  
Sensor fetched value: 26  
YamlDiscovery: No variable available to replace ifName index: 4097.1.1.1  
DSL  SNR: Cur 26, Low: 6, Low Warn: 10, Warn: 98, High: 99
Discover sensor: .1.3.6.1.2.1.10.48.1.5.1.2.4097.1.1.1, snr-4097.1.1.1, weos, DSL  SNR, snmp, 1, 1, , 26, (limits: LL: 6, LW: 10, W: 98, H: 99), rrd_type = GAUGE  
SQL[SELECT COUNT(sensor_id) FROM `sensors` WHERE `poller_type`= ? AND `sensor_class` = ? AND `device_id` = ? AND sensor_type = ? AND `sensor_index` = ? ["snmp","snr",3,"weos","snr-4097.1.1.1"] 0.24ms] 
  
SQL[INSERT IGNORE INTO `sensors` (`poller_type`,`sensor_class`,`device_id`,`sensor_oid`,`sensor_index`,`sensor_type`,`sensor_descr`,`sensor_divisor`,`sensor_multiplier`,`sensor_limit`,`sensor_limit_warn`,`sensor_limit_low`,`sensor_limit_low_warn`,`sensor_current`,`entPhysicalIndex`,`entPhysicalIndex_measured`,`user_func`,`group`,`rrd_type`)  VALUES (:poller_type,:sensor_class,:device_id,:sensor_oid,:sensor_index,:sensor_type,:sensor_descr,:sensor_divisor,:sensor_multiplier,:sensor_limit,:sensor_limit_warn,:sensor_limit_low,:sensor_limit_low_warn,:sensor_current,:entPhysicalIndex,:entPhysicalIndex_measured,:user_func,:group,:rrd_type) {"poller_type":"snmp","sensor_class":"snr","device_id":3,"sensor_oid":".1.3.6.1.2.1.10.48.1.5.1.2.4097.1.1.1","sensor_index":"snr-4097.1.1.1","sensor_type":"weos","sensor_descr":"DSL  SNR","sensor_divisor":1,"sensor_multiplier":1,"sensor_limit":99,"sensor_limit_warn":98,"sensor_limit_low":6,"sensor_limit_low_warn":10,"sensor_current":26,"entPhysicalIndex":null,"entPhysicalIndex_measured":null,"user_func":null,"group":null,"rrd_type":"GAUGE"} 0.22ms] 
  
( 74 inserted )  
+SQL[insert into `eventlog` (`reference`, `type`, `datetime`, `severity`, `message`, `username`, `device_id`) values (?, ?, ?, ?, ?, ?, ?) ["74","sensor","2024-02-08 14:09:35",3,"Sensor Added: snr weos snr-4097.1.1.1 DSL  SNR","",3] 0.15ms] 

OSIRIS-REx avatar Feb 08 '24 15:02 OSIRIS-REx

Unfortunately the index for the sensor you want to use ifName in is 4096.0.0.1 as an example, the ifIndex for the ifName would be 4096.

I'm not sure how you can fix that I'm afraid.

laf avatar Feb 17 '24 16:02 laf

Unfortunately the index for the sensor you want to use ifName in is 4096.0.0.1 as an example, the ifIndex for the ifName would be 4096.

I'm not sure how you can fix that I'm afraid.

I am almost sure there is a way. Could you try {{ $ifName:0 }} @OSIRIS-REx ?

PipoCanaja avatar Feb 17 '24 16:02 PipoCanaja

Unfortunately the index for the sensor you want to use ifName in is 4096.0.0.1 as an example, the ifIndex for the ifName would be 4096. I'm not sure how you can fix that I'm afraid.

I am almost sure there is a way. Could you try {{ $ifName:0 }} @OSIRIS-REx ?

{{ $ifName:0 }} works perfect, thank you! That was almost too easy, haha. I have pushed the new commit together with new test data.

image

OSIRIS-REx avatar Feb 18 '24 00:02 OSIRIS-REx

Hi @OSIRIS-REx This PR looks good, once the good_if thing will be clarified.

PipoCanaja avatar Feb 18 '24 22:02 PipoCanaja

This pull request has been mentioned on LibreNMS Community. There might be relevant details there:

https://community.librenms.org/t/24-4-0-changelog/24157/1

librenms-bot avatar Apr 20 '24 01:04 librenms-bot