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
HP BladeSystem C3000/C7000 OA #4035
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d95cf4a
added hardware model, software version, fans and ps sensor states, re…
crcro 133a8c8
rewrite the discovery module based on presence oid
crcro 709e941
fixes - PSR-2 style
crcro ca1223c
added sensors for power usage and temperatures of the blade system
crcro b201e64
fix: sensor id for rrd file
crcro b4354b3
rewrite to use snmp_walk against snmp_get for fewer device queries
crcro 2bf54f1
removed useless comments
crcro 370fab0
fix not set
crcro File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
if ($device['os'] == 'hpblmos') { | ||
|
||
$sensor_type = 'hpblmos_psu_usage'; | ||
$psu_oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.16'; | ||
$psu_usage_oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.10.'; | ||
$psu_max_usage_oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.9.'; | ||
|
||
$psus = trim(snmp_walk($device, $psu_oid, '-Osqn')); | ||
|
||
foreach (explode("\n", $psus) as $psu) { | ||
$psu = trim($psu); | ||
if ($psu) { | ||
list($oid, $presence) = explode(' ', $psu, 2); | ||
if ($presence != 2) { | ||
$split_oid = explode('.', $oid); | ||
$current_id = $split_oid[(count($split_oid) - 1)]; | ||
$current_oid = $psu_usage_oid.$current_id; | ||
$psu_max_oid = $psu_max_usage_oid.$current_id; | ||
$descr = 'PSU '.$psuid.' output'; | ||
$value = snmp_get($device, $current_oid, '-Oqv'); | ||
$max_value = snmp_get($device, $psu_max_oid, '-Oqv'); | ||
discover_sensor($valid['sensor'], 'power', $device, $current_oid, $current_id, $sensor_type, $descr, 1, 1, null, null, null, $max_value, $value); | ||
} | ||
} | ||
} | ||
} |
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,95 @@ | ||
<?php | ||
if($device['os'] == "hpblmos") | ||
{ | ||
$fan_state_name = 'hpblmos_fanstate'; | ||
$fan_state_descr = 'Fan '; | ||
$fans_oid = '.1.3.6.1.4.1.232.22.2.3.1.3.1.8'; | ||
$fan_state_oid = '.1.3.6.1.4.1.232.22.2.3.1.3.1.11.'; | ||
|
||
$fans = trim(snmp_walk($device, $fans_oid, '-Osqn')); | ||
|
||
foreach (explode("\n", $fans) as $fan) { | ||
$fan = trim($fan); | ||
if ($fan) { | ||
list($oid, $presence) = explode(' ', $fan, 2); | ||
if ($presence != 2) { | ||
$split_oid = explode('.', $oid); | ||
$current_id = $split_oid[(count($split_oid) - 1)]; | ||
$current_oid = $fan_state_oid.$current_id; | ||
$descr = $fan_state_descr.$current_id; | ||
$state = snmp_get($device, $current_oid, '-Oqv'); | ||
if (!empty($state)) { | ||
$state_index_id = create_state_index($fan_state_name); | ||
if ($state_index_id) { | ||
$states = array( | ||
array($state_index_id, 'other', 0, 1, 3), | ||
array($state_index_id, 'ok', 1, 2, 0), | ||
array($state_index_id, 'degraded', 1, 3, 1), | ||
array($state_index_id, 'failed', 1, 4, 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'); | ||
} | ||
} | ||
} | ||
discover_sensor($valid['sensor'], 'state', $device, $current_oid, $current_id, $fan_state_name, $descr, '1', '1', null, null, null, null, $state, 'snmp', $current_id); | ||
create_sensor_to_state_index($device, $fan_state_name, $current_id); | ||
} | ||
} | ||
|
||
|
||
} | ||
|
||
$psu_oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.16'; | ||
$psu_state_name = 'hpblmos_psustate'; | ||
$psu_state_descr = 'PSU '; | ||
$psu_state_oid = '.1.3.6.1.4.1.232.22.2.5.1.1.1.17.'; | ||
|
||
$psus = trim(snmp_walk($device, $psu_oid, '-Osqn')); | ||
|
||
foreach (explode("\n", $psus) as $psu) { | ||
$psu = trim($psu); | ||
if ($psu) { | ||
list($oid, $presence) = explode(' ', $psu, 2); | ||
if ($presence != 2) { | ||
$split_oid = explode('.', $oid); | ||
$current_id = $split_oid[(count($split_oid) - 1)]; | ||
$current_oid = $psu_state_oid.$current_id; | ||
$descr = $psu_state_descr.$current_id; | ||
$state = snmp_get($device, $current_oid, '-Oqv'); | ||
if (!empty($state)) { | ||
$state_index_id = create_state_index($psu_state_name); | ||
if ($state_index_id) { | ||
$states = array( | ||
array($state_index_id, 'other', 0, 1, 3), | ||
array($state_index_id, 'ok', 1, 2, 0), | ||
array($state_index_id, 'degraded', 1, 3, 1), | ||
array($state_index_id, 'failed', 1, 4, 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'); | ||
} | ||
} | ||
} | ||
discover_sensor($valid['sensor'], 'state', $device, $current_oid, $current_id, $psu_state_name, $descr, '1', '1', null, null, null, null, $state, 'snmp', $current_id); | ||
create_sensor_to_state_index($device, $psu_state_name, $current_id); | ||
} | ||
} | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
if ($device['os'] == 'hpblmos') { | ||
|
||
$sensor_type = 'hpblmos_temps'; | ||
$temps_oid = '.1.3.6.1.4.1.232.22.2.3.1.2.1.5'; | ||
$sensor_value_oid = '.1.3.6.1.4.1.232.22.2.3.1.2.1.6.'; | ||
|
||
$temps = trim(snmp_walk($device, $temps_oid, '-Osqn')); | ||
|
||
foreach (explode("\n", $temps) as $temp) { | ||
$temp = trim($temp); | ||
if ($temp) { | ||
list($oid, $descr) = explode(' ', $temp, 2); | ||
if ($descr != "") { | ||
$split_oid = explode('.', $oid); | ||
$current_id = $split_oid[(count($split_oid) - 1)]; | ||
$current_oid = $sensor_value_oid.$current_id; | ||
$value = snmp_get($device, $current_oid, '-Oqve'); | ||
if ($value > 0) { | ||
discover_sensor($valid['sensor'], 'temperature', $device, $current_oid, $current_id, $sensor_type, $descr, 1, 1, null, null, null, null, $value); | ||
} | ||
} | ||
} | ||
} | ||
} |
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,3 @@ | ||
<?php | ||
$version = trim(snmp_get($device, 'SNMPv2-SMI::enterprises.232.22.2.3.1.1.1.8.1', '-Ovq'), '"'); | ||
$hardware = trim(snmp_get($device, 'SNMPv2-SMI::enterprises.232.22.2.3.1.1.1.3.1', '-Ovq'), '"'); |
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.
$psuid isn't set