Index: includes/discovery/sensors/juniper-dom-mib.inc.php =================================================================== --- includes/discovery/sensors/juniper-dom-mib.inc.php (revision 8707) +++ includes/discovery/sensors/juniper-dom-mib.inc.php (working copy) @@ -34,9 +34,18 @@ 'jnxDomCurrentTxLaserOutputPowerHighAlarmThreshold', 'jnxDomCurrentTxLaserOutputPowerLowAlarmThreshold', 'jnxDomCurrentTxLaserOutputPowerHighWarningThreshold', - 'jnxDomCurrentTxLaserOutputPowerLowWarningThreshold' + 'jnxDomCurrentTxLaserOutputPowerLowWarningThreshold', + + 'jnxDomCurrentModuleLaneCount' ); +$jnxDomCurrentLaneTable_oids = array( + 'jnxDomCurrentLaneLaserTemperature', + 'jnxDomCurrentLaneTxLaserBiasCurrent', + 'jnxDomCurrentLaneRxLaserPower', + 'jnxDomCurrentLaneTxLaserOutputPower', +); + $oids = array(); foreach ($jnxDomCurrentTable_oids as $oid) { @@ -44,6 +53,12 @@ } //$oids = snmpwalk_cache_oid($device, 'jnxDomCurrentEntry', array(), 'JUNIPER-DOM-MIB'); +$lane_oids = array(); +foreach ($jnxDomCurrentLaneTable_oids as $oid) +{ + $lane_oids = snmpwalk_cache_oid($device, $oid, $lane_oids, 'JUNIPER-DOM-MIB'); +} + foreach ($oids as $index => $entry) { @@ -59,6 +74,7 @@ $entry['ifDescr'] = snmp_get($device, "ifDescr.$index", '-Oqv', 'IF-MIB'); } + if ($entry['jnxDomCurrentModuleLaneCount'] == 1) { # jnxDomCurrentModuleTemperature[508] 35 # jnxDomCurrentModuleTemperatureHighAlarmThreshold[508] 100 # jnxDomCurrentModuleTemperatureLowAlarmThreshold[508] -25 @@ -132,6 +148,75 @@ 'limit_low_warn' => $entry['jnxDomCurrentTxLaserOutputPowerLowWarningThreshold'] * $scale); discover_sensor($valid['sensor'], 'dbm', $device, $oid_num, $index, $type, $descr, $scale, $value, array_merge($options, $limits)); + } else { // multilane optic + for ($i = 0; $i < $entry['jnxDomCurrentModuleLaneCount']; $i++) { + $lane_index = "{$index}.{$i}"; + + $descr = $entry['ifDescr'] . ":{$i} DOM"; + $oid_name = 'jnxDomCurrentLaneLaserTemperature'; + $oid_num = ".1.3.6.1.4.1.2636.3.60.1.2.1.1.9.{$lane_index}"; + $type = 'juniper-dom'; // $mib . '-' . $oid_name; + $scale = 1; + $value = $lane_oids[$lane_index][$oid_name]; + + $limits = array('limit_high' => $entry['jnxDomCurrentModuleTemperatureHighAlarmThreshold'], + 'limit_low' => $entry['jnxDomCurrentModuleTemperatureLowAlarmThreshold'], + 'limit_high_warn' => $entry['jnxDomCurrentModuleTemperatureHighWarningThreshold'], + 'limit_low_warn' => $entry['jnxDomCurrentModuleTemperatureLowWarningThreshold']); + + if ($value != 0) + { + discover_sensor($valid['sensor'], 'temperature', $device, $oid_num, $lane_index, $type, $descr, $scale, $value, array_merge($options, $limits)); + } + + // jnxDomCurrentTxLaserBiasCurrent + $descr = $entry['ifDescr'] . " {$i} TX Bias"; + $oid_name = 'jnxDomCurrentLaneTxLaserBiasCurrent'; + $oid_num = ".1.3.6.1.4.1.2636.3.60.1.2.1.1.7.{$lane_index}"; + $type = 'juniper-dom'; // $mib . '-' . $oid_name; + $scale = si_to_scale('micro'); // Yah, I forgot number :) + $value = $lane_oids[$lane_index][$oid_name]; + + $limits = array('limit_high' => $entry['jnxDomCurrentTxLaserBiasCurrentHighAlarmThreshold'] * $scale, + 'limit_low' => $entry['jnxDomCurrentTxLaserBiasCurrentLowAlarmThreshold'] * $scale, + 'limit_high_warn' => $entry['jnxDomCurrentTxLaserBiasCurrentHighWarningThreshold'] * $scale, + 'limit_low_warn' => $entry['jnxDomCurrentTxLaserBiasCurrentLowWarningThreshold'] * $scale); + + discover_sensor($valid['sensor'], 'current', $device, $oid_num, $lane_index, $type, $descr, $scale, $value, array_merge($options, $limits)); + + discover_sensor($valid['sensor'], 'current', $device, $oid_num, $index, $type, $descr, $scale, $value, array_merge($options, $limits)); + + # jnxDomCurrentRxLaserPower[508] -507 0.01 dbm + $descr = $entry['ifDescr'] . " {$i} RX Power"; + $oid_name = 'jnxDomCurrentLaneRxLaserPower'; + $oid_num = ".1.3.6.1.4.1.2636.3.60.1.2.1.1.6.{$lane_index}"; + $type = 'juniper-dom-rx'; // $mib . '-' . $oid_name; + $scale = 0.01; + $value = $lane_oids[$lane_index][$oid_name]; + + $limits = array('limit_high' => $entry['jnxDomCurrentRxLaserPowerHighAlarmThreshold'] * $scale, + 'limit_low' => $entry['jnxDomCurrentRxLaserPowerLowAlarmThreshold'] * $scale, + 'limit_high_warn' => $entry['jnxDomCurrentRxLaserPowerHighWarningThreshold'] * $scale, + 'limit_low_warn' => $entry['jnxDomCurrentRxLaserPowerLowWarningThreshold'] * $scale); + + discover_sensor($valid['sensor'], 'dbm', $device, $oid_num, $lane_index, $type, $descr, $scale, $value, array_merge($options, $limits)); + + # jnxDomCurrentTxLaserOutputPower[508] -507 0.01 dbm + $descr = $entry['ifDescr'] . " {$i} TX Power"; + $oid_name = 'jnxDomCurrentLaneTxLaserOutputPower'; + $oid_num = ".1.3.6.1.4.1.2636.3.60.1.2.1.1.8.{$lane_index}"; + $type = 'juniper-dom-tx'; // $mib . '-' . $oid_name; + $scale = 0.01; + $value = $lane_oids[$lane_index][$oid_name]; + + $limits = array('limit_high' => $entry['jnxDomCurrentTxLaserOutputPowerHighAlarmThreshold'] * $scale, + 'limit_low' => $entry['jnxDomCurrentTxLaserOutputPowerLowAlarmThreshold'] * $scale, + 'limit_high_warn' => $entry['jnxDomCurrentTxLaserOutputPowerHighWarningThreshold'] * $scale, + 'limit_low_warn' => $entry['jnxDomCurrentTxLaserOutputPowerLowWarningThreshold'] * $scale); + + discover_sensor($valid['sensor'], 'dbm', $device, $oid_num, $lane_index, $type, $descr, $scale, $value, array_merge($options, $limits)); + } + } } // EOF