i kept testing to get the values but there are 2 problems , i face now.
- state description is not sorted , no matter what i do , i can’t affect that part (its slot device 1 , slot device 10, slot device 12, slot device 2 , instead of the 1,2,3…12)
- following @murrant advice , that the values where made-up, i tried to mirror another storage setup…(of another OS)
this is my code now with an additional infotrend.inc.php
but again there are no data to be graphed in librenms from this code , using the -vvv during discovery i can see , serial numbers from drives, i can see values which would correspond to the size of the LUNs for the storage , but again nothing that i could graph from there
<?php
global $valid;
if (!isset($valid['sensor'])) {
$valid['sensor'] = [];
}
// --- Common: State Definitions ---
// Disk states based on enterprises.1714.1.1.5.1.6
$disk_health_states = [
['value' => 0, 'generic' => 0, 'graph' => 0, 'descr' => 'ok'],
['value' => 1, 'generic' => 1, 'graph' => 0, 'descr' => 'warning'],
['value' => 2, 'generic' => 2, 'graph' => 0, 'descr' => 'critical'],
['value' => 3, 'generic' => 3, 'graph' => 0, 'descr' => 'unknown'],
['value' => 4, 'generic' => 3, 'graph' => 0, 'descr' => 'offline'],
['value' => 5, 'generic' => 1, 'graph' => 0, 'descr' => 'rebuilding'],
['value' => 6, 'generic' => 2, 'graph' => 0, 'descr' => 'failed'],
['value' => 7, 'generic' => 1, 'graph' => 0, 'descr' => 'initializing'],
['value' => 8, 'generic' => 1, 'graph' => 0, 'descr' => 'degraded'],
['value' => 9, 'generic' => 0, 'graph' => 0, 'descr' => 'power saving'],
['value' => 10, 'generic' => 0, 'graph' => 0, 'descr' => 'powering up'],
];
// Physical Device Slot states based on luDevValue when luDevTypeCode = 17
$device_slot_states = [
['value' => 0, 'generic' => 3, 'graph' => 0, 'descr' => 'unknown'],
['value' => 1, 'generic' => 1, 'graph' => 0, 'descr' => 'warning'],
['value' => 2, 'generic' => 2, 'graph' => 0, 'descr' => 'critical'],
['value' => 3, 'generic' => 0, 'graph' => 0, 'descr' => 'ok'],
['value' => 4, 'generic' => 3, 'graph' => 0, 'descr' => 'offline'],
['value' => 5, 'generic' => 1, 'graph' => 0, 'descr' => 'rebuilding'],
['value' => 6, 'generic' => 2, 'graph' => 0, 'descr' => 'failed'],
['value' => 7, 'generic' => 1, 'graph' => 0, 'descr' => 'initializing'],
['value' => 8, 'generic' => 1, 'graph' => 0, 'descr' => 'degraded'],
['value' => 9, 'generic' => 0, 'graph' => 0, 'descr' => 'ok'],
];
// --- Section 1: Discover RAID Controller Cache Size ---
$cache_size_oid = 'enterprises.1714.1.1.1.1.2.0';
$cache_size_value = snmp_get($device, $cache_size_oid, 'IFT-SNMP-MIB');
if ($cache_size_value !== null && $cache_size_value !== '') {
$cache_size_bytes = $cache_size_value * 1024 * 1024;
discover_sensor(
$valid['sensor'],
'current',
$device,
$cache_size_oid,
'cacheSize',
'iftCacheSize',
'RAID Controller Cache Size',
1, 1,
null, null, null, null,
$cache_size_bytes,
'snmp',
'cache'
);
}
// --- Section 2: Discover Disk Health State Sensors ---
$disk_health_data = snmpwalk_cache_multi_oid($device, 'enterprises.1714.1.1.5', [], 'IFT-SNMP-MIB');
$disk_health_state_name = 'iftDiskHealthState';
$disk_health_state_index_id = create_state_index($disk_health_state_name, $disk_health_states);
foreach ($disk_health_data as $index => $entry) {
$value = $entry['1.6'] ?? null;
$descr = $entry['1.1'] ?? "Disk $index";
if ($value === null || $value === '') {
continue;
}
discover_sensor(
$valid['sensor'],
'state',
$device,
".1.3.6.1.4.1.1714.1.1.5.1.6.$index",
$index,
$disk_health_state_name,
$descr,
1, 1,
null, null, null, null,
$value,
'snmp',
$index
);
}
// --- Section 3: Discover Physical Device Slot State Sensors & Storage Pool Sensors ---
$lu_dev_table_data = snmpwalk_cache_multi_oid($device, 'luDevTable', [], 'IFT-SNMP-MIB');
// DEVICE SLOT STATE
$device_slot_state_name = 'iftDeviceSlotState';
$device_slot_state_index_id = create_state_index($device_slot_state_name, $device_slot_states);
$device_slot_data = [];
foreach ($lu_dev_table_data as $index => $entry) {
if (isset($entry['luDevTypeCode']) && $entry['luDevTypeCode'] == 17) {
$device_slot_data[$index] = $entry;
}
}
$sorted_device_indexes = array_keys($device_slot_data);
natsort($sorted_device_indexes);
$sorted_device_indexes = array_map('intval', $sorted_device_indexes);
foreach ($sorted_device_indexes as $index) {
$entry = $device_slot_data[$index];
$oid = ".1.3.6.1.4.1.1714.1.1.9.1.9.$index";
$value = $entry['luDevValue'] ?? null;
$descr = $entry['luDevDescription'] ?? "Device Slot $index";
if ($value === null || $value === '') {
continue;
}
discover_sensor(
$valid['sensor'],
'state',
$device,
$oid,
$index,
$device_slot_state_name,
$descr,
1, 1,
null, null, null, null,
$value,
'snmp',
$index
);
}
// STORAGE POOL
foreach ($lu_dev_table_data as $index => $entry) {
if (!isset($entry['luDevTypeCode']) || $entry['luDevTypeCode'] != 12) {
continue;
}
$oid_value = ".1.3.6.1.4.1.1714.1.1.9.1.9.$index";
$value = $entry['luDevValue'] ?? null;
$descr = $entry['luDevDescription'] ?? "Storage Pool $index";
$value_unit = $entry['luDevValueUnit'] ?? 1;
if ($value === null || $value === '') {
continue;
}
$value_in_bytes = $value * ($value_unit === 1 ? 1024 : 1);
discover_sensor(
$valid['sensor'],
'storage',
$device,
$oid_value,
$index,
'iftStoragePool',
$descr,
1, 1,
null, null, null, null,
$value_in_bytes,
'snmp',
$index
);
}
// --- LUN Storage Capacity ---
$luDevValue_oid = '.1.3.6.1.4.1.1714.1.1.9.1.9';
$luDevValueUnit_oid = '.1.3.6.1.4.1.1714.1.1.9.1.10';
$luDevValues = snmpwalk_cache_multi_oid($device, $luDevValue_oid, [], 'IFT-SNMP-MIB');
$luDevUnits = snmpwalk_cache_multi_oid($device, $luDevValueUnit_oid, [], 'IFT-SNMP-MIB');
$lun_data = $luDevValues;
$sorted_lun_indexes = array_keys($lun_data);
natsort($sorted_lun_indexes);
$sorted_lun_indexes = array_map('intval', $sorted_lun_indexes);
foreach ($sorted_lun_indexes as $index) {
$entry = $lun_data[$index];
$value = isset($entry[0]) ? $entry[0] : $entry;
$unit = isset($luDevUnits[$index][0]) ? $luDevUnits[$index][0] : $luDevUnits[$index];
if (is_numeric($value) && is_numeric($unit) && $unit > 0) {
$capacity = $value * $unit;
$descr = "LUN Storage Capacity $index";
discover_sensor(
$valid['sensor'],
'storage',
$device,
"$luDevValue_oid.$index",
$index,
'infortrend-lun-storage',
$descr,
1,
1,
null,
null,
null,
null,
$capacity
);
}
}
problem that i can’t sort these states is here :
i can see in the discovery.php
lunLdLvID.1 = 8E49EBC7D5FE8FC
lunLdLvID.2 = 4400FBF43E69FF0B
lunLdLvID.3 = 8E49EBC7D5FE8FC
lunLdLvID.4 = 8E49EBC7D5FE8FC
lunLdLvID.5 = 4400FBF43E69FF0B
lunLdLvID.6 = 4400FBF43E69FF0B
lunLdLvID.7 = 8E49EBC7D5FE8FC
lunLdLvID.8 = 8E49EBC7D5FE8FC
lunLdLvID.9 = 8E49EBC7D5FE8FC
lunLdLvID.10 = 4400FBF43E69FF0B
lunLdLvID.11 = 8E49EBC7D5FE8FC
lunLdLvID.12 = 8E49EBC7D5FE8FC
lunLdLvID.13 = 4400FBF43E69FF0B
lunLdLvID.14 = 4400FBF43E69FF0B
lunLdLvID.15 = 8E49EBC7D5FE8FC
lunLdLvID.16 = 8E49EBC7D5FE8FC
lunLdLvID.17 = 8E49EBC7D5FE8FC
lunLdLvID.18 = 4400FBF43E69FF0B
lunLdLvID.19 = 8E49EBC7D5FE8FC
lunLdLvID.20 = 8E49EBC7D5FE8FC
lunLdLvID.21 = 4400FBF43E69FF0B
lunLdLvID.22 = 4400FBF43E69FF0B
lunLdLvID.23 = 8E49EBC7D5FE8FC
lunLdLvID.24 = 8E49EBC7D5FE8FC
lunLdLvID.25 = 8E49EBC7D5FE8FC
lunLdLvID.26 = 4400FBF43E69FF0B
lunLdLvID.27 = 8E49EBC7D5FE8FC
lunLdLvID.28 = 8E49EBC7D5FE8FC
lunLdLvID.29 = 4400FBF43E69FF0B
lunLdLvID.30 = 4400FBF43E69FF0B
lunLdLvID.31 = 8E49EBC7D5FE8FC
lunLdLvID.32 = 8E49EBC7D5FE8FC
the above are the lun IDs but i don’t know how to extract the size now from those values.