Files
Neil LathwoodandTony Murray d4e8c54516 refactor: Tidy up sensor discovery (#5550)
* refactor: Tidy up sensor discovery

* more files

* removed uneeded files

* updated array check

* updates for linux/supermicro

* small changes

* Update linux.inc.php

* Add supermicro temps back to linux.inc.php

* No need for is_file on rfc1628.inc.php, it exists

* Revert rfc1628 change

* Fix whitespace...

* rebased

* fixed $valid data not being passed to new sensors() function
2017-02-03 06:39:38 -06:00

43 lines
1.4 KiB
PHP

<?php
$cambium_type = snmp_get($device, 'sysDescr.0', '-Oqv', '');
$divisor = 1;
if (strstr($cambium_type, 'BHUL450')) {
$masterSlaveMode = snmp_get($device, 'bhTimingMode.0', '-Oqv', 'WHISP-BOX-MIBV2-MIB');
if ($masterSlaveMode == "timingMaster") {
$oid = '.1.3.6.1.4.1.17713.21.1.2.3.2';
$mib = 'WHISP-APS-MIB';
} else {
$oid = '.1.3.6.1.4.1.161.19.3.2.2.21.0';
$mib = 'WHISP-SM-MIB';
}
} elseif (strstr($cambium_type, 'BHUL') || strstr($cambium_type, 'BH')) {
$masterSlaveMode = snmp_get($device, 'bhTimingMode.0', '-Oqv', 'WHISP-BOX-MIBV2-MIB');
if ($masterSlaveMode == "timingMaster") {
$oid = '.1.3.6.1.4.1.17713.21.1.2.3.2';
$mib = 'WHISP-APS-MIB';
} else {
$oid = '.1.3.6.1.4.1.161.19.3.2.2.21.0';
$mib = 'WHISP-BOX-MIBV2-MIB';
}
} else {
$oid = '.1.3.6.1.4.1.161.19.3.2.2.21.0';
$mib = 'WHISP-BOX-MIBV2-MIB';
}
$oids = trim(str_replace('"', '', snmp_get($device, "$oid", '-OsqnU', $mib)));
d_echo($oids."\n");
if (!empty($oids)) {
echo 'Canopy Signal ';
}
$type = 'canopy';
if (!empty($oids)) {
list(,$current) = explode(' ', $oids);
$current = $current / $divisor;
$index = $oid;
$descr = 'Signal';
discover_sensor($valid['sensor'], 'signal', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $current);
}