$entry) { $entry['index'] = $index; $match = ['measured_match' => ['entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%index%']]; $options = entity_measured_match_definition($device, $match, $entry); $name = $options['port_label']; // Temperature $descr = $name . ' Temperature'; $class = 'temperature'; $oid_name = 'ddmTemperature'; $oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.2.' . $index; $scale = 1; $value = $entry[$oid_name]; $limits = [ 'limit_high' => $oids_limit[$index]['temperature']['ddmHighAlarm'], 'limit_low' => $oids_limit[$index]['temperature']['ddmLowAlarm'], 'limit_high_warn' => $oids_limit[$index]['temperature']['ddmHighWarning'], 'limit_low_warn' => $oids_limit[$index]['temperature']['ddmLowWarning'] ]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits)); // Voltage $descr = $name . ' Voltage'; $class = 'voltage'; $oid_name = 'ddmVoltage'; $oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.3.' . $index; $scale = 1; $value = $entry[$oid_name]; $limits = [ 'limit_high' => $oids_limit[$index]['voltage']['ddmHighAlarm'], 'limit_low' => $oids_limit[$index]['voltage']['ddmLowAlarm'], 'limit_high_warn' => $oids_limit[$index]['voltage']['ddmHighWarning'], 'limit_low_warn' => $oids_limit[$index]['voltage']['ddmLowWarning'] ]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits)); // Tx Bias $descr = $name . ' Tx Bias'; $class = 'current'; $oid_name = 'ddmBiasCurrent'; $oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.4.' . $index; $scale = 0.001; $value = $entry[$oid_name]; $limits = [ 'limit_high' => $oids_limit[$index]['bias']['ddmHighAlarm'] * $scale, 'limit_low' => $oids_limit[$index]['bias']['ddmLowAlarm'] * $scale, 'limit_high_warn' => $oids_limit[$index]['bias']['ddmHighWarning'] * $scale, 'limit_low_warn' => $oids_limit[$index]['bias']['ddmLowWarning'] * $scale ]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits)); // Tx Power $descr = $name . ' Tx Power'; $class = $power_unit === 'mw' ? 'power' : 'dbm'; $oid_name = 'ddmTxPower'; $oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.5.' . $index; $scale = $power_unit === 'mw' ? 0.001 : 1; $value = $entry[$oid_name]; $limits = [ 'limit_high' => $oids_limit[$index]['txPower']['ddmHighAlarm'] * $scale, 'limit_low' => $oids_limit[$index]['txPower']['ddmLowAlarm'] * $scale, 'limit_high_warn' => $oids_limit[$index]['txPower']['ddmHighWarning'] * $scale, 'limit_low_warn' => $oids_limit[$index]['txPower']['ddmLowWarning'] * $scale ]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits)); // Rx Power $descr = $name . ' Rx Power'; $class = $power_unit === 'mw' ? 'power' : 'dbm'; $oid_name = 'ddmRxPower'; $oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.6.' . $index; $scale = $power_unit === 'mw' ? 0.001 : 1; $value = $entry[$oid_name]; $limits = [ 'limit_high' => $oids_limit[$index]['rxPower']['ddmHighAlarm'] * $scale, 'limit_low' => $oids_limit[$index]['rxPower']['ddmLowAlarm'] * $scale, 'limit_high_warn' => $oids_limit[$index]['rxPower']['ddmHighWarning'] * $scale, 'limit_low_warn' => $oids_limit[$index]['rxPower']['ddmLowWarning'] * $scale ]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, NULL, $descr, $scale, $value, array_merge($options, $limits)); } // EOF