Fix EdgeOS hardware detection (#13629)

* Fix EdgeOS hardware detection

* Add EdgeRouter Lite test data
This commit is contained in:
johnstruse
2021-12-20 03:19:07 -05:00
committed by GitHub
parent bb9abd67d6
commit b84e471587
3 changed files with 131 additions and 3 deletions

View File

@@ -33,9 +33,12 @@ class Edgeos extends \LibreNMS\OS
{
parent::discoverOS($device); // yaml
$hw = implode(PHP_EOL, snmp_get_multi_oid($this->getDeviceArray(), ['.1.3.6.1.2.1.25.4.2.1.5.3818', '.1.3.6.1.2.1.25.4.2.1.5.3819'], '-Ovq'));
if (preg_match('/(?<=UBNT )(.*)(?= running on)/', $hw, $matches)) {
$this->getDevice()->hardware = $matches[0];
$hw = snmpwalk_cache_oid($this->getDeviceArray(), 'hrSWRunParameters', [], 'HOST-RESOURCES-MIB');
foreach ($hw as $entry) {
if (preg_match('/(?<=UBNT )(.*)(?= running on)/', $entry['hrSWRunParameters'], $matches)) {
$this->getDevice()->hardware = $matches[0];
break;
}
}
}
}

View File

@@ -0,0 +1,23 @@
{
"os": {
"discovery": {
"devices": [
{
"sysName": null,
"sysObjectID": ".1.3.6.1.4.1.41112.1.5",
"sysDescr": "EdgeRouter Lite",
"sysContact": "<private>",
"version": null,
"hardware": "EdgeRouter Lite 3-Port",
"features": null,
"os": "edgeos",
"type": "network",
"serial": null,
"icon": "edgeos.svg",
"location": "<private>"
}
]
},
"poller": "matches discovery"
}
}

View File

@@ -1,2 +1,104 @@
1.3.6.1.2.1.1.1.0|4|EdgeRouter Lite
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.41112.1.5
1.3.6.1.2.1.1.4.0|4|<private>
1.3.6.1.2.1.1.6.0|4|<private>
1.3.6.1.2.1.25.4.2.1.5.1|4|bootoctlinux $loadaddr
1.3.6.1.2.1.25.4.2.1.5.2|4|
1.3.6.1.2.1.25.4.2.1.5.3|4|
1.3.6.1.2.1.25.4.2.1.5.5|4|
1.3.6.1.2.1.25.4.2.1.5.7|4|
1.3.6.1.2.1.25.4.2.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2.1.5.73|4|
1.3.6.1.2.1.25.4.2.1.5.74|4|
1.3.6.1.2.1.25.4.2.1.5.75|4|
1.3.6.1.2.1.25.4.2.1.5.76|4|
1.3.6.1.2.1.25.4.2.1.5.77|4|
1.3.6.1.2.1.25.4.2.1.5.78|4|
1.3.6.1.2.1.25.4.2.1.5.96|4|
1.3.6.1.2.1.25.4.2.1.5.114|4|
1.3.6.1.2.1.25.4.2.1.5.149|4|
1.3.6.1.2.1.25.4.2.1.5.170|4|-f
1.3.6.1.2.1.25.4.2.1.5.171|4|-f
1.3.6.1.2.1.25.4.2.1.5.172|4|--system --address=systemd: --nofork --nopidfile --systemd-activation
1.3.6.1.2.1.25.4.2.1.5.175|4|
1.3.6.1.2.1.25.4.2.1.5.357|4|-p /var/run/ntpd.pid -g -u 103:109
1.3.6.1.2.1.25.4.2.1.5.462|4|--rng-device=/dev/hwrng
1.3.6.1.2.1.25.4.2.1.5.479|4|
1.3.6.1.2.1.25.4.2.1.5.485|4|
1.3.6.1.2.1.25.4.2.1.5.486|4|
1.3.6.1.2.1.25.4.2.1.5.536|4|
1.3.6.1.2.1.25.4.2.1.5.554|4|-d
1.3.6.1.2.1.25.4.2.1.5.576|4|-d -P 0
1.3.6.1.2.1.25.4.2.1.5.708|4|-d -P 0
1.3.6.1.2.1.25.4.2.1.5.822|4|-6 -nw -cf /var/run/dhclient_v6_eth0.conf -pf /var/run/dhclient_v6_eth0.pid -lf /var/run/dhclient_v6_eth0.leases eth0
1.3.6.1.2.1.25.4.2.1.5.2808|4|-d -P 0
1.3.6.1.2.1.25.4.2.1.5.3564|4|-p 55523 -b 127.0.0.101
1.3.6.1.2.1.25.4.2.1.5.3576|4|-D -f /etc/lighttpd/lighttpd.conf
1.3.6.1.2.1.25.4.2.1.5.3591|4|/var/www/python/gui.py
1.3.6.1.2.1.25.4.2.1.5.3876|4|eth1 eth1.101 -p /var/run/mdns-repeater.pid
1.3.6.1.2.1.25.4.2.1.5.3917|4|-LS6d -Lf /dev/null -u Debian-snmp -g Debian-snmp -f -p /run/snmpd.pid
1.3.6.1.2.1.25.4.2.1.5.3939|4|-H 0 -M4 -S UBNT EdgeRouter Lite 3-Port running on v2.0.9-hotfix.2.5402463.210511.1317 -I *,!eth0,!eth2
1.3.6.1.2.1.25.4.2.1.5.3940|4|-H 0 -M4 -S UBNT EdgeRouter Lite 3-Port running on v2.0.9-hotfix.2.5402463.210511.1317 -I *,!eth0,!eth2
1.3.6.1.2.1.25.4.2.1.5.4024|4|--logmethod stderr_clean
1.3.6.1.2.1.25.4.2.1.5.4025|4|--logmethod stderr_clean
1.3.6.1.2.1.25.4.2.1.5.4099|4|--keep-baud 115200,38400,9600 ttyS0 vt220
1.3.6.1.2.1.25.4.2.1.5.4102|4|-D -p 22 -o Protocol=2
1.3.6.1.2.1.25.4.2.1.5.4110|4|-P -p /var/run/netplugd.pid
1.3.6.1.2.1.25.4.2.1.5.4814|4|-pf /var/run/dhcpd.pid -cf /opt/vyatta/etc/dhcpd.conf -lf /var/run/dhcpd.leases
1.3.6.1.2.1.25.4.2.1.5.5247|4|-x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service
1.3.6.1.2.1.25.4.2.1.5.8629|4|-f
1.3.6.1.2.1.25.4.2.1.5.8665|4|
1.3.6.1.2.1.25.4.2.1.5.15198|4|
1.3.6.1.2.1.25.4.2.1.5.22504|4|-n -iNONE
1.3.6.1.2.1.25.4.2.1.5.23238|4|stats
1.3.6.1.2.1.25.4.2.1.5.23247|4|
1.3.6.1.2.1.25.4.2.1.5.23378|4|
1.3.6.1.2.1.25.4.2.1.5.25605|4|
1.3.6.1.2.1.25.4.2.1.5.27055|4|
1.3.6.1.2.1.25.4.2.1.5.27610|4|--user
1.3.6.1.2.1.25.4.2.1.5.27613|4|
1.3.6.1.2.1.25.4.2.1.5.28412|4|
1.3.6.1.2.1.25.4.2.1.5.29329|4|
1.3.6.1.2.1.25.4.2.1.5.29723|4|
1.3.6.1.2.1.25.4.2.1.5.29727|4|
1.3.6.1.2.1.25.4.2.1.5.29849|4|
1.3.6.1.2.1.25.4.2.1.5.29858|4|
1.3.6.1.2.1.25.4.2.1.5.32556|4|
1.3.6.1.2.1.25.4.2.1.5.32739|4|-q -nw -cf /var/run/dhclient_eth0.conf -pf /var/run/dhclient_eth0.pid -lf /var/run/dhclient_eth0.leases eth0