$entry) { if ($entry['adGenPluggablePortConnectorType'] === 'none') { // Not exist DDM continue; } $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']; $vendor_name = trim($entry['adGenPluggablePortVendorName'] . ' ' . $entry['adGenPluggablePortVendorPartNumber']); if ($entry['adGenPluggablePortVendorSerialNumber']) { $vendor_name .= ', SN:' . trim($entry['adGenPluggablePortVendorSerialNumber']); } if ($entry['adGenPluggablePortWavelength'] && $entry['adGenPluggablePortWavelength'] > 1) { $vendor_name .= ', ' . $entry['adGenPluggablePortWavelength'] . 'nm'; } // Temperature $descr = $name . ' Temperature'; if ($vendor_name) { $descr .= ' (' . $vendor_name . ')'; } $class = 'temperature'; $oid_name = 'adGenPluggablePortTemperature'; $oid_num = '.1.3.6.1.4.1.664.5.70.4.1.1.1.27.' . $index; $scale = str_starts_with($entry['adGenPluggablePortTemperatureUnits'], 'tenths') ? 0.1 : 1; $value = $entry[$oid_name]; $opt = []; if (str_ends_with($entry['adGenPluggablePortTemperatureUnits'], 'ahrenheit')) { // fahrenheit, tenthsFahrenheit $opt['sensor_unit'] = 'F'; } discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $opt)); // Voltage $descr = $name . ' Voltage'; if ($vendor_name) { $descr .= ' (' . $vendor_name . ')'; } $class = 'voltage'; $oid_name = 'adGenPluggablePortVoltage'; $oid_num = '.1.3.6.1.4.1.664.5.70.4.1.1.1.29.' . $index; $scale = 0.001; $value = $entry[$oid_name]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options); if (isset($entry['adGenPluggableNumberOfXcvrChannels'], $oids_lane[$index]) && $entry['adGenPluggableNumberOfXcvrChannels'] > 1) { // Multi Channel sensors // ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortChannelRxPower.25200001.1 = INTEGER: -35 // ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortChannelRxPowerUnits.25200001.1 = INTEGER: tenthsDBm(2) // ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortChannelTxPower.25200001.1 = INTEGER: -24 // ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortChannelTxPowerUnits.25200001.1 = INTEGER: tenthsDBm(2) // ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortChannelTxBias.25200001.1 = INTEGER: 20 // ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortChannelTxBiasUnits.25200001.1 = INTEGER: milliAmps(1) // ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortProvWaveLength.25200001 = INTEGER: 0 // ADTRAN-PLUGGABLE-PORT-MIB::adGenPluggablePortProvChannelNumber.25200001 = INTEGER: 0 foreach ($oids_lane[$index] as $lane => $lentry) { $lname = $name . ' Lane ' . $lane; $lindex = $index . '.' . $lane; // TX Bias $descr = $lname . ' TX Bias'; if ($vendor_name) { $descr .= ' (' . $vendor_name . ')'; } $class = 'current'; $oid_name = 'adGenPluggablePortChannelTxBias'; $oid_num = '.1.3.6.1.4.1.664.5.70.4.1.2.1.7.' . $lindex; $scale = 0.001; $value = $lentry[$oid_name]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $lindex, $descr, $scale, $value, $options); // TX Power $descr = $lname . ' TX Power'; if ($vendor_name) { $descr .= ' (' . $vendor_name . ')'; } // dBm, tenthsDBm, microWatts, tenthsMicroWatts if (str_contains($lentry['adGenPluggablePortChannelTxPowerUnits'], 'Watts')) { $class = 'power'; $scale = str_starts_with($lentry['adGenPluggablePortChannelTxPowerUnits'], 'tenths') ? 0.0000001 : 0.000001; } else { $class = 'dbm'; $scale = str_starts_with($lentry['adGenPluggablePortChannelTxPowerUnits'], 'tenths') ? 0.1 : 1; } $oid_name = 'adGenPluggablePortChannelTxPower'; $oid_num = '.1.3.6.1.4.1.664.5.70.4.1.2.1.5.' . $lindex; $value = $lentry[$oid_name]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $lindex, $descr, $scale, $value, $options); // RX Power $descr = $lname . ' RX Power'; if ($vendor_name) { $descr .= ' (' . $vendor_name . ')'; } // dBm, tenthsDBm, microWatts, tenthsMicroWatts if (str_contains($lentry['adGenPluggablePortChannelRxPowerUnits'], 'Watts')) { $class = 'power'; $scale = str_starts_with($lentry['adGenPluggablePortChannelRxPowerUnits'], 'tenths') ? 0.0000001 : 0.000001; } else { $class = 'dbm'; $scale = str_starts_with($lentry['adGenPluggablePortChannelRxPowerUnits'], 'tenths') ? 0.1 : 1; } $oid_name = 'adGenPluggablePortChannelRxPower'; $oid_num = '.1.3.6.1.4.1.664.5.70.4.1.2.1.3.' . $lindex; $value = $lentry[$oid_name]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $lindex, $descr, $scale, $value, $options); } } else { // TX Bias $descr = $name . ' TX Bias'; if ($vendor_name) { $descr .= ' (' . $vendor_name . ')'; } $class = 'current'; $oid_name = 'adGenPluggablePortTxBias'; $oid_num = '.1.3.6.1.4.1.664.5.70.4.1.1.1.25.' . $index; $scale = 0.001; $value = $entry[$oid_name]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options); // TX Power $descr = $name . ' TX Power'; if ($vendor_name) { $descr .= ' (' . $vendor_name . ')'; } // dBm, tenthsDBm, microWatts, tenthsMicroWatts if (str_contains($entry['adGenPluggablePortTxPowerUnits'], 'Watts')) { $class = 'power'; $scale = str_starts_with($entry['adGenPluggablePortTxPowerUnits'], 'tenths') ? 0.0000001 : 0.000001; } else { $class = 'dbm'; $scale = str_starts_with($entry['adGenPluggablePortTxPowerUnits'], 'tenths') ? 0.1 : 1; } $oid_name = 'adGenPluggablePortTxPower'; $oid_num = '.1.3.6.1.4.1.664.5.70.4.1.1.1.23.' . $index; $value = $entry[$oid_name]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options); // RX Power $descr = $name . ' RX Power'; if ($vendor_name) { $descr .= ' (' . $vendor_name . ')'; } // dBm, tenthsDBm, microWatts, tenthsMicroWatts if (str_contains($entry['adGenPluggablePortRxPowerUnits'], 'Watts')) { $class = 'power'; $scale = str_starts_with($entry['adGenPluggablePortRxPowerUnits'], 'tenths') ? 0.0000001 : 0.000001; } else { $class = 'dbm'; $scale = str_starts_with($entry['adGenPluggablePortRxPowerUnits'], 'tenths') ? 0.1 : 1; } $oid_name = 'adGenPluggablePortRxPower'; $oid_num = '.1.3.6.1.4.1.664.5.70.4.1.1.1.21.' . $index; $value = $entry[$oid_name]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, $options); } } // EOF