* @author PipoCanaja */ $prefixes = [ 'pSlot1' => '.1.3.6.1.4.1.994.3.4.7.18.1.66.', 'pSlot2' => '.1.3.6.1.4.1.994.3.4.7.19.1.66.', 'pSlot3' => '.1.3.6.1.4.1.994.3.4.7.20.1.66.', 'pSlot4' => '.1.3.6.1.4.1.994.3.4.7.21.1.66.', 'pSlot5' => '.1.3.6.1.4.1.994.3.4.7.22.1.66.', 'pSlot6' => '.1.3.6.1.4.1.994.3.4.7.23.1.66.', 'pOnboardSensor' => '.1.3.6.1.4.1.994.3.4.7.6.1.66.', ]; foreach ($prefixes as $prefix => $numOidPrefix) { $walk = snmpwalk_cache_oid($device, $prefix . 'Table', [], 'WEBMON-EDGE-MATRIX-MIB'); foreach ($walk as $index => $oid) { $user_function = null; if ($oid[$prefix . 'Configured'] != '0' && ($oid[$prefix . 'SensorType'] == '1' || $oid[$prefix . 'SensorType'] == 'temperature') && $oid[$prefix . 'LiveRaw']) { $num_oid = $numOidPrefix . $index; $descr = $oid[$prefix . 'Description']; $group = $prefix; $value = $oid[$prefix . 'LiveRaw']; $lowLimit = $oid[$prefix . 'Thresh4']; $lowWarnLimit = $oid[$prefix . 'Thresh3']; $highLimit = $oid[$prefix . 'Thresh1']; $highWarnLimit = $oid[$prefix . 'Thresh2']; if ($oid[$prefix . 'Units'] == "Fahrenheit") { $user_function = 'fahrenheit_to_celsius'; $value = fahrenheit_to_celsius($value); $lowLimit = fahrenheit_to_celsius($lowLimit); $lowWarnLimit = fahrenheit_to_celsius($lowWarnLimit); $highLimit = fahrenheit_to_celsius($highLimit); $highWarnLimit = fahrenheit_to_celsius($highWarnLimit); } discover_sensor($valid['sensor'], 'temperature', $device, $num_oid, $prefix . 'LiveRaw.' . $index, 'webmon', $descr, '1', '1', $lowLimit, $lowWarnLimit, $highWarnLimit, $highLimit, $value, 'snmp', null, null, $user_function, $group); } } }