mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
newdevice: Added additional detection for Dell UPS (#5322)
This commit is contained in:
committed by
Neil Lathwood
parent
76516e8b5d
commit
ac790caaf0
21
includes/discovery/sensors/power/dell-ups.inc.php
Normal file
21
includes/discovery/sensors/power/dell-ups.inc.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2017 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'dell-ups') {
|
||||
echo 'Dell UPS: ';
|
||||
$temp = snmp_get($device, "physicalOutputPresentConsumption.0", "-Ovqe", "DELL-SNMP-UPS-MIB");
|
||||
if (is_numeric($temp) && !is_null($temp)) {
|
||||
$oid = '.1.3.6.1.4.1.674.10902.2.120.2.6.0';
|
||||
$descr = 'System Consumption';
|
||||
discover_sensor($valid['sensor'], 'power', $device, $oid, '0', 'dell-ups', $descr, '1', '1', null, null, null, null, $temp);
|
||||
}
|
||||
}
|
27
includes/discovery/sensors/runtime/dell-ups.inc.php
Normal file
27
includes/discovery/sensors/runtime/dell-ups.inc.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2017 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'dell-ups') {
|
||||
echo 'Dell UPS: ';
|
||||
$temp = snmp_get($device, "physicalBatterySecondsRemaining.0", "-Ovqe", "DELL-SNMP-UPS-MIB");
|
||||
if (is_numeric($temp) && !is_null($temp)) {
|
||||
$oid = '.1.3.6.1.4.1.674.10902.2.120.5.3.0';
|
||||
$descr = 'Runtime';
|
||||
$divisor = '60';
|
||||
$current = $temp / 60;
|
||||
$low_limit = 5;
|
||||
$low_limit_warn = 10;
|
||||
$warn_limit = 2000;
|
||||
$high_limit = 3000;
|
||||
discover_sensor($valid['sensor'], 'runtime', $device, $oid, '0', 'dell-ups', $descr, $divisor, '1', $low_limit, $low_limit_warn, $warn_limit, $high_limit, $current);
|
||||
}
|
||||
}
|
52
includes/discovery/sensors/states/dell-ups.inc.php
Normal file
52
includes/discovery/sensors/states/dell-ups.inc.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2017 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* 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. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'dell-ups') {
|
||||
$temp = snmp_get($device, "productStatusGlobalStatus.0", "-Ovqe", "DELL-SNMP-UPS-MIB");
|
||||
$cur_oid = '.1.3.6.1.4.1.674.10902.2.110.1.0';
|
||||
$index = '0';
|
||||
|
||||
if (is_numeric($temp)) {
|
||||
//Create State Index
|
||||
$state_name = 'productStatusGlobalStatus';
|
||||
$state_index_id = create_state_index($state_name);
|
||||
|
||||
//Create State Translation
|
||||
if ($state_index_id !== null) {
|
||||
$states = array(
|
||||
array($state_index_id,'other',0,1,3) ,
|
||||
array($state_index_id,'unknown',0,2,3) ,
|
||||
array($state_index_id,'ok',0,3,0) ,
|
||||
array($state_index_id,'non-critical',0,4,1) ,
|
||||
array($state_index_id,'critical',0,5,2) ,
|
||||
array($state_index_id,'non-recoverable',0,6,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');
|
||||
}
|
||||
}
|
||||
|
||||
$descr = 'Current Status';
|
||||
//Discover Sensors
|
||||
discover_sensor($valid['sensor'], 'state', $device, $cur_oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $temp, 'snmp', $index);
|
||||
|
||||
//Create Sensor To State Index
|
||||
create_sensor_to_state_index($device, $state_name, $index);
|
||||
}
|
||||
}
|
@@ -10,8 +10,8 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
$data = snmp_get_multi($device, 'productIDDisplayName.0 productIDVendor.0 productIDVersion.0 physicalIdentSerialNumber.0', '-OQUs', 'DELL-SNMP-UPS-MIB');
|
||||
$data = snmp_get_multi($device, 'productIDDisplayName.0 productIDBuildNumber.0 productIDVersion.0 physicalIdentSerialNumber.0', '-OQUs', 'DELL-SNMP-UPS-MIB');
|
||||
|
||||
$hardware = $data[0]['productIDDisplayName'];
|
||||
$serial = $data[0]['physicalIdentSerialNumber'];
|
||||
$version = $data[0]['productIDVersion'] . $data[0]['productIDVendor'];
|
||||
$version = $data[0]['productIDVersion'] . '.' . $data[0]['productIDBuildNumber'];
|
||||
|
Reference in New Issue
Block a user