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:
Neil Lathwood
2017-07-03 22:04:01 +01:00
committed by Tony Murray
parent a58a2d8677
commit afcc2b5e2d
6 changed files with 5471 additions and 3816 deletions

View File

@@ -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

View File

@@ -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);
}
}

View 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);

View 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);

View 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);
}
}

View File

File diff suppressed because it is too large Load Diff