Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved support for Equallogic storage arrays and DELL servers #3519

Merged
merged 3 commits into from
May 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ LibreNMS contributors:
- Jussi Sorjonen <mieleton@mieleton.net> (mieleton)
- Jens Langhammer <jens@beryju.org> (BeryJu)
- Robert Verspuy <robert@exa.nl> (exarv)
- Peter Tkatchenko <peter@flytrace.com> (Peter2121)

[1]: http://observium.org/ "Observium web site"
Observium was written by:
Expand Down
2 changes: 2 additions & 0 deletions includes/definitions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,8 @@
$config['os'][$os]['icon'] = 'dell';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
$config['os'][$os]['over'][1]['graph'] = 'device_storage';
$config['os'][$os]['over'][1]['text'] = 'Storage Usage';

$os = 'drac';
$config['os'][$os]['text'] = 'Dell DRAC';
Expand Down
83 changes: 75 additions & 8 deletions includes/discovery/sensors/states/dell.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
* Modyfied by Peter TKATCHENKO https://github.com/Peter2121/ 2016
*
* 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
Expand All @@ -12,19 +13,85 @@
* the source code distribution for details.
*/

if ($device['os'] == 'linux') {
$oids = snmp_walk($device, 'virtualDiskNumber', '-Oesqn', 'StorageManagement-MIB');
$main_oid = '.1.3.6.1.4.1.674.10893.1.20.140.1.1.';
$oids = snmp_walk($device, 'virtualDiskDeviceName', '-Oesqn', 'StorageManagement-MIB');
$name_oid = '.1.3.6.1.4.1.674.10893.1.20.140.1.1.3';
$main_oid = '.1.3.6.1.4.1.674.10893.1.20.140.1.1.4.';
d_echo($oids."\n");

$oids = trim($oids);
if ($oids) {
echo 'Dell ';

$state_name = 'dellVirtualDiskState';
$state_index_id = create_state_index($state_name);
/*
-- 1.3.6.1.4.1.674.10893.1.20.140.1.1.4
virtualDiskState
INTEGER
{
unknown(0),
ready(1),
failed(2),
online(3),
offline(4),
degraded(6),
verifying(7),
resynching(15),
regenerating(16),
failedRedundancy(18),
rebuilding(24),
formatting(26),
reconstructing(32),
initializing(35),
backgroundInit(36),
permanentlyDegraded(52)
}
*/
if ($state_index_id) {
$states = array(
array($state_index_id,'unknown',0,0,3) ,
array($state_index_id,'ready',1,1,0) ,
array($state_index_id,'failed',1,2,2) ,
array($state_index_id,'online',1,3,1) ,
array($state_index_id,'offline',1,4,2) ,
array($state_index_id,'degraded',1,6,2) ,
array($state_index_id,'verifying',1,7,1) ,
array($state_index_id,'resynching',1,15,1) ,
array($state_index_id,'regenerating',1,16,1) ,
array($state_index_id,'failedRedundancy',1,18,2) ,
array($state_index_id,'rebuilding',1,24,1) ,
array($state_index_id,'formatting',1,26,1) ,
array($state_index_id,'reconstructing',1,32,1) ,
array($state_index_id,'initializing',1,35,1) ,
array($state_index_id,'backgroundInit',1,36,1) ,
array($state_index_id,'permanentlyDegraded',1,52,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');
}
}

foreach (explode("\n", $oids) as $data) {
list($oid,) = explode(' ', $data, 2);
$state_oid = '4.1';
$state_current = snmp_get($device, $main_oid.$state_oid, '-Oevq');
discover_sensor($valid['sensor'], 'state', $device, $main_oid.$state_oid, "virtualDiskState.$state_oid", 'dell', 'Raid State', '1', '1', null, null, null, null, $state_current);
list($oid,$name) = explode(' ', $data, 2);
$name = trim($name,"\"");
if($oid==$name_oid) continue; // Something goes wrong, we should have $name_oid.$num_index in $oid
$split_oid = explode('.', $oid);
$num_index = $split_oid[(count($split_oid) - 1)];
$index = (int)$num_index+0;
$oid = $main_oid.$num_index;
$low_limit = 0.5;
$high_limit = 1.5;

$state_current = snmp_get($device, $oid, '-Oevq');
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $name, '1', '1', $low_limit, $low_limit, $high_limit, $high_limit, $state_current,'snmp',$index);
create_sensor_to_state_index($device, $state_name, $index);
}
}
}
148 changes: 127 additions & 21 deletions includes/discovery/sensors/states/equallogic.inc.php
Original file line number Diff line number Diff line change
@@ -1,40 +1,146 @@
<?php

