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

HP BladeSystem C3000/C7000 OA #4035

Merged
merged 8 commits into from Aug 16, 2016
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions includes/definitions.inc.php
Expand Up @@ -1787,10 +1787,6 @@
$config['os'][$os]['icon'] = 'hp';
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
$config['os'][$os]['over'][0]['text'] = 'Traffic';
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
$config['os'][$os]['over'][1]['text'] = 'CPU Usage';
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';

// HP MSM
$os = 'hpmsm';
Expand Down
27 changes: 27 additions & 0 deletions includes/discovery/sensors/power/hpblmos.inc.php
@@ -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';
Copy link
Member

Choose a reason for hiding this comment

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

$psuid isn't set

$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);
}
}
}
}
95 changes: 95 additions & 0 deletions includes/discovery/sensors/states/hpblmos.inc.php
@@ -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);
}
}
}
}
25 changes: 25 additions & 0 deletions includes/discovery/sensors/temperatures/hpblmos.inc.php
@@ -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);
}
}
}
}
}
3 changes: 3 additions & 0 deletions includes/polling/os/hpblmos.inc.php
@@ -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'), '"');