Tony Murray 0d07f85257 feature: Allow snmpget in os discovery yaml (#7587)
* feature: Allow snmpget in os discovery yaml

Re-submit after release

* Remove extra trim in discovery and in snmp_get.
also trim() always returns a string, so is_string() check is a waste of cpu cycles.
2017-11-02 12:41:18 +00:00

15 lines
631 B
PHP

<?php
if (starts_with($sysDescr, 'Linux') || starts_with($sysObjectId, '.1.3.6.1.4.1.8072.3.2.10')) {
if (starts_with($sysObjectId, array('.1.3.6.1.4.1.10002.1', '.1.3.6.1.4.1.41112.1.4'))
|| str_contains(snmp_walk($device, 'dot11manufacturerName', '-Osqnv', 'IEEE802dot11-MIB'), 'Ubiquiti')
) {
$os = 'airos';
if (str_contains(snmp_walk($device, 'dot11manufacturerProductName', '-Osqnv', 'IEEE802dot11-MIB'), 'UAP')) {
$os = 'unifi';
} elseif (snmp_get($device, 'fwVersion.1', '-Osqnv', 'UBNT-AirFIBER-MIB', 'ubnt') !== false) {
$os = 'airos-af';
}
}
}