$info) { if ($info['eltexPhyTransceiverInfoConnectorType'] === 'unknown' || $info['eltexPhyTransceiverInfoType'] === 'unknown' || !isset($oids[$ifIndex])) { print_debug("DOM sensors for ifIndex $ifIndex not exist."); continue; } foreach ($oids[$ifIndex] as $phyTransceiverDiagnosticType => $entries) { $multilane = safe_count($entries) > 1; foreach ($entries as $lane => $entry) { // scale (all possible units unknown) if (str_starts_with($entry['eltexPhyTransceiverDiagnosticUnits'], 'milli')) { $scale = si_to_scale('milli'); } elseif (str_starts_with($entry['eltexPhyTransceiverDiagnosticUnits'], 'micro')) { $scale = si_to_scale('micro'); } elseif (str_starts_with($entry['eltexPhyTransceiverDiagnosticUnits'], 'deci')) { $scale = si_to_scale('deci'); } else { $scale = 1; } $entry['ifIndex'] = $ifIndex; $match = [ 'measured_match' => [ 'entity_type' => 'port', 'field' => 'ifIndex', 'match' => '%ifIndex%' ] ]; $options = entity_measured_match_definition($device, $match, $entry); //print_debug_vars($options); $name = $options['port_label']; if ($multilane) { $name .= " Lane " . $lane; } switch ($phyTransceiverDiagnosticType) { case 'temperature': $descr = $name . " Temperature"; $index = $ifIndex . '.1.' . $lane; $class = 'temperature'; // Limits $options['limit_high'] = $entry['eltexPhyTransceiverDiagnosticHighAlarmThreshold']; $options['limit_high_warn'] = $entry['eltexPhyTransceiverDiagnosticHighWarningThreshold']; $options['limit_low'] = $entry['eltexPhyTransceiverDiagnosticLowAlarmThreshold']; $options['limit_low_warn'] = $entry['eltexPhyTransceiverDiagnosticLowWarningThreshold']; break; case 'supplyVoltage': $descr = $name . " Voltage"; $index = $ifIndex . '.2.' . $lane; $class = 'voltage'; // Limits $options['limit_high'] = $entry['eltexPhyTransceiverDiagnosticHighAlarmThreshold'] * 0.001; $options['limit_high_warn'] = $entry['eltexPhyTransceiverDiagnosticHighWarningThreshold'] * 0.001; $options['limit_low'] = $entry['eltexPhyTransceiverDiagnosticLowAlarmThreshold'] * 0.001; $options['limit_low_warn'] = $entry['eltexPhyTransceiverDiagnosticLowWarningThreshold'] * 0.001; break; case 'txBiasCurrent': $descr = $name . " Tx Bias"; $index = $ifIndex . '.3.' . $lane; $class = 'current'; // Limits $options['limit_high'] = $entry['eltexPhyTransceiverDiagnosticHighAlarmThreshold'] * 0.000001; $options['limit_high_warn'] = $entry['eltexPhyTransceiverDiagnosticHighWarningThreshold'] * 0.000001; $options['limit_low'] = $entry['eltexPhyTransceiverDiagnosticLowAlarmThreshold'] * 0.000001; $options['limit_low_warn'] = $entry['eltexPhyTransceiverDiagnosticLowWarningThreshold'] * 0.000001; break; case 'txOpticalPower': $descr = $name . " TX Power"; $index = $ifIndex . '.4.' . $lane; $class = 'dbm'; // Limits $options['limit_unit'] = 'W'; // need unit conversion $options['limit_high'] = $entry['eltexPhyTransceiverDiagnosticHighAlarmThreshold'] * 0.000001; $options['limit_high_warn'] = $entry['eltexPhyTransceiverDiagnosticHighWarningThreshold'] * 0.000001; $options['limit_low'] = $entry['eltexPhyTransceiverDiagnosticLowAlarmThreshold'] * 0.000001; $options['limit_low_warn'] = $entry['eltexPhyTransceiverDiagnosticLowWarningThreshold'] * 0.000001; break; case 'rxOpticalPower': $descr = $name . " RX Power"; $index = $ifIndex . '.5.' . $lane; $class = 'dbm'; // Limits $options['limit_unit'] = 'W'; // need unit conversion $options['limit_high'] = $entry['eltexPhyTransceiverDiagnosticHighAlarmThreshold'] * 0.000001; $options['limit_high_warn'] = $entry['eltexPhyTransceiverDiagnosticHighWarningThreshold'] * 0.000001; $options['limit_low'] = $entry['eltexPhyTransceiverDiagnosticLowAlarmThreshold'] * 0.000001; $options['limit_low_warn'] = $entry['eltexPhyTransceiverDiagnosticLowWarningThreshold'] * 0.000001; break; default: continue 2; } $descr .= ' ('.$info['eltexPhyTransceiverInfoVendorName'].' '.$info['eltexPhyTransceiverInfoPartNumber'].')'; $oid_name = 'eltexPhyTransceiverDiagnosticCurrentValue'; $oid_num = '.1.3.6.1.4.1.35265.52.1.1.3.2.1.8.' . $index; $value = $entry[$oid_name]; discover_sensor_ng($device, $class, 'ELTEX-PHY-MIB', $oid_name, $oid_num, $index, $descr, $scale, $value, $options); } } } // EOF