mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* refactor: advanced sensor states
mark create_state_index($state_name) as E_USER_DEPRECATED?
* fix: minor corrections
* fix: mib has partialSync(9) and incompatibleVersion(8)
* fix: corrected netagent2upsstate - Sleeping(5)
* fix: NetAgent2 upsThreePhaseUPSStatusInverterOperating correction
* refactor: array() be gone
* Refactoring includes/discovery/sensors/state/extendair.inc.php with arrays
And tidying up array formatting in other files
* fix: minor typo
* standardising array item names
removed redundant "if ($state_index_id !== null) {"
* workaround: procurve & serverscheck
a sensor is causing create_state_index($state) to return null.
The updated code doesn't allow for this and thus a hybrid is being used.
* standardised naming of state info. Caused a typo $state_name instead of $status_name
$state_name is the standard
* converted compas to square arrays
* Converted APC states using preg_match to new create_state_index() call
* Update boss.inc.php
53 lines
3.0 KiB
PHP
53 lines
3.0 KiB
PHP
<?php
|
|
|
|
// Environmental monitoring on UPSes etc
|
|
// FIXME emConfigProbesTable may also be used? But not filled out on my device...
|
|
$apc_env_data = snmpwalk_cache_oid($device, 'iemConfigProbesTable', [], 'PowerNet-MIB');
|
|
$apc_env_data = snmpwalk_cache_oid($device, 'iemStatusProbesTable', $apc_env_data, 'PowerNet-MIB');
|
|
|
|
foreach (array_keys($apc_env_data) as $index) {
|
|
$descr = $apc_env_data[$index]['iemStatusProbeName'];
|
|
$current = $apc_env_data[$index]['iemStatusProbeCurrentHumid'];
|
|
$sensorType = 'apc';
|
|
$oid = '.1.3.6.1.4.1.318.1.1.10.2.3.2.1.6.'.$index;
|
|
$low_limit = ($apc_env_data[$index]['iemConfigProbeMinHumidEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeMinHumidThreshold'] : null);
|
|
$low_warn_limit = ($apc_env_data[$index]['iemConfigProbeLowHumidEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeLowHumidThreshold'] : null);
|
|
$high_warn_limit = ($apc_env_data[$index]['iemConfigProbeHighHumidEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeHighHumidThreshold'] : null);
|
|
$high_limit = ($apc_env_data[$index]['iemConfigProbeMaxHumidEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeMaxHumidThreshold'] : null);
|
|
|
|
if ($current > 0) {
|
|
// Humidity = 0 -> Sensor not available
|
|
discover_sensor($valid['sensor'], 'humidity', $device, $oid, $index, $sensorType, $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current);
|
|
}
|
|
}
|
|
|
|
$apc_env_data = snmpwalk_cache_oid($device, 'emsProbeStatus', [], 'PowerNet-MIB');
|
|
|
|
foreach (array_keys($apc_env_data) as $index) {
|
|
if ($apc_env_data[$index]['emsProbeStatusProbeCommStatus'] != 'commsNeverDiscovered') {
|
|
$descr = $apc_env_data[$index]['emsProbeStatusProbeName'];
|
|
$current = $apc_env_data[$index]['emsProbeStatusProbeHumidity'];
|
|
$sensorType = 'apc';
|
|
$oid = '.1.3.6.1.4.1.318.1.1.10.3.13.1.1.6.' . $index;
|
|
$low_limit = $apc_env_data[$index]['emsProbeStatusProbeMinHumidityThresh'];
|
|
$low_warn_limit = $apc_env_data[$index]['emsProbeStatusProbeLowHumidityThresh'];
|
|
$high_warn_limit = $apc_env_data[$index]['emsProbeStatusProbeHighHumidityThresh'];
|
|
$high_limit = $apc_env_data[$index]['emsProbeStatusProbeMaxHumidityThresh'];
|
|
|
|
if ($current > 0) {
|
|
discover_sensor($valid['sensor'], 'humidity', $device, $oid, $index, $sensorType, $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current);
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach ($pre_cache['mem_sensors_status'] as $index => $data) {
|
|
$cur_oid = '.1.3.6.1.4.1.318.1.1.10.4.2.3.1.6.' . $index;
|
|
$descr = $data['memSensorsStatusSensorName'] . ' - ' . $data['memSensorsStatusSensorLocation'];
|
|
$divisor = 1;
|
|
$multiplier = 1;
|
|
$value = $data['memSensorsHumidity'];
|
|
if (is_numeric($value)) {
|
|
discover_sensor($valid['sensor'], 'humidity', $device, $cur_oid, 'memSensorsHumidity.' . $index, 'apc', $descr, $divisor, $multiplier, null, null, null, null, $value);
|
|
}
|
|
}
|