$entry) { [, $cyan_index] = explode("-", $entry['ifName'], 2); if ($port = get_port_by_ifIndex($device['device_id'], $ifIndex)) { $port_translates[$cyan_index]['measured_entity'] = $port['port_id']; } } foreach ($data as $index => $entry) { [$shelf_id, $mod_id, $xcvr_id, $port_id] = explode(".", $index); $descr = "Transceiver " . $shelf_id . "-" . $mod_id . "-" . $xcvr_id . " (" . $port_id . ")"; $xcvr_string = $shelf_id . "-" . $mod_id . "-" . $xcvr_id; $options = []; if (isset($port_translates[$xcvr_string]['measured_entity'])) { $options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity']; $options['measured_class'] = 'port'; } // $options['limit_high'] = $entry['cyanXcvrTxBiasHiAlrmThres'] * 0.001; // $options['limit_low'] = $entry['cyanXcvrTxBiasLoAlrmThres'] * 0.001; // $options['warn_high'] = $entry['cyanXcvrTxBiasHiWarnThres'] * 0.001; // $options['warn_low'] = $entry['cyanXcvrTxBiasHiWarnThres'] * 0.001; discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.150.1.1.1.18." . $index, $index, 'cyanTENGPortTxPwr', $descr . " TX Power", 0.001, $entry['cyanTENGPortTxPwr'], $options); $options = []; if (isset($port_translates[$xcvr_string]['measured_entity'])) { $options['measured_entity'] = $port_translates[$xcvr_string]['measured_entity']; $options['measured_class'] = 'port'; } // $options['limit_high'] = $entry['cyanXcvrVccVoltHiAlrmThres'] * 0.001; // $options['limit_low'] = $entry['cyanXcvrVccVoltLoAlrmThres'] * 0.001; // $options['warn_high'] = $entry['cyanXcvrVccVoltHiWarnThres'] * 0.001; // $options['warn_low'] = $entry['cyanXcvrVccVoltHiWarnThres'] * 0.001; discover_sensor('dbm', $device, ".1.3.6.1.4.1.28533.5.30.150.1.1.1.14." . $index, $index, 'cyanTENGPortRxPwr', $descr . " RX Power", 0.001, $entry['cyanTENGPortRxPwr'], $options); } unset($port_translates, $thresholds, $oids, $data, $entry, $index); // EOF