mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added support for APC AP9810 zone contacts (#9967)
* device: Added support for APC AP9810 zone contacts * fix: disconnected sensors been detected. And iemConfigProbesTable certainly does get used and it reference * fix: load is VA, not to be confused with watts. This could be different per device though... Apparent Power unit = VA Real Power unit = Watts And Keeping codeclimate happy * feature: updated APC MIB * feature: added test data for APC Smart UPS SMX750i and AP9810 with contact switches
This commit is contained in:
@@ -24,7 +24,7 @@ if ($phasecount > 1) {
|
||||
'AdvOid' => 'upsAdvOutputLoad',
|
||||
'type' => 'apc',
|
||||
'index' => 0,
|
||||
'descr' => 'Load',
|
||||
'descr' => 'Load(VA)',
|
||||
'divisor' => 10,
|
||||
'mib' => '+PowerNet-MIB',
|
||||
],
|
||||
|
@@ -156,3 +156,37 @@ foreach ($pre_cache['mem_sensors_status'] as $index => $data) {
|
||||
create_sensor_to_state_index($device, $state_name, $state_name . '.' . $index);
|
||||
}
|
||||
}
|
||||
|
||||
// Monitor contact switches via the UIO ports.
|
||||
$apcContactData = snmpwalk_cache_oid($device, 'iemConfigContactsTable', [], 'PowerNet-MIB', null, '-OQUse');
|
||||
$apcContactData = snmpwalk_cache_oid($device, 'iemStatusContactsTable', $apcContactData, 'PowerNet-MIB', null, '-OQUse');
|
||||
|
||||
foreach (array_keys($apcContactData) as $index) {
|
||||
// APC disabled (1), enabled (2)
|
||||
if ($apcContactData[$index]['iemConfigContactEnable'] == 2) {
|
||||
$current = $apcContactData[$index]['iemStatusContactStatus'];
|
||||
$sensorType = 'apc';
|
||||
$cur_oid = '.1.3.6.1.4.1.318.1.1.10.2.3.4.1.3.' . $index;
|
||||
$severity = $apcContactData[$index]['iemConfigContactSeverity'];
|
||||
|
||||
// APC critical (1), warning (2)
|
||||
// LibreNMS warning (1), critical (2)
|
||||
$faultGeneric = 1;
|
||||
if ($severity == 1) {
|
||||
$faultGeneric = 2;
|
||||
} elseif ($severity == 2) {
|
||||
$faultGeneric = 1;
|
||||
}
|
||||
|
||||
$state_name = $apcContactData[$index]['iemConfigContactName'];
|
||||
$states = [
|
||||
['value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'noFault'],
|
||||
['value' => 2, 'generic' => $faultGeneric, 'graph' => 1, 'descr' => 'fault'],
|
||||
['value' => 3, 'generic' => 0, 'graph' => 0, 'descr' => 'disabled'],
|
||||
];
|
||||
create_state_index($state_name, $states);
|
||||
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid, $state_name.'.'.$index, $state_name, $state_name, 1, 1, null, null, null, null, $current);
|
||||
create_sensor_to_state_index($device, $state_name, $state_name . '.' . $index);
|
||||
}
|
||||
}
|
||||
|
@@ -15,21 +15,24 @@ if ($oids) {
|
||||
}
|
||||
|
||||
// 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');
|
||||
$apc_env_data = snmpwalk_cache_oid($device, 'iemConfigProbesTable', [], 'PowerNet-MIB', null, '-OQUse');
|
||||
$apc_env_data = snmpwalk_cache_oid($device, 'iemStatusProbesTable', $apc_env_data, 'PowerNet-MIB', null, '-OQUse');
|
||||
|
||||
foreach (array_keys($apc_env_data) as $index) {
|
||||
$descr = $apc_env_data[$index]['iemStatusProbeName'];
|
||||
$current = $apc_env_data[$index]['iemStatusProbeCurrentTemp'];
|
||||
$sensorType = 'apc';
|
||||
$oid = '.1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.'.$index;
|
||||
$low_limit = ($apc_env_data[$index]['iemConfigProbeMinTempEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeMinTempThreshold'] : null);
|
||||
$low_warn_limit = ($apc_env_data[$index]['iemConfigProbeLowTempEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeLowTempThreshold'] : null);
|
||||
$high_warn_limit = ($apc_env_data[$index]['iemConfigProbeHighTempEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeHighTempThreshold'] : null);
|
||||
$high_limit = ($apc_env_data[$index]['iemConfigProbeMaxTempEnable'] != 'disabled' ? $apc_env_data[$index]['iemConfigProbeMaxTempThreshold'] : null);
|
||||
// APC connected(2), disconnected(1)
|
||||
if ($apc_env_data[$index]['iemStatusProbeStatus'] != 1) {
|
||||
$descr = $apc_env_data[$index]['iemStatusProbeName'];
|
||||
$current = $apc_env_data[$index]['iemStatusProbeCurrentTemp'];
|
||||
$sensorType = 'apc';
|
||||
$oid = '.1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.'.$index;
|
||||
// APC enum disabled(1), enabled(2)
|
||||
$low_limit = ($apc_env_data[$index]['iemConfigProbeMinTempEnable'] != 1 ? $apc_env_data[$index]['iemConfigProbeMinTempThreshold'] : null);
|
||||
$low_warn_limit = ($apc_env_data[$index]['iemConfigProbeLowTempEnable'] != 1 ? $apc_env_data[$index]['iemConfigProbeLowTempThreshold'] : null);
|
||||
$high_warn_limit = ($apc_env_data[$index]['iemConfigProbeHighTempEnable'] != 1 ? $apc_env_data[$index]['iemConfigProbeHighTempThreshold'] : null);
|
||||
$high_limit = ($apc_env_data[$index]['iemConfigProbeMaxTempEnable'] != 1 ? $apc_env_data[$index]['iemConfigProbeMaxTempThreshold'] : null);
|
||||
|
||||
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensorType, $descr, '1', '1', $low_limit, $low_warn_limit, $high_warn_limit, $high_limit, $current);
|
||||
discover_sensor($valid['sensor'], 'temperature', $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');
|
||||
|
Reference in New Issue
Block a user