$entry) { $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']; $part_name = ' (' . trim($entry['sfpVendorName'] . ' ' . $entry['sfpVendorPn']) . ')'; // Temperature $descr = $name . ' Temperature' . $part_name; $class = 'temperature'; $oid_name = 'ddmTemperature'; //$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.2.' . $index; $oid_num = snmp_translate($oid_name, $mib) . '.' . $index; $scale = 1; $value = $entry[$oid_name]; $limits = [ 'limit_high' => $oids_limit[$index]['temperature']['ddmHighAlarm'], 'limit_low' => $oids_limit[$index]['temperature']['ddmLowAlarm'], 'limit_high_warn' => $oids_limit[$index]['temperature']['ddmHighWarning'], 'limit_low_warn' => $oids_limit[$index]['temperature']['ddmLowWarning'] ]; if (empty(snmp_fix_numeric($value))) { // DGS-1210-28XME-BX::ddmTemperature.26 = STRING: // DGS-1210-28XME-BX::ddmTemperature.28 = STRING: +0.000 continue; } discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits)); // Voltage $descr = $name . ' Voltage' . $part_name; $class = 'voltage'; $oid_name = 'ddmVoltage'; //$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.3.' . $index; $oid_num = snmp_translate($oid_name, $mib) . '.' . $index; $scale = 1; $value = $entry[$oid_name]; $limits = [ 'limit_high' => $oids_limit[$index]['voltage']['ddmHighAlarm'], 'limit_low' => $oids_limit[$index]['voltage']['ddmLowAlarm'], 'limit_high_warn' => $oids_limit[$index]['voltage']['ddmHighWarning'], 'limit_low_warn' => $oids_limit[$index]['voltage']['ddmLowWarning'] ]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits)); // Tx Bias $descr = $name . ' Tx Bias' . $part_name; $class = 'current'; $oid_name = 'ddmBiasCurrent'; $oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.4.' . $index; $scale = 0.001; $value = $entry[$oid_name]; $limits = [ 'limit_high' => $oids_limit[$index]['bias']['ddmHighAlarm'] * $scale, 'limit_low' => $oids_limit[$index]['bias']['ddmLowAlarm'] * $scale, 'limit_high_warn' => $oids_limit[$index]['bias']['ddmHighWarning'] * $scale, 'limit_low_warn' => $oids_limit[$index]['bias']['ddmLowWarning'] * $scale ]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits)); // Tx Power $descr = $name . ' Tx Power' . $part_name; $class = $power_unit === 'mw' ? 'power' : 'dbm'; $oid_name = 'ddmTxPower'; //$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.5.' . $index; $oid_num = snmp_translate($oid_name, $mib) . '.' . $index; $scale = $power_unit === 'mw' ? 0.001 : 1; $value = $entry[$oid_name]; $limits = [ 'limit_high' => $oids_limit[$index]['txPower']['ddmHighAlarm'] * $scale, 'limit_low' => $oids_limit[$index]['txPower']['ddmLowAlarm'] * $scale, 'limit_high_warn' => $oids_limit[$index]['txPower']['ddmHighWarning'] * $scale, 'limit_low_warn' => $oids_limit[$index]['txPower']['ddmLowWarning'] * $scale ]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits)); // Rx Power $descr = $name . ' Rx Power' . $part_name; $class = $power_unit === 'mw' ? 'power' : 'dbm'; $oid_name = 'ddmRxPower'; //$oid_num = '.1.3.6.1.4.1.171.10.75.15.2.105.2.1.1.1.6.' . $index; $oid_num = snmp_translate($oid_name, $mib) . '.' . $index; $scale = $power_unit === 'mw' ? 0.001 : 1; $value = $entry[$oid_name]; $limits = [ 'limit_high' => $oids_limit[$index]['rxPower']['ddmHighAlarm'] * $scale, 'limit_low' => $oids_limit[$index]['rxPower']['ddmLowAlarm'] * $scale, 'limit_high_warn' => $oids_limit[$index]['rxPower']['ddmHighWarning'] * $scale, 'limit_low_warn' => $oids_limit[$index]['rxPower']['ddmLowWarning'] * $scale ]; discover_sensor_ng($device, $class, $mib, $oid_name, $oid_num, $index, $descr, $scale, $value, array_merge($options, $limits)); } // EOF