newdevice: Support Avtech RoomAlert 32E/W and RoomAlert 11E (#7614)

* newdevice: support Avtech RoomAlert 32E/W
Move avtech discovery to yaml, took a bit of trickery

* More flexibility when checking pre-cached data
A little cleanup

* Add support for RoomAlert 32E/W external and wish temp sensors
Add RoomAlert 11E support (just temp sensors)
Updated ROOMALERT32E-MIB
This commit is contained in:
Tony Murray
2017-11-04 16:25:13 -05:00
committed by Neil Lathwood
parent 5b42044d04
commit 3dba5cd39d
9 changed files with 473 additions and 1083 deletions

View File

@@ -12,24 +12,19 @@ if (is_file($pre_cache_file)) {
d_echo($pre_cache);
}
if (isset($device['dynamic_discovery']['modules']['sensors'])) {
// TODO change to exclude os with pre-cache php file, but just exclude them by hand for now (like avtech)
if (isset($device['dynamic_discovery']['modules']['sensors']) && $device['os'] != 'avtech') {
foreach ($device['dynamic_discovery']['modules']['sensors'] as $key => $data_array) {
foreach ($data_array['data'] as $data) {
foreach ((array)$data['oid'] as $oid) {
$tmp_name = $oid;
if (!isset($pre_cache[$tmp_name])) {
if (!isset($pre_cache[$oid])) {
if (isset($data['snmp_flags'])) {
$snmp_flag = $data['snmp_flags'];
} else {
$snmp_flag = '-OeQUs';
}
$snmp_flag .= ' -Ih';
if ($key === 'pre-cache') {
$array_data = '__cached';
} else {
$array_data = $tmp_name;
}
$pre_cache[$array_data] = snmpwalk_cache_oid($device, $oid, $pre_cache[$array_data], $device['dynamic_discovery']['mib'], null, $snmp_flag);
$pre_cache[$oid] = snmpwalk_cache_oid($device, $oid, $pre_cache[$array_data], $device['dynamic_discovery']['mib'], null, $snmp_flag);
}
}
}