mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
newdevice: Added more sensor support for raritan devices (#6929)
* newdevice: Added more sensor support for raritan devices * Updated PDU-MIB * Added more hover graphs to overview
This commit is contained in:
committed by
Tony Murray
parent
a58a2d8677
commit
afcc2b5e2d
@@ -3,6 +3,8 @@ text: 'Raritan PDU'
|
||||
type: power
|
||||
over:
|
||||
- { graph: device_current, text: Current }
|
||||
- { graph: device_temperature, text: Temperature }
|
||||
- { graph: device_voltage, text: Voltage }
|
||||
icon: raritan
|
||||
discovery:
|
||||
- sysObjectId: .1.3.6.1.4.1.13742
|
||||
|
||||
@@ -60,3 +60,43 @@ foreach (explode("\n", $outlet_oids) as $outlet_data) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* raritan.inc.php
|
||||
*
|
||||
* LibreNMS current sensor discovery module for Raritan
|
||||
*
|
||||
* 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['raritan_inletTable'] as $index => $raritan_data) {
|
||||
for ($x=1; $x<=$raritan_data['inletPoleCount']; $x++) {
|
||||
$tmp_index = "$index.$x";
|
||||
$new_index = "inletPoleCurrent.$tmp_index";
|
||||
$oid = '.1.3.6.1.4.1.13742.4.1.21.2.1.3.'. $tmp_index;
|
||||
$descr = 'Inlet ' . $pre_cache['raritan_inletPoleTable'][$index][$x]['inletPoleLabel'];
|
||||
$divisor = 1000;
|
||||
$low_limit = $raritan_data['inletCurrentUpperCritical'] / $divisor;
|
||||
$low_warn_limit = $raritan_data['inletCurrentUpperWarning'] / $divisor;
|
||||
$warn_limit = $raritan_data['inletCurrentLowerWarning'] / $divisor;
|
||||
$high_limit = $raritan_data['inletCurrentLowerCritical'] / $divisor;
|
||||
$current = $pre_cache['raritan_inletPoleTable'][$index][$x]['inletPoleCurrent'] / $divisor;
|
||||
discover_sensor($valid["sensor"], "current", $device, $oid, $tmp_index, 'raritan', $descr, $divisor, 1, $low_limit, $low_limit, $warn_limit, $high_limit, $current);
|
||||
}
|
||||
}
|
||||
|
||||
30
includes/discovery/sensors/pre-cache/raritan.inc.php
Normal file
30
includes/discovery/sensors/pre-cache/raritan.inc.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* raritan.inc.php
|
||||
*
|
||||
* LibreNMS pre-cache discovery module for Raritan
|
||||
*
|
||||
* 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 'inletTable ';
|
||||
$pre_cache['raritan_inletTable'] = snmpwalk_group($device, 'inletTable', 'PDU-MIB');
|
||||
|
||||
echo 'inletPoleTable ';
|
||||
$pre_cache['raritan_inletPoleTable'] = snmpwalk_group($device, 'inletPoleTable', 'PDU-MIB', 2);
|
||||
36
includes/discovery/sensors/temperature/raritan.inc.php
Normal file
36
includes/discovery/sensors/temperature/raritan.inc.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* raritan.inc.php
|
||||
*
|
||||
* LibreNMS temperature sensor discovery module for Raritan
|
||||
*
|
||||
* 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>
|
||||
*/
|
||||
|
||||
$index = 'unitCpuTemp.0';
|
||||
$oid = '.1.3.6.1.4.1.13742.4.1.3.1.5.0';
|
||||
$descr = 'Processor Temp';
|
||||
$divisor = 10;
|
||||
$raritan_data = snmp_get_multi_oid($device, 'unitCpuTemp.0 unitTempLowerWarning.0 unitTempLowerCritical.0 unitTempUpperWarning.0 unitTempUpperCritical.0', '-OUQs', 'PDU-MIB');
|
||||
$low_limit = $raritan_data['unitTempLowerCritical.0'];
|
||||
$low_warn_limit = $raritan_data['unitTempLowerWarning.0'];
|
||||
$warn_limit = $raritan_data['unitTempUpperWarning.0'];
|
||||
$high_limit = $raritan_data['unitTempUpperCritical.0'];
|
||||
$current = $raritan_data['unitCpuTemp.0'] / $divisor;
|
||||
discover_sensor($valid["sensor"], "temperature", $device, $oid, $tmp_index, 'raritan', $descr, $divisor, 1, $low_limit, $low_limit, $warn_limit, $high_limit, $current);
|
||||
40
includes/discovery/sensors/voltage/raritan.inc.php
Normal file
40
includes/discovery/sensors/voltage/raritan.inc.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* raritan.inc.php
|
||||
*
|
||||
* LibreNMS voltage sensor discovery module for Raritan
|
||||
*
|
||||
* 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['raritan_inletTable'] as $index => $raritan_data) {
|
||||
for ($x=1; $x<=$raritan_data['inletPoleCount']; $x++) {
|
||||
$tmp_index = "$index.$x";
|
||||
$new_index = "inletPoleVoltage.$tmp_index";
|
||||
$oid = '.1.3.6.1.4.1.13742.4.1.21.2.1.4.'. $tmp_index;
|
||||
$descr = 'Inlet ' . $pre_cache['raritan_inletPoleTable'][$index][$x]['inletPoleLabel'];
|
||||
$divisor = 1000;
|
||||
$low_limit = $raritan_data['inletVoltageUpperCritical'] / $divisor;
|
||||
$low_warn_limit = $raritan_data['inletVoltageUpperWarning'] / $divisor;
|
||||
$warn_limit = $raritan_data['inletVoltageLowerWarning'] / $divisor;
|
||||
$high_limit = $raritan_data['inletVoltageLowerCritical'] / $divisor;
|
||||
$current = $pre_cache['raritan_inletPoleTable'][$index][$x]['inletPoleVoltage'] / $divisor;
|
||||
discover_sensor($valid["sensor"], "voltage", $device, $oid, $tmp_index, 'raritan', $descr, $divisor, 1, $low_limit, $low_limit, $warn_limit, $high_limit, $current);
|
||||
}
|
||||
}
|
||||
9139
mibs/raritan/PDU-MIB
9139
mibs/raritan/PDU-MIB
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user