/*
* LibreNMS
*
* Copyright (c) 2016 Peter TKATCHENKO https://github.com/Peter2121/
*
* 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
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/

if ($device['os'] == 'equallogic') {
$oids = snmp_walk($device, 'eqlMemberHealthDetailsPowerSupplyName', '-OQn', 'EQLMEMBER-MIB', $config['install_dir'].'/mibs/equallogic');
$oids = snmp_walk($device, 'eqlMemberHealthStatus', '-OQne', 'EQLMEMBER-MIB', $config['install_dir'].'/mibs/equallogic');

d_echo('Health oids:');
d_echo($oids."\n");

/*
eqlMemberHealthStatus
INTEGER {
unknown (0),
normal (1),
warning (2),
critical (3)
}
DESCRIPTION The value of this object is determinted by the severity of the
health condition state variables. The most severe state will
be reflected.

The LibreNMS generic states is derived from Nagios:
0 = OK
1 = Warning
2 = Critical
3 = Unknown

*/

if (!empty($oids)) {
$descr='Health';

$state_name = 'eqlMemberHealthStatus';
$state_index_id = create_state_index($state_name);

if ($state_index_id) {
$states = array(
array($state_index_id,'unknown',0,0,3) ,
array($state_index_id,'normal',1,1,0) ,
array($state_index_id,'warning',1,2,1) ,
array($state_index_id,'critical',1,3,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');
}
}

foreach (explode("\n", $oids) as $data) {
$data = trim($data);
if (!empty($data)) {
list($oid,$current) = explode(' = ', $data, 2);
$split_oid = explode('.', $oid);
$num_index = $split_oid[(count($split_oid) - 1)];
$index = (int)$num_index+0;
$low_limit = 0.5;
$high_limit = 2.5;
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, 1, 1, $low_limit, $low_limit, $high_limit, $high_limit, $current, 'snmp', $index);
create_sensor_to_state_index($device, $state_name, $index);
}
}
}

$oids1 = snmp_walk($device, 'eqlMemberHealthDetailsPowerSupplyName', '-OQn', 'EQLMEMBER-MIB', $config['install_dir'].'/mibs/equallogic');

d_echo('PowerSupplyName oids:');
d_echo($oids1."\n");

/*
.1.3.6.1.4.1.12740.2.1.8.1.2.1.329840783.1 = Power Cooling Module 0
.1.3.6.1.4.1.12740.2.1.8.1.2.1.329840783.2 = Power Cooling Module 1
**/

