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
120 lines
4.8 KiB
PHP
120 lines
4.8 KiB
PHP
<?php
|
|
|
|
if ($device['os'] == 'hirschmann') {
|
|
///////////////////////////
|
|
/// Power Supply Status ///
|
|
///////////////////////////
|
|
$oid = snmpwalk_cache_multi_oid($device, 'hmPSTable', [], 'HMPRIV-MGMT-SNMP-MIB');
|
|
$cur_oid = '.1.3.6.1.4.1.248.14.1.2.1.3.';
|
|
|
|
if (is_array($oid)) {
|
|
//Create State Index
|
|
$state_name = 'hmPowerSupplyStatus';
|
|
$states = [
|
|
['value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'ok'],
|
|
['value' => 2, 'generic' => 2, 'graph' => 0, 'descr' => 'failed'],
|
|
['value' => 3, 'generic' => 1, 'graph' => 0, 'descr' => 'notInstalled'],
|
|
['value' => 4, 'generic' => 3, 'graph' => 0, 'descr' => 'unknown'],
|
|
];
|
|
create_state_index($state_name, $states);
|
|
|
|
foreach ($oid as $index => $entry) {
|
|
//Discover Sensors
|
|
discover_sensor($valid['sensor'], 'state', $device, $cur_oid.$index, 'hmPowerSupplyStatus'.$index, $state_name, 'Power Supply '.$oid[$index]['hmPSID'], 1, 1, null, null, null, null, $oid[$index]['hmPowerSupplyStatus'], 'snmp', 'hmPowerSupplyStatus'.$index);
|
|
|
|
//Create Sensor To State Index
|
|
create_sensor_to_state_index($device, $state_name, 'hmPowerSupplyStatus'.$index);
|
|
}
|
|
}
|
|
|
|
////////////////////////////////
|
|
/// Common LED Status States ///
|
|
////////////////////////////////
|
|
$states = [
|
|
['value' => 1, 'generic' => 0, 'graph' => 0, 'descr' => 'off'],
|
|
['value' => 2, 'generic' => 0, 'graph' => 0, 'descr' => 'green'],
|
|
['value' => 3, 'generic' => 1, 'graph' => 0, 'descr' => 'yellow'],
|
|
['value' => 4, 'generic' => 2, 'graph' => 0, 'descr' => 'red'],
|
|
];
|
|
|
|
///////////////////////////////
|
|
/// LED Status Power Supply ///
|
|
///////////////////////////////
|
|
$temp = snmp_get($device, "hmLEDRSPowerSupply.0", "-Ovqe", "HMPRIV-MGMT-SNMP-MIB");
|
|
$cur_oid = '.1.3.6.1.4.1.248.14.1.1.35.1.1.0';
|
|
$index = '0';
|
|
|
|
if (is_numeric($temp)) {
|
|
//Create State Index
|
|
$state_name = 'hmLEDRSPowerSupply';
|
|
create_state_index($state_name, $states);
|
|
|
|
$descr = 'LED Status Power Supply';
|
|
//Discover Sensors
|
|
discover_sensor($valid['sensor'], 'state', $device, $cur_oid, 'hmLEDRSPowerSupply.'.$index, $state_name, $descr, 1, 1, null, null, null, null, $temp, 'snmp', 'hmLEDRSPowerSupply.'.$index);
|
|
|
|
//Create Sensor To State Index
|
|
create_sensor_to_state_index($device, $state_name, 'hmLEDRSPowerSupply.'.$index);
|
|
}
|
|
|
|
//////////////////////////
|
|
/// LED Status Standby ///
|
|
//////////////////////////
|
|
$temp = snmp_get($device, "hmLEDRStandby.0", "-Ovqe", "HMPRIV-MGMT-SNMP-MIB");
|
|
$cur_oid = '.1.3.6.1.4.1.248.14.1.1.35.1.2.0';
|
|
$index = '0';
|
|
|
|
if (is_numeric($temp)) {
|
|
//Create State Index
|
|
$state_name = 'hmLEDRStandby';
|
|
create_state_index($state_name, $states);
|
|
|
|
$descr = 'LED Status Standby';
|
|
//Discover Sensors
|
|
discover_sensor($valid['sensor'], 'state', $device, $cur_oid, 'hmLEDRStandby.'.$index, $state_name, $descr, 1, 1, null, null, null, null, $temp, 'snmp', 'hmLEDRStandby.'.$index);
|
|
|
|
//Create Sensor To State Index
|
|
create_sensor_to_state_index($device, $state_name, 'hmLEDRStandby.'.$index);
|
|
}
|
|
|
|
/////////////////////////////////////
|
|
/// LED Status Redundancy Manager ///
|
|
/////////////////////////////////////
|
|
$temp = snmp_get($device, "hmLEDRSRedundancyManager.0", "-Ovqe", "HMPRIV-MGMT-SNMP-MIB");
|
|
$cur_oid = '.1.3.6.1.4.1.248.14.1.1.35.1.3.0';
|
|
$index = '0';
|
|
|
|
if (is_numeric($temp)) {
|
|
//Create State Index
|
|
$state_name = 'hmLEDRSRedundancyManager';
|
|
create_state_index($state_name, $states);
|
|
|
|
$descr = 'LED Status Redundancy Manager';
|
|
//Discover Sensors
|
|
discover_sensor($valid['sensor'], 'state', $device, $cur_oid, 'hmLEDRSRedundancyManager.'.$index, $state_name, $descr, 1, 1, null, null, null, null, $temp, 'snmp', 'hmLEDRSRedundancyManager.'.$index);
|
|
|
|
//Create Sensor To State Index
|
|
create_sensor_to_state_index($device, $state_name, 'hmLEDRSRedundancyManager.'.$index);
|
|
}
|
|
|
|
////////////////////////
|
|
/// LED Status Fault ///
|
|
////////////////////////
|
|
$temp = snmp_get($device, "hmLEDRSFault.0", "-Ovqe", "HMPRIV-MGMT-SNMP-MIB");
|
|
$cur_oid = '.1.3.6.1.4.1.248.14.1.1.35.1.4.0';
|
|
$index = '0';
|
|
|
|
if (is_numeric($temp)) {
|
|
//Create State Index
|
|
$state_name = 'hmLEDRSFault';
|
|
create_state_index($state_name, $states);
|
|
|
|
$descr = 'LED Status Fault';
|
|
//Discover Sensors
|
|
discover_sensor($valid['sensor'], 'state', $device, $cur_oid, 'hmLEDRSFault.'.$index, $state_name, $descr, 1, 1, null, null, null, null, $temp, 'snmp', 'hmLEDRSFault.'.$index);
|
|
|
|
//Create Sensor To State Index
|
|
create_sensor_to_state_index($device, $state_name, 'hmLEDRSFault.'.$index);
|
|
}
|
|
}
|