$entry) { if (!isset($entry['rlPhyTestTableTransceiverTemp']) || $entry['rlPhyTestTableTransceiverTemp']['rlPhyTestGetResult'] == 0) { continue; } // Skip all non-dom entries $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, 'CISCOSB-PHY-MIB'); $oids = snmpwalk_cache_twopart_oid($device, 'rlPhyTestGetStatus', $oids, 'CISCOSB-PHY-MIB'); //print_vars($oids); foreach ($new_oids as $index => $entry1) { foreach ($oids[$index] 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; } $options = ['entPhysicalIndex' => $index]; $port = get_port_by_index_cache($device['device_id'], $index); if (is_array($port)) { $entry['ifDescr'] = $port['ifDescr']; $options['measured_class'] = 'port'; $options['measured_entity'] = $port['port_id']; } else { $entry['ifDescr'] = snmp_get($device, "ifDescr." . $index, "-Oqv", "IF-MIB"); } switch ($oid_name) { case 'rlPhyTestTableTransceiverTemp': $descr = $entry['ifDescr'] . " Temperature"; $oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.5"; $class = 'temperature'; break; case 'rlPhyTestTableTransceiverSupply': $descr = $entry['ifDescr'] . " Voltage"; $oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.6"; $class = 'voltage'; break; case 'rlPhyTestTableTxBias': $descr = $entry['ifDescr'] . " Bias Current"; $oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.7"; $class = 'current'; break; case 'rlPhyTestTableTxOutput': $descr = $entry['ifDescr'] . " TX Power"; $oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.8"; $class = 'dbm'; break; case 'rlPhyTestTableRxOpticalPower': $descr = $entry['ifDescr'] . " RX Power"; $oid = ".1.3.6.1.4.1.9.6.1.101.90.1.2.1.3.$index.9"; $class = 'dbm'; break; default: continue 2; } $value = $entry['rlPhyTestGetResult']; discover_sensor_ng($device, $class, $mib, 'rlPhyTestGetResult', $oid, "$index.$oid_name", $descr, $scale, $value, $options); // Note, same rrd index format as in mibs definitions } } // EOF