d_echo($oids."\n");
if (!empty($oids)) {
echo 'EQLCONTROLLER-MIB ';
foreach (explode("\n", $oids) as $data) {
$base_oid = '.1.3.6.1.4.1.12740.2.1.8.1.3.1.'; // eqlMemberHealthDetailsPowerSupplyCurrentState

if (!empty($oids1)) {
/*
eqlMemberHealthDetailsPowerSupplyCurrentState
INTEGER {
on-and-operating (1),
no-ac-power (2),
failed-or-no-data (3) -- has ac but no dc out or we have no data
}
*/
$state_name1 = 'eqlMemberPowerSupplyCurrentState';
$state_index_id1 = create_state_index($state_name1);

if ($state_index_id1) {
$states1 = array(
array($state_index_id1,'on-and-operating',1,1,0) ,
array($state_index_id1,'no-ac-power',1,2,1) ,
array($state_index_id1,'failed-or-no-data',1,3,2)
);
foreach($states1 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');
}
}

foreach (explode("\n", $oids1) as $data) {
$data = trim($data);
if (!empty($data)) {
list($oid,$descr) = explode(' = ', $data, 2);
$split_oid = explode('.', $oid);
$num_index = $split_oid[(count($split_oid) - 1)];
$index = $num_index;
$part_oid = $split_oid[(count($split_oid) - 2)];
$num_index = $part_oid.'.'.$num_index;
$base_oid = '.1.3.6.1.4.1.12740.2.1.8.1.3.1.';
$index = (int)$num_index+0;
$member_id = $split_oid[(count($split_oid) - 2)];
$num_index = $member_id.'.'.$num_index;
$oid = $base_oid.$num_index;
$extra = snmp_get_multi($device, "eqlMemberHealthDetailsPowerSupplyCurrentState.3.329840783.$index", '-OQUse', 'EQLMEMBER-MIB', $config['install_dir'].'/mibs/equallogic');
$keys = array_keys($extra);
$temperature = $extra[$keys[0]]['eqlMemberHealthDetailsPowerSupplyValue'];
$low_limit = $extra[$keys[0]]['eqlMemberHealthDetailsPowerSupplyLowCriticalThreshold'];
$low_warn = $extra[$keys[0]]['eqlMemberHealthDetailsPowerSupplyLowWarningThreshold'];
$high_limit = $extra[$keys[0]]['eqlMemberHealthDetailsPowerSupplyHighCriticalThreshold'];
$high_warn = $extra[$keys[0]]['eqlMemberHealthDetailsPowerSupplyHighWarningThreshold'];
$index = (100 + $index);

if ($extra[$keys[0]]['eqlMemberHealthDetailsPowerSupplyCurrentState'] != 'unknown') {
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, 'snmp', $descr, 1, 1, $low_limit, $low_warn, $high_limit, $high_warn, $temperature);
$extra = snmp_get_multi($device, $oid, '-OQne', 'EQLMEMBER-MIB', $config['install_dir'].'/mibs/equallogic');
d_echo($extra);
if(!empty($extra)) {
list($foid,$pstatus) = explode(' = ',$extra,2);
$index = (100 + $index);
$low_limit = 0.5;
$high_limit = 1.5;
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name1, $descr, 1, 1, $low_limit, $low_limit, $high_limit, $high_limit, $pstatus, 'snmp', $index);
create_sensor_to_state_index($device, $state_name1, $index);
}
}//end if
}//end foreach
}//end if
}//end if empty oids
}//end if
38 changes: 38 additions & 0 deletions includes/discovery/storage/eql-storage.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/*
* LibreNMS
*
* Copyright (c) 2016 Peter TKATCHENKO https://github.com/Peter2121/
*
* 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
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/

$eql_storage = snmpwalk_cache_oid($device, 'EqliscsiVolumeEntry', null, 'EQLVOLUME-MIB', $config['install_dir'].'/mibs/equallogic');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think you need to check if the os is equallogic first otherwise this will run for all devices.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

Two others (hrstorage and netapp) have no this check.
The only working line is snmpwalk_cache_oid(...) without this check.
Do you really think this check would be useful?
Are use sure $os is always populated when this include works?

Peter

On 05/17/2016 00:24, Neil Lathwood wrote:

In includes/discovery/storage/eql-storage.inc.php
#3519 (comment):

@@ -0,0 +1,37 @@
+<?php
+
+/*

  • * LibreNMS
  • * Copyright (c) 2016 Peter TKATCHENKO https://github.com/Peter2121/
  • * 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
  • * option) any later version. Please see LICENSE.txt at the top level of
  • * the source code distribution for details.
  • */
    +
    +$eql_storage = snmpwalk_cache_oid($device, 'EqliscsiVolumeEntry', null, 'EQLVOLUME-MIB', $config['install_dir'].'/mibs/equallogic');

