-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
|
||
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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.