$entry) { // Skip all non-dom entries if (!isset($entry['rlPhyTestTableTransceiverTemp']) || $entry['rlPhyTestTableTransceiverTemp']['rlPhyTestGetResult'] == 0) { continue; } $new_oids[$index] = $entry; } if (count($new_oids) === 0) { // Stop walk if not exist DOM sensors return; } // Get additional OIDs $oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetUnits', $oids, $mib); $oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetStatus', $oids, $mib); print_debug_vars($oids); foreach ($new_oids as $ifIndex => $entry1) { foreach ($oids[$ifIndex] as $oid_name => $entry) { if (!in_array($entry['rlPhyTestGetStatus'], ['success', 'inProgress'])) { continue; } if (str_starts_with($entry['rlPhyTestGetUnits'], 'micro')) { $scale = si_to_scale('micro'); } elseif (str_starts_with($entry['rlPhyTestGetUnits'], 'mili')) { $scale = si_to_scale('milli'); } elseif (str_starts_with($entry['rlPhyTestGetUnits'], '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']; switch ($oid_name) { case 'rlPhyTestTableTransceiverTemp': $descr = $name . " Temperature"; $index = $ifIndex . '.5'; $oid = "$oid_base.1.2.1.3.$index"; $class = 'temperature'; break; case 'rlPhyTestTableTransceiverSupply': $descr = $name . " Voltage"; $index = $ifIndex . '.6'; $oid = "$oid_base.1.2.1.3.$index"; $class = 'voltage'; break; case 'rlPhyTestTableTxBias': $descr = $name . " Tx Bias"; $index = $ifIndex . '.7'; $oid = "$oid_base.1.2.1.3.$index"; $class = 'current'; break; case 'rlPhyTestTableTxOutput': $descr = $name . " TX Power"; $index = $ifIndex . '.8'; $oid = "$oid_base.1.2.1.3.$index"; $class = 'dbm'; break; case 'rlPhyTestTableRxOpticalPower': $descr = $name . " RX Power"; $index = $ifIndex . '.9'; $oid = "$oid_base.1.2.1.3.$index"; $class = 'dbm'; break; default: continue 2; } $value = $entry['rlPhyTestGetResult']; discover_sensor_ng($device, $class, $mib, 'rlPhyTestGetResult', $oid, $index, $descr, $scale, $value, $options); } } // EOF