newdevice: Added sensors + additional info for HPE iPDU (#6382)

* newdevice: Added sensors + additional info for HPE iPDU

* added trim
This commit is contained in:
Neil Lathwood
2017-04-08 04:19:38 +01:00
committed by Tony Murray
parent 4ab358501d
commit 0190691061
8 changed files with 6133 additions and 1 deletions

View File

@@ -4,6 +4,8 @@ type: power
icon: hpe
over:
- { graph: device_bits, text: Traffic }
mib_dir:
- hp
discovery:
- sysObjectId:
- .1.3.6.1.4.1.232.165.5

View File

@@ -0,0 +1,45 @@
<?php
/**
* hpe-ipdu.inc.php
*
* LibreNMS sensors current discovery module for HPE iPDU
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
echo 'HPE iPDU Current ';
$x=1;
foreach ($pre_cache['hpe_ipdu'] as $index => $item) {
if (isset($item['mpduOutputCurrent'])) {
$oid = '.1.3.6.1.4.1.232.165.5.2.1.1.7.' . $index;
$current = $item['mpduOutputCurrent'];
discover_sensor($valid['sensor'], 'current', $device, $oid, 'mpduOutputCurrent.'.$index, 'hpe-ipdu', "MPDU #$x Current", 100, 1, null, null, null, null, $current);
$x++;
}
}//end foreach
unset(
$item,
$oid,
$index,
$item,
$x
);

View File

@@ -0,0 +1,45 @@
<?php
/**
* hpe-ipdu.inc.php
*
* LibreNMS sensors load discovery module for HPE iPDU
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
echo 'HPE iPDU Load ';
$x=1;
foreach ($pre_cache['hpe_ipdu'] as $index => $item) {
if (isset($item['mpduOutputPercentLoad'])) {
$oid = '.1.3.6.1.4.1.232.165.5.2.1.1.5.' . $index;
$current = $item['mpduOutputPercentLoad'];
discover_sensor($valid['sensor'], 'load', $device, $oid, 'mpduOutputPercentLoad.'.$index, 'hpe-ipdu', "MPDU #$x Load", 1, 1, null, null, null, null, $current);
$x++;
}
}//end foreach
unset(
$item,
$oid,
$index,
$item,
$x
);

View File

@@ -0,0 +1,45 @@
<?php
/**
* hpe-ipdu.inc.php
*
* LibreNMS sensors power discovery module for HPE iPDU
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
echo 'HPE iPDU Power ';
$x=1;
foreach ($pre_cache['hpe_ipdu'] as $index => $item) {
if (isset($item['mpduOutputPowerFactor'])) {
$oid = '.1.3.6.1.4.1.232.165.5.2.1.1.10.' . $index;
$current = $item['mpduOutputPowerFactor'];
discover_sensor($valid['sensor'], 'power', $device, $oid, 'mpduOutputPowerFactor.'.$index, 'hpe-ipdu', "MPDU #$x Power", 100, 1, null, null, null, null, $current);
$x++;
}
}//end foreach
unset(
$item,
$oid,
$index,
$item,
$x
);

View File

@@ -0,0 +1,29 @@
<?php
/**
* hpe-ipdu.inc.php
*
* LibreNMS sensors pre-cache discovery module for HPE iPDU
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
if ($device['os'] === 'hpe-ipdu') {
$pre_cache['hpe_ipdu'] = snmpwalk_cache_oid($device, 'mpduOutputEntry', array(), 'CPQPOWER-MIB');
d_echo($pre_cache);
}

View File

@@ -0,0 +1,45 @@
<?php
/**
* hpe-ipdu.inc.php
*
* LibreNMS sensors voltage discovery module for HPE iPDU
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
echo 'HPE iPDU Voltage ';
$x=1;
foreach ($pre_cache['hpe_ipdu'] as $index => $item) {
if (isset($item['mpduOutputVoltage'])) {
$oid = '.1.3.6.1.4.1.232.165.5.2.1.1.6.' . $index;
$current = $item['mpduOutputVoltage'];
discover_sensor($valid['sensor'], 'voltage', $device, $oid, 'mpduOutputVoltage.'.$index, 'hpe-ipdu', "MPDU #$x Voltage", 10, 1, null, null, null, null, $current);
$x++;
}
}//end foreach
unset(
$item,
$oid,
$index,
$item,
$x
);

View File

@@ -23,4 +23,10 @@
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
list(,$version) = explode('firmware version', $poll_device['sysDescr']);
$hpe_ipdu_data = snmp_get_multi_oid($device, 'mpduFirmwareVersion.0 mpduSerialNumber.0 mpduModel.0', '-OUQs', 'CPQPOWER-MIB');
$serial = trim($hpe_ipdu_data['mpduSerialNumber.1'], '"');
$version = trim($hpe_ipdu_data['mpduFirmwareVersion.1'], '"');
$hardware = trim($hpe_ipdu_data['mpduModel.1'], '"');
unset($hpe_ipdu_data);

5915
mibs/hp/CPQPOWER-MIB Normal file

File diff suppressed because it is too large Load Diff