Think you need to check if the os is equallogic first otherwise this
will run for all devices.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/librenms/librenms/pull/3519/files/c99c74bd9554ad24654cd690b5b337ed5da8f47c#r63436648

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point actually. We'll leave it for now but this does raise that we need to force os check as being the first thing that runs.


if (is_array($eql_storage)) {
echo 'EqliscsiVolumeEntry ';
foreach ($eql_storage as $index => $storage) {
$fstype = $storage['eqliscsiVolumeAdminStatus'];
$descr = $storage['eqliscsiVolumeName'];
$units = 1;
$size = $storage['eqliscsiVolumeSize'] * $units;
$used = $storage['eqliscsiVolumeStatusAllocatedSpace'] * $units;
if (is_int($index)) {
discover_storage($valid_storage, $device, $index, $fstype, 'eql-storage', $descr, $size, $units, $used);
}
else {
// Trying to search the last '.' and take something after it as index
$arrindex = explode(".", $index);
$newindex = (int)(end($arrindex))+0;
if (is_int($newindex)) {
discover_storage($valid_storage, $device, $newindex, $fstype, 'eql-storage', $descr, $size, $units, $used);
}
}
unset($deny, $fstype, $descr, $size, $used, $units, $storage_rrd, $old_storage_rrd, $hrstorage_array);
}
}
59 changes: 59 additions & 0 deletions includes/polling/storage/eql-storage.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

/*
* LibreNMS
*
* Copyright (c) 2016 Peter TKATCHENKO https://github.com/Peter2121/
*
* 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
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/

if (!is_array($storage_cache1['eql-storage'])) {
$storage_cache1['eql-storage'] = snmpwalk_cache_oid($device, 'EqliscsiVolumeEntry', null, 'EQLVOLUME-MIB', $config['install_dir'].'/mibs/equallogic');
d_echo($storage_cache1);
}

if (!is_array($storage_cache2['eql-storage'])) {
$storage_cache2['eql-storage'] = snmpwalk_cache_oid($device, 'EqliscsiVolumeStatusEntry', null, 'EQLVOLUME-MIB', $config['install_dir'].'/mibs/equallogic');
d_echo($storage_cache2);
}

$iind = 0;
$storage_cache10 = array();
$storage_cache20 = array();

d_echo($storage);

foreach ($storage_cache1['eql-storage'] as $index => $ventry) {
if (!array_key_exists('eqliscsiVolumeName', $ventry)) continue;
if (is_int($index)) $iind = $index;
else {
$arrindex = explode(".", $index);
$iind = (int)(end($arrindex))+0;
}
if (is_int($iind)) $storage_cache10[$iind] = $ventry;
}
d_echo($storage_cache10);

foreach ($storage_cache2['eql-storage'] as $index => $vsentry) {
if (!array_key_exists('eqliscsiVolumeStatusAvailable', $vsentry)) continue;
if (is_int($index)) $iind = $index;
else {
$arrindex = explode(".", $index);
$iind = (int)(end($arrindex))+0;
}
if (is_int($iind)) $storage_cache20[$iind] = $vsentry;
}
d_echo($storage_cache20);

$entry1 = $storage_cache10[$storage[storage_index]];
$entry2 = $storage_cache20[$storage[storage_index]];

$storage['units'] = 1;
$storage['size'] = ($entry1['eqliscsiVolumeSize'] * $storage['units']);
$storage['used'] = ($entry2['eqliscsiVolumeStatusAllocatedSpace'] * $storage['units']);
$storage['free'] = ($storage['size'] - $storage['used']);