diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 8952853e7f..bd04375bb6 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -892,14 +892,6 @@ function generate_ap_url($ap, $vars=array()) { }//end generate_ap_url() - -function report_this($message) { - global $config; - return '

'.$message.' Please report this to the '.$config['project_name'].' developers.

'; - -}//end report_this() - - function report_this_text($message) { global $config; return $message.'\nPlease report this to the '.$config['project_name'].' developers at '.$config['project_issues'].'\n'; diff --git a/includes/discovery/sensors.inc.php b/includes/discovery/sensors.inc.php index cfb66fd24c..4067e2fe70 100644 --- a/includes/discovery/sensors.inc.php +++ b/includes/discovery/sensors.inc.php @@ -2,6 +2,10 @@ $valid['sensor'] = array(); +// Pre-cache data for later use +require 'includes/discovery/sensors/pre-cache.inc.php'; + + require 'includes/discovery/sensors/cisco-entity-sensor.inc.php'; require 'includes/discovery/sensors/entity-sensor.inc.php'; require 'includes/discovery/sensors/ipmi.inc.php'; diff --git a/includes/discovery/sensors/current/junos.inc.php b/includes/discovery/sensors/current/junos.inc.php new file mode 100644 index 0000000000..3b1d34cba3 --- /dev/null +++ b/includes/discovery/sensors/current/junos.inc.php @@ -0,0 +1,24 @@ + $entry) { + if (is_numeric($entry['jnxDomCurrentTxLaserBiasCurrent'])) { + $oid = '.1.3.6.1.4.1.2636.3.60.1.1.1.1.6.'.$index; + $descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', array($index, $device['device_id'])) . ' Rx Current'; + $limit_low = $entry['jnxDomCurrentTxLaserBiasCurrentLowAlarmThreshold']/$divisor; + $warn_limit_low = $entry['jnxDomCurrentTxLaserBiasCurrentLowWarningThreshold']/$divisor; + $limit = $entry['jnxDomCurrentTxLaserBiasCurrentHighAlarmThreshold']/$divisor; + $warn_limit = $entry['jnxDomCurrentTxLaserBiasCurrentHighWarningThreshold']/$divisor; + $current = $entry['jnxDomCurrentTxLaserBiasCurrent']; + $entPhysicalIndex = $index; + $entPhysicalIndex_measured = 'ports'; + discover_sensor($valid['sensor'], 'current', $device, $oid, 'rx-'.$index, 'junos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured); + } + + } + +} diff --git a/includes/discovery/sensors/dbm/junos.inc.php b/includes/discovery/sensors/dbm/junos.inc.php new file mode 100644 index 0000000000..8c1c3efc04 --- /dev/null +++ b/includes/discovery/sensors/dbm/junos.inc.php @@ -0,0 +1,37 @@ + $entry) { + if (is_numeric($entry['jnxDomCurrentRxLaserPower'])) { + $oid = '.1.3.6.1.4.1.2636.3.60.1.1.1.1.5.'.$index; + $descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', array($index, $device['device_id'])) . ' Rx Power'; + $limit_low = $entry['jnxDomCurrentRxLaserPowerLowAlarmThreshold']/$divisor; + $warn_limit_low = $entry['jnxDomCurrentRxLaserPowerLowWarningThreshold']/$divisor; + $limit = $entry['jnxDomCurrentRxLaserPowerHighAlarmThreshold']/$divisor; + $warn_limit = $entry['jnxDomCurrentRxLaserPowerHighWarningThreshold']/$divisor; + $current = $entry['jnxDomCurrentRxLaserPower']; + $entPhysicalIndex = $index; + $entPhysicalIndex_measured = 'ports'; + discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'rx-'.$index, 'junos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured); + } + + if (is_numeric($entry['jnxDomCurrentTxLaserOutputPower'])) { + $oid = '.1.3.6.1.4.1.2636.3.60.1.1.1.1.7.'.$index; + $descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', array($index, $device['device_id'])) . ' Tx Power'; + $limit_low = $entry['jnxDomCurrentTxLaserOutputPowerLowAlarmThreshold']/$divisor; + $warn_limit_low = $entry['jnxDomCurrentTxLaserOutputPowerLowWarningThreshold']/$divisor; + $limit = $entry['jnxDomCurrentModuleTemperatureHighAlarmThreshold']/$divisor; + $warn_limit = $entry['jnxDomCurrentModuleTemperatureHighWarningThreshold']/$divisor; + $current = $entry['jnxDomCurrentTxLaserOutputPower']; + $entPhysicalIndex = $index; + $entPhysicalIndex_measured = 'ports'; + discover_sensor($valid['sensor'], 'dbm', $device, $oid, 'tx-'.$index, 'junos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured); + } + + } + +} diff --git a/includes/discovery/sensors/pre-cache.inc.php b/includes/discovery/sensors/pre-cache.inc.php new file mode 100644 index 0000000000..bb9f848ebd --- /dev/null +++ b/includes/discovery/sensors/pre-cache.inc.php @@ -0,0 +1,9 @@ + $entry) { + if (is_numeric($entry['jnxDomCurrentModuleTemperature'])) { + $oid = '.1.3.6.1.4.1.2636.3.60.1.1.1.1.8.'.$index; + $descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', array($index, $device['device_id'])) . ' Temperature'; + $limit_low = $entry['jnxDomCurrentModuleTemperatureLowAlarmThreshold']/$divisor; + $warn_limit_low = $entry['jnxDomCurrentModuleTemperatureLowWarningThreshold']/$divisor; + $limit = $entry['jnxDomCurrentModuleTemperatureHighAlarmThreshold']/$divisor; + $warn_limit = $entry['jnxDomCurrentModuleTemperatureHighWarningThreshold']/$divisor; + $current = $entry['jnxDomCurrentModuleTemperature']; + $entPhysicalIndex = $index; + $entPhysicalIndex_measured = 'ports'; + discover_sensor($valid['sensor'], 'temperature', $device, $oid, 'rx-'.$index, 'junos', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $warn_limit, $limit, $current, 'snmp', $entPhysicalIndex, $entPhysicalIndex_measured); + } + } } diff --git a/includes/functions.php b/includes/functions.php index e0845036f5..b489261349 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1535,3 +1535,9 @@ function create_sensor_to_state_index($device, $state_name, $index) dbInsert($insert, 'sensors_to_state_indexes'); } } + +function report_this($message) { + global $config; + return '

'.$message.' Please report this to the '.$config['project_name'].' developers.

'; + +}//end report_this()