mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
device: Added more Dell iDrac state sensors (#8254)
* feature: Add more Dell iDrac state sensors * add test data * Added drac.json test data * Re-run test data * Fix drac.inc.php
This commit is contained in:
committed by
Neil Lathwood
parent
3cd6d90239
commit
8fdedcf484
@@ -1,4 +1,4 @@
|
||||
mib: mibs/dell/DELL-RAC-MIB
|
||||
mib: DELL-RAC-MIB:IDRAC-MIB-SMIv2
|
||||
modules:
|
||||
sensors:
|
||||
state:
|
||||
@@ -16,3 +16,53 @@ modules:
|
||||
- { value: 4, descr: nonCritical, graph: 1, generic: 1 }
|
||||
- { value: 5, descr: critical, graph: 1, generic: 2 }
|
||||
- { value: 6, descr: nonRecoverable, graph: 1, generic: 2 }
|
||||
-
|
||||
oid: systemStateIDSDMCardUnitStatusCombined
|
||||
value: systemStateIDSDMCardUnitStatusCombined
|
||||
num_oid: .1.3.6.1.4.1.674.10892.5.4.200.10.1.58.
|
||||
descr: 'IDSDM Card Unit Combined Status'
|
||||
index: 'systemStateIDSDMCardUnitStatusCombined.{{ $index }}'
|
||||
states:
|
||||
- { value: 1, descr: other, graph: 1, generic: 3 }
|
||||
- { value: 2, descr: unknown, graph: 1, generic: 3 }
|
||||
- { value: 3, descr: ok, graph: 1, generic: 0 }
|
||||
- { value: 4, descr: nonCritical, graph: 1, generic: 1 }
|
||||
- { value: 5, descr: critical, graph: 1, generic: 2 }
|
||||
- { value: 6, descr: nonRecoverable, graph: 1, generic: 2 }
|
||||
-
|
||||
oid: systemStateIDSDMCardDeviceStatusCombined
|
||||
value: systemStateIDSDMCardDeviceStatusCombined
|
||||
num_oid: .1.3.6.1.4.1.674.10892.5.4.200.10.1.60.
|
||||
descr: 'IDSDM Card Device Combined Status'
|
||||
index: 'systemStateIDSDMCardDeviceStatusCombined.{{ $index }}'
|
||||
states:
|
||||
- { value: 1, descr: other, graph: 1, generic: 3 }
|
||||
- { value: 2, descr: unknown, graph: 1, generic: 3 }
|
||||
- { value: 3, descr: ok, graph: 1, generic: 0 }
|
||||
- { value: 4, descr: nonCritical, graph: 1, generic: 1 }
|
||||
- { value: 5, descr: critical, graph: 1, generic: 2 }
|
||||
- { value: 6, descr: nonRecoverable, graph: 1, generic: 2 }
|
||||
-
|
||||
oid: intrusionStatus
|
||||
value: intrusionStatus
|
||||
num_oid: .1.3.6.1.4.1.674.10892.5.4.300.70.1.5.
|
||||
descr: 'Intrusion Status'
|
||||
index: 'intrusionStatus.{{ $index }}'
|
||||
states:
|
||||
- { value: 1, descr: other, graph: 1, generic: 3 }
|
||||
- { value: 2, descr: unknown, graph: 1, generic: 3 }
|
||||
- { value: 3, descr: ok, graph: 1, generic: 0 }
|
||||
- { value: 4, descr: nonCritical, graph: 1, generic: 1 }
|
||||
- { value: 5, descr: critical, graph: 1, generic: 2 }
|
||||
- { value: 6, descr: nonRecoverable, graph: 1, generic: 2 }
|
||||
-
|
||||
oid: intrusionReading
|
||||
value: intrusionReading
|
||||
num_oid: .1.3.6.1.4.1.674.10892.5.4.300.70.1.6.
|
||||
descr: 'Intrusion Reading'
|
||||
index: 'intrusionReading.{{ $index }}'
|
||||
states:
|
||||
- { value: 1, descr: chassisNotBreached, graph: 1, generic: 0 }
|
||||
- { value: 2, descr: chassisBreached, graph: 1, generic: 2 }
|
||||
- { value: 3, descr: chassisBreachedPrior, graph: 1, generic: 1 }
|
||||
- { value: 4, descr: chassisBreachSensorFailure, graph: 1, generic: 1 }
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
@@ -10,80 +10,85 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
$tables = array(
|
||||
array('virtualDiskTable','.1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.4.','virtualDiskState','virtualDiskName') ,
|
||||
array('processorDeviceTable','.1.3.6.1.4.1.674.10892.5.4.1100.30.1.5.','processorDeviceStatus','processorDeviceBrandName') ,
|
||||
array('memoryDeviceTable','.1.3.6.1.4.1.674.10892.5.4.1100.50.1.5.','memoryDeviceStatus','memoryDeviceLocationName') ,
|
||||
array('voltageProbeTable','.1.3.6.1.4.1.674.10892.5.4.600.20.1.5.','voltageProbeStatus','voltageProbeLocationName') ,
|
||||
array('amperageProbeTable','.1.3.6.1.4.1.674.10892.5.4.600.30.1.5.','amperageProbeStatus','amperageProbeLocationName') ,
|
||||
array('systemBatteryTable','.1.3.6.1.4.1.674.10892.5.4.600.50.1.5.','systemBatteryStatus','systemBatteryLocationName')
|
||||
);
|
||||
$tables = [
|
||||
['virtualDiskTable','.1.3.6.1.4.1.674.10892.5.5.1.20.140.1.1.4.','virtualDiskState','virtualDiskName'],
|
||||
['processorDeviceTable','.1.3.6.1.4.1.674.10892.5.4.1100.30.1.5.','processorDeviceStatus','processorDeviceBrandName'],
|
||||
['memoryDeviceTable','.1.3.6.1.4.1.674.10892.5.4.1100.50.1.5.','memoryDeviceStatus','memoryDeviceLocationName'],
|
||||
['voltageProbeTable','.1.3.6.1.4.1.674.10892.5.4.600.20.1.5.','voltageProbeStatus','voltageProbeLocationName'],
|
||||
['amperageProbeTable','.1.3.6.1.4.1.674.10892.5.4.600.30.1.5.','amperageProbeStatus','amperageProbeLocationName'],
|
||||
['systemBatteryTable','.1.3.6.1.4.1.674.10892.5.4.600.50.1.5.','systemBatteryStatus','systemBatteryLocationName']
|
||||
];
|
||||
|
||||
foreach ($tables as $tablevalue) {
|
||||
$temp = snmpwalk_cache_multi_oid($device, $tablevalue[0], array(), 'IDRAC-MIB-SMIv2');
|
||||
$cur_oid = $tablevalue[1];
|
||||
list($table_oid, $num_oid, $value_oid, $descr_oid) = $tablevalue;
|
||||
$temp = snmpwalk_cache_multi_oid($device, $table_oid, array(), 'IDRAC-MIB-SMIv2', null, '-OQUse');
|
||||
// '-OQUsetX'
|
||||
|
||||
if (is_array($temp)) {
|
||||
//Create State Index
|
||||
$state_name = $tablevalue[2];
|
||||
$state_index_id = create_state_index($state_name);
|
||||
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
if ($state_name == 'virtualDiskState') {
|
||||
$states = array(
|
||||
array($state_index_id,'unknown',0,1,3) ,
|
||||
array($state_index_id,'online',0,2,0) ,
|
||||
array($state_index_id,'failed',0,3,2) ,
|
||||
array($state_index_id,'degraded',0,4,1)
|
||||
);
|
||||
} elseif ($state_name == 'processorDeviceStatus' || $state_name == 'memoryDeviceStatus') {
|
||||
$states = array(
|
||||
array($state_index_id,'other',0,1,3) ,
|
||||
array($state_index_id,'unknown',0,2,3) ,
|
||||
array($state_index_id,'ok',0,3,0) ,
|
||||
array($state_index_id,'nonCritical',0,4,1) ,
|
||||
array($state_index_id,'critical',0,5,2) ,
|
||||
array($state_index_id,'nonRecoverable',0,6,2)
|
||||
);
|
||||
} elseif ($state_name == 'voltageProbeStatus' || $state_name == 'amperageProbeStatus' || $state_name == 'systemBatteryStatus') {
|
||||
$states = array(
|
||||
array($state_index_id,'other',0,1,3) ,
|
||||
array($state_index_id,'unknown',0,2,3) ,
|
||||
array($state_index_id,'ok',0,3,0) ,
|
||||
array($state_index_id,'nonCriticalUpper',0,4,1) ,
|
||||
array($state_index_id,'criticalUpper',0,5,2) ,
|
||||
array($state_index_id,'nonRecoverableUpper',0,6,2) ,
|
||||
array($state_index_id,'nonCriticalLower',0,7,1) ,
|
||||
array($state_index_id,'criticalLower',0,8,2) ,
|
||||
array($state_index_id,'nonRecoverableLower',0,9,2) ,
|
||||
array($state_index_id,'failed',0,10,2)
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($states as $value) {
|
||||
$insert = array(
|
||||
'state_index_id' => $value[0],
|
||||
'state_descr' => $value[1],
|
||||
'state_draw_graph' => $value[2],
|
||||
'state_value' => $value[3],
|
||||
'state_generic_value' => $value[4]
|
||||
);
|
||||
dbInsert($insert, 'state_translations');
|
||||
}
|
||||
if (!empty($temp)) {
|
||||
// Find the right states
|
||||
if ($value_oid == 'virtualDiskState') {
|
||||
$states = [
|
||||
['value' => 1, 'generic' => 3, 'graph' => 0, 'descr' => 'unknown'],
|
||||
['value' => 2, 'generic' => 0, 'graph' => 0, 'descr' => 'online'],
|
||||
['value' => 3, 'generic' => 2, 'graph' => 0, 'descr' => 'failed'],
|
||||
['value' => 4, 'generic' => 1, 'graph' => 0, 'descr' => 'degraded'],
|
||||
];
|
||||
} elseif ($value_oid == 'processorDeviceStatus' || $value_oid == 'memoryDeviceStatus') {
|
||||
$states = [
|
||||
['value' => 1, 'generic' => 3, 'graph' => 0, 'descr' => 'other'],
|
||||
['value' => 2, 'generic' => 3, 'graph' => 0, 'descr' => 'unknown'],
|
||||
['value' => 3, 'generic' => 0, 'graph' => 0, 'descr' => 'ok'],
|
||||
['value' => 4, 'generic' => 1, 'graph' => 0, 'descr' => 'nonCritical'],
|
||||
['value' => 5, 'generic' => 2, 'graph' => 0, 'descr' => 'critical'],
|
||||
['value' => 6, 'generic' => 2, 'graph' => 0, 'descr' => 'nonRecoverable'],
|
||||
];
|
||||
} elseif ($value_oid == 'voltageProbeStatus' || $value_oid == 'amperageProbeStatus' || $value_oid == 'systemBatteryStatus') {
|
||||
$states = [
|
||||
['value' => 1, 'generic' => 3, 'graph' => 0, 'descr' => 'other'],
|
||||
['value' => 2, 'generic' => 3, 'graph' => 0, 'descr' => 'unknown'],
|
||||
['value' => 3, 'generic' => 0, 'graph' => 0, 'descr' => 'ok'],
|
||||
['value' => 4, 'generic' => 1, 'graph' => 0, 'descr' => 'nonCriticalUpper'],
|
||||
['value' => 5, 'generic' => 2, 'graph' => 0, 'descr' => 'criticalUpper'],
|
||||
['value' => 6, 'generic' => 2, 'graph' => 0, 'descr' => 'nonRecoverableUpper'],
|
||||
['value' => 7, 'generic' => 1, 'graph' => 0, 'descr' => 'nonCriticalLower'],
|
||||
['value' => 8, 'generic' => 2, 'graph' => 0, 'descr' => 'criticalLower'],
|
||||
['value' => 9, 'generic' => 2, 'graph' => 0, 'descr' => 'nonRecoverableLower'],
|
||||
['value' => 10, 'generic' => 2, 'graph' => 0, 'descr' => 'failed'],
|
||||
];
|
||||
}
|
||||
|
||||
// Create State Index
|
||||
create_state_index($value_oid, $states);
|
||||
|
||||
foreach ($temp as $index => $entry) {
|
||||
if ($state_name == 'memoryDeviceStatus') {
|
||||
$descr = $temp[$index][$tablevalue[3]] . ', ' . $temp[$index]['memoryDeviceSize']/1024 . ' MB';
|
||||
if ($value_oid == 'memoryDeviceStatus') {
|
||||
$descr = $entry[$descr_oid] . ', ' . $entry['memoryDeviceSize']/1024 . ' MB';
|
||||
} else {
|
||||
$descr = $temp[$index][$tablevalue[3]];
|
||||
$descr = $entry[$descr_oid];
|
||||
}
|
||||
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid.$index, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp[$index][$tablevalue[2]], 'snmp', $index);
|
||||
discover_sensor(
|
||||
$valid['sensor'],
|
||||
'state',
|
||||
$device,
|
||||
$num_oid . $index,
|
||||
$index,
|
||||
$value_oid,
|
||||
$descr,
|
||||
1,
|
||||
1,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
$entry[$value_oid],
|
||||
'snmp',
|
||||
$index
|
||||
);
|
||||
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
create_sensor_to_state_index($device, $value_oid, $index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user