mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
newdevice: Added support for enLogic PDUs (#6464)
This commit is contained in:
parent
b27e200a6c
commit
3ff8b269f5
BIN
html/images/logos/enlogic.png
Normal file
BIN
html/images/logos/enlogic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
html/images/os/enlogic.png
Normal file
BIN
html/images/os/enlogic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1020 B |
14
includes/definitions/enlogic-pdu.yaml
Normal file
14
includes/definitions/enlogic-pdu.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
os: enlogic-pdu
|
||||
type: power
|
||||
text: enLogic PDU
|
||||
icon: enlogic
|
||||
over:
|
||||
- { graph: device_voltage, text: 'Voltage' }
|
||||
- { graph: device_current, text: 'Current' }
|
||||
- { graph: device_power, text: 'Power' }
|
||||
- { graph: device_state, text: 'State' }
|
||||
mib_dir:
|
||||
- enlogic
|
||||
discovery:
|
||||
- sysObjectId:
|
||||
- .1.3.6.1.4.1.38446.
|
60
includes/discovery/sensors/current/enlogic-pdu.inc.php
Normal file
60
includes/discovery/sensors/current/enlogic-pdu.inc.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* enlogic-pdu.inc.php
|
||||
*
|
||||
* LibreNMS sensors current discovery module for enLOGIC PDU
|
||||
*
|
||||
* 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 <gh+n@laf.io>
|
||||
*/
|
||||
|
||||
foreach ($pre_cache['enlogic_pdu_input'] as $index => $data) {
|
||||
if (is_array($data)) {
|
||||
$oid = '.1.3.6.1.4.1.38446.1.3.4.1.5.' . $index;
|
||||
$tmp_index = 'pduInputPhaseStatusCurrent.' . $index;
|
||||
$descr = "Input Phase $index";
|
||||
$divisor = 1;
|
||||
$type = "enlogic-pdu";
|
||||
$low_limit = $data['pduInputPhaseConfigCurrentLowerCriticalThreshold'];
|
||||
$low_warn = $data['pduInputPhaseConfigCurrentLowerWarningThreshold'];
|
||||
$high_limit = $data['pduInputPhaseConfigCurrentUpperCriticalThreshold'];
|
||||
$high_warn = $data['pduInputPhaseConfigCurrentUpperWarningThreshold'];
|
||||
$current = $data['pduInputPhaseStatusCurrent'];
|
||||
if ($current > 0) {
|
||||
discover_sensor($valid['sensor'], 'current', $device, $oid, $tmp_index, $type, $descr, $divisor, '1', $low_limit, $low_warn, $high_warn, $high_limit, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($pre_cache['enlogic_pdu_circuit'] as $index => $data) {
|
||||
if (is_array($data)) {
|
||||
$oid = '.1.3.6.1.4.1.38446.1.4.4.1.5.' . $index;
|
||||
$tmp_index = 'pduCircuitBreakerStatusCurrent.' . $index;
|
||||
$descr = "Input Phase {$data['pduCircuitBreakerLabel']}";
|
||||
$divisor = 1;
|
||||
$type = "enlogic-pdu";
|
||||
$low_limit = $data['pduCircuitBreakerConfigLowerCriticalThreshold'];
|
||||
$low_warn = $data['pduCircuitBreakerConfigLowerWarningThreshold'];
|
||||
$high_limit = $data['pduCircuitBreakerConfigUpperCriticalThreshold'];
|
||||
$high_warn = $data['pduCircuitBreakerConfigUpperWarningThreshold'];
|
||||
$current = $data['pduCircuitBreakerStatusCurrent'];
|
||||
if ($current > 0) {
|
||||
discover_sensor($valid['sensor'], 'current', $device, $oid, $tmp_index, $type, $descr, $divisor, '1', $low_limit, $low_warn, $high_warn, $high_limit, $current);
|
||||
}
|
||||
}
|
||||
}
|
47
includes/discovery/sensors/power/enlogic-pdu.inc.php
Normal file
47
includes/discovery/sensors/power/enlogic-pdu.inc.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* enlogic-pdu.inc.php
|
||||
*
|
||||
* LibreNMS sensors power discovery module for enLOGIC PDU
|
||||
*
|
||||
* 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 <gh+n@laf.io>
|
||||
*/
|
||||
|
||||
foreach ($pre_cache['enlogic_pdu_status'] as $index => $data) {
|
||||
if (is_array($data)) {
|
||||
$current = $data['pduUnitStatusActivePower'];
|
||||
$descr = "Active power #$index";
|
||||
$oid = '.1.3.6.1.4.1.38446.1.2.4.1.4.' . $index;
|
||||
if ($current > 0) {
|
||||
discover_sensor($valid['sensor'], 'power', $device, $oid, $index, 'enlogic-pdu', $descr, 1, 1, null, null, null, null, $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($pre_cache['enlogic_pdu_input'] as $index => $data) {
|
||||
if (is_array($data)) {
|
||||
$current = $data['pduInputPhaseStatusActivePower'];
|
||||
$tmp_index = "pduInputPhaseStatusActivePower." . $index;
|
||||
$descr = "Input Phase #" . $index;
|
||||
$oid = '.1.3.6.1.4.1.38446.1.3.4.1.7.' . $index;
|
||||
if ($current > 0) {
|
||||
discover_sensor($valid['sensor'], 'power', $device, $oid, $tmp_index, 'enlogic-pdu', $descr, 1, 1, null, null, null, null, $current);
|
||||
}
|
||||
}
|
||||
}
|
37
includes/discovery/sensors/pre-cache/enlogic-pdu.inc.php
Normal file
37
includes/discovery/sensors/pre-cache/enlogic-pdu.inc.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* enlogic-pdu.inc.php
|
||||
*
|
||||
* LibreNMS sensors pre-cache discovery module for enLOGIC PDU
|
||||
*
|
||||
* 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 <gh+n@laf.io>
|
||||
*/
|
||||
|
||||
echo 'pduUnitStatusTable ';
|
||||
$pre_cache['enlogic_pdu_status'] = snmpwalk_cache_oid($device, 'pduUnitStatusTable', array(), 'ENLOGIC-PDU-MIB');
|
||||
|
||||
echo 'pduInputPhaseConfigTable ';
|
||||
$pre_cache['enlogic_pdu_input'] = snmpwalk_cache_oid($device, 'pduInputPhaseConfigTable', array(), 'ENLOGIC-PDU-MIB');
|
||||
echo 'pduInputPhaseStatusTable ';
|
||||
$pre_cache['enlogic_pdu_input'] = snmpwalk_cache_oid($device, 'pduInputPhaseStatusTable', $pre_cache['enlogic_pdu_input'], 'ENLOGIC-PDU-MIB');
|
||||
|
||||
echo 'pduCircuitBreakerConfigTable ';
|
||||
$pre_cache['enlogic_pdu_circuit'] = snmpwalk_cache_oid($device, 'pduCircuitBreakerConfigTable', array(), 'ENLOGIC-PDU-MIB');
|
||||
echo 'pduCircuitBreakerStatusTable ';
|
||||
$pre_cache['enlogic_pdu_circuit'] = snmpwalk_cache_oid($device, 'pduCircuitBreakerStatusTable', $pre_cache['enlogic_pdu_circuit'], 'ENLOGIC-PDU-MIB');
|
173
includes/discovery/sensors/state/enlogic-pdu.inc.php
Normal file
173
includes/discovery/sensors/state/enlogic-pdu.inc.php
Normal file
@ -0,0 +1,173 @@
|
||||
<?php
|
||||
/**
|
||||
* enlogic-pdu.inc.php
|
||||
*
|
||||
* LibreNMS sensors state discovery module for enLOGIC PDU
|
||||
*
|
||||
* 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 <gh+n@laf.io>
|
||||
*/
|
||||
|
||||
foreach ($pre_cache['enlogic_pdu_status'] as $index => $data) {
|
||||
if (is_array($data)) {
|
||||
$oid = '.1.3.6.1.4.1.38446.1.2.4.1.3.' . $index;
|
||||
$state_name = 'pduUnitStatusLoadState';
|
||||
$state_index_id = create_state_index($state_name);
|
||||
$current = $data['pduUnitStatusLoadState'];
|
||||
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
$states = array(
|
||||
array($state_index_id, 'upperCritical', 1, 1, 2),
|
||||
array($state_index_id, 'upperWarning', 1, 2, 1),
|
||||
array($state_index_id, 'lowerWarning', 1, 3, 1),
|
||||
array($state_index_id, 'lowerCritical', 1, 4, 2),
|
||||
array($state_index_id, 'normal', 1, 5, 0),
|
||||
);
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
$descr = "Load state #$index";
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $current);
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($pre_cache['enlogic_pdu_input'] as $index => $data) {
|
||||
if (is_array($data)) {
|
||||
$oid = '.1.3.6.1.4.1.38446.1.3.4.1.3.' . $index;
|
||||
$tmp_index = $state_name . '.' . $index;
|
||||
$state_name = 'pduInputPhaseStatusCurrentState';
|
||||
$current = $data['pduInputPhaseStatusCurrentState'];
|
||||
$descr = "Current state #$index";
|
||||
if (!is_numeric($current)) {
|
||||
$state_index_id = create_state_index($state_name);
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
$states = array(
|
||||
array($state_index_id, 'upperCritical', 1, 1, 2),
|
||||
array($state_index_id, 'upperWarning', 1, 2, 1),
|
||||
array($state_index_id, 'lowerWarning', 1, 3, 1),
|
||||
array($state_index_id, 'lowerCritical', 1, 4, 2),
|
||||
array($state_index_id, 'normal', 1, 5, 0),
|
||||
);
|
||||
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 Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $oid, $tmp_index, $state_name, $descr, '1', '1', null, null, null, null, $current);
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $tmp_index);
|
||||
}
|
||||
|
||||
$oid = '.1.3.6.1.4.1.38446.1.3.4.1.4.' . $index;
|
||||
$tmp_index = $state_name . '.' . $index;
|
||||
$state_name = 'pduInputPhaseStatusVoltageState';
|
||||
$current = $data['pduInputPhaseStatusVoltageState'];
|
||||
$descr = "Voltage state #$index";
|
||||
if (!is_numeric($current)) {
|
||||
$state_index_id = create_state_index($state_name);
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
$states = array(
|
||||
array($state_index_id, 'upperCritical', 1, 1, 2),
|
||||
array($state_index_id, 'upperWarning', 1, 2, 1),
|
||||
array($state_index_id, 'lowerWarning', 1, 3, 1),
|
||||
array($state_index_id, 'lowerCritical', 1, 4, 2),
|
||||
array($state_index_id, 'normal', 1, 5, 0),
|
||||
);
|
||||
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 Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $oid, $tmp_index, $state_name, $descr, '1', '1', null, null, null, null, $current);
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $tmp_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($pre_cache['enlogic_pdu_circuit'] as $index => $data) {
|
||||
if (is_array($data)) {
|
||||
$oid = '.1.3.6.1.4.1.38446.1.4.4.1.4.' . $index;
|
||||
$state_name = 'pduCircuitBreakerStatusLoadState';
|
||||
$state_index_id = create_state_index($state_name);
|
||||
$current = $data['pduCircuitBreakerStatusLoadState'];
|
||||
|
||||
if (!is_numeric($current)) {
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
$states = array(
|
||||
array($state_index_id, 'upperCritical', 1, 1, 2),
|
||||
array($state_index_id, 'upperWarning', 1, 2, 1),
|
||||
array($state_index_id, 'lowerWarning', 1, 3, 1),
|
||||
array($state_index_id, 'lowerCritical', 1, 4, 2),
|
||||
array($state_index_id, 'normal', 1, 5, 0),
|
||||
);
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
$descr = "Circuit breaker state {$data['pduCircuitBreakerLabel']}";
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $current);
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset(
|
||||
$index,
|
||||
$data
|
||||
);
|
41
includes/discovery/sensors/voltage/enlogic-pdu.inc.php
Normal file
41
includes/discovery/sensors/voltage/enlogic-pdu.inc.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* enlogic-pdu.inc.php
|
||||
*
|
||||
* LibreNMS sensors voltage discovery module for enLOGIC PDU
|
||||
*
|
||||
* 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 <gh+n@laf.io>
|
||||
*/
|
||||
|
||||
foreach ($pre_cache['enlogic_pdu_input'] as $index => $data) {
|
||||
if (is_array($data)) {
|
||||
$oid = '.1.3.6.1.4.1.38446.1.3.4.1.6.' . $index;
|
||||
$descr = "Input Phase $index";
|
||||
$divisor = 1;
|
||||
$type = "enlogic-pdu";
|
||||
$low_limit = $data['pduInputPhaseConfigVoltageLowerCriticalThreshold'];
|
||||
$low_warn = $data['pduInputPhaseConfigVoltageLowerWarningThreshold'];
|
||||
$high_limit = $data['pduInputPhaseConfigVoltageUpperCriticalThreshold'];
|
||||
$high_warn = $data['pduInputPhaseConfigVoltageUpperWarningThreshold'];
|
||||
$current = $data['pduInputPhaseStatusVoltage'];
|
||||
if ($current > 0) {
|
||||
discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', $low_limit, $low_warn, $high_warn, $high_limit, $current);
|
||||
}
|
||||
}
|
||||
}
|
32
includes/polling/os/enlogic-pdu.inc.php
Normal file
32
includes/polling/os/enlogic-pdu.inc.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* enlogic-pdu.inc.php
|
||||
*
|
||||
* LibreNMS os polling module for enLogic PDU
|
||||
*
|
||||
* 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>
|
||||
*/
|
||||
|
||||
$tmp_enlogic = snmp_get_multi_oid($device, 'pduNamePlateModelNumber pduNamePlateSerialNumber pduNamePlateFirmwareVersion', '-OUQn', 'ENLOGIC-PDU-MIB');
|
||||
|
||||
$hardware = $tmp_enlogic['.1.3.6.1.4.1.38446.1.1.2.1.10.1'];
|
||||
$serial = $tmp_enlogic['.1.3.6.1.4.1.38446.1.1.2.1.11.1'];
|
||||
$version = $tmp_enlogic['.1.3.6.1.4.1.38446.1.1.2.1.13.1'];
|
||||
|
||||
unset($tmp_enlogic);
|
5191
mibs/enlogic/ENLOGIC-PDU-MIB
Normal file
5191
mibs/enlogic/ENLOGIC-PDU-MIB
Normal file
File diff suppressed because it is too large
Load Diff
@ -684,6 +684,11 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase
|
||||
$this->checkOS('engenius', 'engenius2');
|
||||
}
|
||||
|
||||
public function testEnlogicPDU()
|
||||
{
|
||||
$this->checkOS('enlogic-pdu');
|
||||
}
|
||||
|
||||
public function testEnterasys()
|
||||
{
|
||||
$this->checkOS('enterasys');
|
||||
|
2
tests/snmpsim/enlogic-pdu.snmprec
Normal file
2
tests/snmpsim/enlogic-pdu.snmprec
Normal file
@ -0,0 +1,2 @@
|
||||
1.3.6.1.2.1.1.1.0|4|Enlogic PDU
|
||||
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.38446.1
|
Loading…
Reference in New Issue
Block a user