From 49f206f58ebb3c4c6a9c4db4ff5350ba2e1f8e6e Mon Sep 17 00:00:00 2001 From: Martijn Schmidt Date: Mon, 4 Feb 2019 15:55:31 +0100 Subject: [PATCH] Fix regression in VC hardware detection for JunOS (#9772) PR #9546 has resulted in Platform being detected as "Juniper Virtual Chassis Switch" when a set of devices is stacked. Hence, no more possibility to see whether it is for example an EX2300 or EX3400 virtual-chassis. This commit falls back to using rewrite_junos_hardware() if the "Juniper Virtual Chassis Switch" string is detected in boxDescr, resulting in usable hardware data. Caveat - it's possible to build a virtual-chassis of multiple switch models, but only for higher end hardware: https://www.juniper.net/documentation/en_US/junos/topics/concept/virtual-chassis-ex4200-overview.html#jd0e75 Example SNMP output: mschmidt@nlrtm1-librenms1:~$ snmpwalk -v2c -cremoved -m JUNIPER-MIB -M /opt/librenms/mibs hostname jnxBoxDescr JUNIPER-MIB::jnxBoxDescr.0 = STRING: Juniper Virtual Chassis Switch Also reported previously via the community forums: https://community.librenms.org/t/pr-9546-results-in-junos-platform-detection-quirks-in-combination-with-virtual-chassis/6537 --- includes/discovery/functions.inc.php | 2 +- includes/polling/os/junos.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index e09d211928..ec98cf4b0b 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -1097,7 +1097,7 @@ function discovery_process(&$valid, $device, $sensor_type, $pre_cache) $sensor_name = $data['state_name'] ?: $data['oid']; create_state_index($sensor_name, $data['states']); } else { - // We default to 1 for both divisors / multipler so it should be safe to do the calculation using both. + // We default to 1 for both divisors / multipliers so it should be safe to do the calculation using both. $value = ($value / $divisor) * $multiplier; } diff --git a/includes/polling/os/junos.inc.php b/includes/polling/os/junos.inc.php index 2799820331..bc6a0137e5 100644 --- a/includes/polling/os/junos.inc.php +++ b/includes/polling/os/junos.inc.php @@ -35,7 +35,7 @@ if (strpos($device['sysDescr'], 'olive')) { $serial = ''; } else { $boxDescr = snmp_get($device, 'jnxBoxDescr.0', '-Oqv', 'JUNIPER-MIB'); - if (!empty($boxDescr)) { + if (!empty($boxDescr) && $boxDescr != "Juniper Virtual Chassis Switch") { $hardware = $boxDescr; } else { $hardware = snmp_translate($device['sysObjectID'], 'Juniper-Products-MIB:JUNIPER-CHASSIS-DEFINES-MIB', 'junos');