$entry) { [, $cyan_index] = explode("-", $entry['ifName'], 2); $cyan_index = str_replace("-", ".", $cyan_index); if (is_array($data[$cyan_index])) { $port = get_port_by_ifIndex($device['device_id'], $ifIndex); $data[$cyan_index]['measured_entity'] = $port['port_id']; } } foreach ($data as $index => $entry) { $descr = "Transceiver " . str_replace(".", "-", $index); $options = []; if (isset($entry['measured_entity'])) { $options['measured_entity'] = $entry['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('current', $device, ".1.3.6.1.4.1.28533.5.30.140.1.1.1.43." . $index, $index, 'cyanXcvrTxBiasCurrent', $descr . " TX Bias", 0.001, $entry['cyanXcvrTxBiasCurrent'], $options); $options = []; if (isset($entry['measured_entity'])) { $options['measured_entity'] = $entry['measured_entity']; $options['measured_class'] = 'port'; } $options['limit_high'] = $entry['cyanXcvrTempHiAlrmThres'] * 0.001; $options['limit_low'] = $entry['cyanXcvrTempLoAlrmThres'] * 0.001; $options['warn_high'] = $entry['cyanXcvrTempHiWarnThres'] * 0.001; $options['warn_low'] = $entry['cyanXcvrTempHiWarnThres'] * 0.001; discover_sensor('temperature', $device, ".1.3.6.1.4.1.28533.5.30.140.1.1.1.42." . $index, $index, 'cyanXcvrTemperature', $descr, 0.001, $entry['cyanXcvrTemperature'], $options); $options = []; if (isset($entry['measured_entity'])) { $options['measured_entity'] = $entry['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('voltage', $device, ".1.3.6.1.4.1.28533.5.30.140.1.1.1.56." . $index, $index, 'cyanXcvrVccVoltage', $descr . " Vcc", 0.001, $entry['cyanXcvrVccVoltage'], $options); } // EOF