newdevice: Updated powerwalker sensor discovery to use custom mib (#7020)

This commit is contained in:
Neil Lathwood 2017-07-20 12:01:16 +01:00 committed by GitHub
parent da7550f55f
commit d1e8458b31
10 changed files with 2583 additions and 336 deletions

View File

@ -0,0 +1,223 @@
mib: EPPC-MIB
modules:
sensors:
runtime:
data:
-
oid: upsEBatteryEstimatedMinutesRemaining
num_oid: .1.3.6.1.4.1.935.10.1.1.3.3.
index: 'upsEBatteryEstimatedMinutesRemaining.{{ $index }}'
descr: Battery time remaining
voltage:
options:
skip_values_lt: 0
divisor: 10
data:
-
oid: upsEPositiveBatteryVoltage
num_oid: .1.3.6.1.4.1.935.10.1.1.3.5.
index: 'upsEPositiveBatteryVoltage.{{ $index }}'
descr: Postitive Battery Voltage
-
oid: upsENegativeBatteryVoltage
num_oid: .1.3.6.1.4.1.935.10.1.1.3.6.
index: 'upsENegativeBatteryVoltage.{{ $index }}'
descr: Negative Battery Voltage
-
oid: upsESystemInputTable
num_oid: .1.3.6.1.4.1.935.10.1.1.2.16.1.3.
value: upsESystemInputVoltage
index: 'upsESystemInputVoltage.{{ $index }}'
descr: Input
-
oid: upsESystemOutputTable
num_oid: .1.3.6.1.4.1.935.10.1.1.2.18.1.3.
value: upsESystemOutputVoltage
index: 'upsESystemOutputVoltage.{{ $index }}'
descr: Output
-
oid: upsESystemBypassTable
num_oid: .1.3.6.1.4.1.935.10.1.1.2.20.1.3.
value: upsESystemBypassVoltage
index: 'upsESystemBypassVoltage.{{ $index }}'
descr: System Bypass
-
oid: upsEChargerModulesTable
num_oid: .1.3.6.1.4.1.935.10.1.1.3.12.1.3.
value: positiveChargeVotlage
index: 'positiveChargeVotlage.{{ $index }}'
descr: Positive Charge
-
oid: upsEChargerModulesTable
num_oid: .1.3.6.1.4.1.935.10.1.1.3.12.1.4.
value: negativeChargeVotlage
index: 'negativeChargeVotlage.{{ $index }}'
descr: Negative Charge
-
oid: upsEModulesTable
num_oid: .1.3.6.1.4.1.935.10.1.1.4.2.1.3.
value: upsEModulePositiveBusVolt
index: 'upsEModulePositiveBusVolt.{{ $index }}'
descr: Module Positive Charge
-
oid: upsEModulesTable
num_oid: .1.3.6.1.4.1.935.10.1.1.4.2.1.4.
value: upsEModuleNegativeBusVolt
index: 'upsEModuleNegativeBusVolt.{{ $index }}'
descr: Module Negative Charge
frequency:
options:
skip_values_lt: 0
divisor: 10
data:
-
oid: upsESystemInputTable
num_oid: .1.3.6.1.4.1.935.10.1.1.2.16.1.2.
value: upsESystemInputFrequency
index: 'upsESystemInputFrequency.{{ $index }}'
descr: System Input
-
oid: upsESystemOutputTable
num_oid: .1.3.6.1.4.1.935.10.1.1.2.18.1.2.
value: upsESystemOutputFrequency
index: 'upsESystemOutputFrequency.{{ $index }}'
descr: System Output
-
oid: upsESystemBypassTable
num_oid: .1.3.6.1.4.1.935.10.1.1.2.20.1.2.
value: upsESystemBypassFrequency
index: 'upsESystemBypassFrequency.{{ $index }}'
descr: System Bypass
charge:
data:
-
oid: upsEBatteryEstimatedChargeRemaining
num_oid: .1.3.6.1.4.1.935.10.1.1.3.4.
index: 'upsEBatteryEstimatedChargeRemaining.{{ $index }}'
descr: Battery charge remaining
temperature:
options:
skip_values_lt: 0
divisor: 10
data:
-
oid: upsESystemTemperature
num_oid: .1.3.6.1.4.1.935.10.1.1.3.4.
index: 'upsESystemTemperature.{{ $index }}'
descr: Ambient Temperature
-
oid: upsEBatteryTemperature
num_oid: .1.3.6.1.4.1.935.10.1.1.3.8.
index: 'upsEBatteryTemperature.{{ $index }}'
descr: Battery
-
oid: upsEChargerModulesTable
num_oid: .1.3.6.1.4.1.935.10.1.1.3.12.1.8.
value: chargerModulesTemperature
index: 'chargerModulesTemperature.{{ $index }}'
descr: Charger Module
-
oid: upsEModulesTable
num_oid: .1.3.6.1.4.1.935.10.1.1.4.2.1.5.
value: upsEModuleTemperature
index: 'upsEModuleTemperature.{{ $index }}'
descr: Module
-
oid: upsEEnvironmentTemperature
num_oid: .1.3.6.1.4.1.935.10.1.1.6.1.
value: upsEEnvironmentCurrentTemperature
index: 'upsEEnvironmentCurrentTemperature.{{ $index }}'
descr: Env Current Temp
low_limit: upsEEnvironmentTemperatureLowSetPoint
high_limit: upsEEnvironmentTemperatureHighSetPoint
current:
options:
skip_values_lt: 0
divisor: 10
data:
-
oid: upsESystemInputTable
num_oid: .1.3.6.1.4.1.935.10.1.1.2.16.1.4.
value: upsESystemInputCurrent
index: 'upsESystemInputCurrent.{{ $index }}'
descr: System Input Current
-
oid: upsESystemOutputTable
num_oid: .1.3.6.1.4.1.935.10.1.1.2.18.1.4.
value: upsESystemOutputCurrent
index: 'upsESystemOutputCurrent.{{ $index }}'
descr: System Output Current
-
oid: upsESystemBypassTable
num_oid: .1.3.6.1.4.1.935.10.1.1.2.20.1.4.
value: upsESystemBypassCurrent
index: 'upsESystemBypassCurrent.{{ $index }}'
descr: System Bypass
-
oid: upsEChargerModulesTable
num_oid: .1.3.6.1.4.1.935.10.1.1.3.12.1.5.
value: positiveChargeCurrent
index: 'positiveChargeCurrent.{{ $index }}'
descr: Postitive Charge
-
oid: upsEChargerModulesTable
num_oid: .1.3.6.1.4.1.935.10.1.1.3.12.1.6.
value: negativeChargeCurrent
index: 'negativeChargeCurrent.{{ $index }}'
descr: Negative Charge
humidity:
options:
skip_values_lt: 0
data:
-
oid: upsEEnvironmentHumidity
num_oid: .1.3.6.1.4.1.935.10.1.1.6.2.1.
value: upsEEnvironmentCurrentHumidity
index: 'upsEEnvironmentCurrentHumidity.{{ $index }}'
descr: Environment Current
power:
options:
skip_values_lt: 0
data:
-
oid: upsESystemInputTable
num_oid: .1.3.6.1.4.1.935.10.1.1.2.16.1.5.
value: upsESystemInputWatts
index: 'upsESystemInputWatts.{{ $index }}'
descr: System Input Watts
-
oid: upsESystemOutputTable
num_oid: .1.3.6.1.4.1.935.10.1.1.2.18.1.5.
value: upsESystemOutputWatts
index: 'upsESystemOutputWatts.{{ $index }}'
descr: System Output Watts
-
oid: upsESystemBypassTable
num_oid: .1.3.6.1.4.1.935.10.1.1.2.20.1.5.
value: upsESystemBypassWatts
index: 'upsESystemBypassWatts.{{ $index }}'
descr: System Bypass
divisor: 10
load:
data:
-
oid: upsESystemOutputTable
num_oid: .1.3.6.1.4.1.935.10.1.1.2.18.1.7.
value: upsESystemOutputLoad
index: 'upsESystemOutputLoad.{{ $index }}'
descr: System Output Load
state:
data:
-
oid: upsEBatteryStatus
num_oid: .1.3.6.1.4.1.935.10.1.1.3.1.
index: 'upsEBatteryStatus.{{ $index }}'
descr: Battery Status
state_name: upsEBatteryStatus
states:
- { descr: unknown, graph: 1, value: 1, generic: 3 }
- { descr: batteryNormal, graph: 1, value: 2, generic: 0 }
- { descr: batteryLow, graph: 1, value: 3, generic: 1 }
- { descr: batteryDepleted, graph: 1, value: 4, generic: 2 }
- { descr: batteryDischarging, graph: 1, value: 5, generic: 1 }
- { descr: batteryFailure, graph: 1, value: 6, generic: 2 }

View File

@ -1,37 +0,0 @@
<?php
/**
* powerwalker.inc.php
*
* LibreNMS charge sensor discovery module for PowerWalker
*
* 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 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
if ($device['os'] === 'powerwalker') {
echo("PowerWalker ");
$descr = 'Battery charge remaining';
$oid = '.1.3.6.1.2.1.33.1.2.4.0';
$value = snmp_get($device, 'upsEstimatedChargeRemaining.0', '-Oqv', 'UPS-MIB');
$value = preg_replace('/\D/', '', $value);
if (is_numeric($value) && $value > 0) {
discover_sensor($valid['sensor'], 'charge', $device, $oid, 1, 'powerwalker', $descr, '1', '1', null, null, null, null, $value);
}
}

View File

@ -1,49 +0,0 @@
<?php
/**
* powerwalker.inc.php
*
* LibreNMS current sensor discovery module for PowerWalker
*
* 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'] === 'powerwalker') {
echo("PowerWalker ");
$descr = 'Battery Current';
$oid = '.1.3.6.1.2.1.33.1.2.6.0';
$value = snmp_get($device, 'upsBatteryCurrent.0', '-Oqv', 'UPS-MIB');
$value = preg_replace('/\D/', '', $value);
if (is_numeric($value) && $value > 0) {
discover_sensor($valid['sensor'], 'current', $device, $oid, 1, 'powerwalker', $descr, '1', '1', null, null, null, null, $value);
}
if (is_numeric($pre_cache['powerwalker']['upsInputCurrent'][1])) {
$descr = 'Input Voltage';
$oid = '.1.3.6.1.2.1.33.1.3.3.1.4.1.0';
discover_sensor($valid['sensor'], 'current', $device, $oid, 2, 'powerwalker', $descr, '1', '1', null, null, null, null, $value);
}
if (is_numeric($pre_cache['powerwalker']['upsOutputCurrent'][1])) {
$descr = 'Output Voltage';
$oid = '.1.3.6.1.2.1.33.1.4.4.1.3.1.0';
discover_sensor($valid['sensor'], 'current', $device, $oid, 3, 'powerwalker', $descr, '1', '1', null, null, null, null, $value);
}
}

View File

@ -1,34 +0,0 @@
<?php
/**
* powerwalker.inc.php
*
* LibreNMS frequency sensor discovery module for PowerWalker
*
* 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'] === 'powerwalker') {
echo("PowerWalker ");
if (is_numeric($pre_cache['powerwalker']['upsInputFrequency'][1])) {
$descr = 'Input Voltage';
$oid = '.1.3.6.1.2.1.33.1.3.3.1.2.1';
discover_sensor($valid['sensor'], 'frequency', $device, $oid, 2, 'powerwalker', $descr, '1', '1', null, null, null, null, $value);
}
}

View File

@ -1,30 +0,0 @@
<?php
/**
* powerwalker.inc.php
*
* LibreNMS pre-cache sensor discovery module for PowerWalker
*
* 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 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
echo 'upsInputEntry ';
$pre_cache['powerwalker'] = snmpwalk_cache_index($device, 'upsInputEntry', array(), 'UPS-MIB');
echo 'upsOutputEntry ';
$pre_cache['powerwalker'] = snmpwalk_cache_index($device, 'upsOutputEntry', $pre_cache['powerwalker'], 'UPS-MIB');

View File

@ -1,37 +0,0 @@
<?php
/**
* powerwalker.inc.php
*
* LibreNMS runtime sensor discovery module for PowerWalker
*
* 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 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
if ($device['os'] === 'powerwalker') {
echo("PowerWalker ");
$descr = 'Battery time remaining';
$oid = '.1.3.6.1.2.1.33.1.2.3.0';
$value = snmp_get($device, 'upsEstimatedMinutesRemaining.0', '-Oqv', 'UPS-MIB');
$value = preg_replace('/\D/', '', $value);
if (is_numeric($value) && $value > 0) {
discover_sensor($valid['sensor'], 'runtime', $device, $oid, 1, 'powerwalker', $descr, '1', '1', null, null, null, null, $value);
}
}

View File

@ -1,63 +0,0 @@
<?php
/**
* powerwalker.inc.php
*
* LibreNMS state sensor discovery module for PowerWalker
*
* 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'] == 'powerwalker') {
$state = snmp_get($device, "upsBatteryStatus.0", "-Ovqe", "UPS-MIB");
$cur_oid = '.1.3.6.1.2.1.33.1.2.1.0';
$index = '0';
if (is_numeric($state)) {
//Create State Index
$state_name = 'upsBatteryStatus';
$state_index_id = create_state_index($state_name);
//Create State Translation
if ($state_index_id !== null) {
$states = array(
array($state_index_id,'unknown',0,1,3) ,
array($state_index_id,'batteryNormal',0,2,0) ,
array($state_index_id,'batteryLow',0,3,1) ,
array($state_index_id,'batteryDepleted',0,4,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 = 'Battery 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);
}
}

View File

@ -1,37 +0,0 @@
<?php
/**
* powerwalker.inc.php
*
* LibreNMS temperature sensor discovery module for PowerWalker
*
* 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 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
if ($device['os'] === 'powerwalker') {
echo("PowerWalker ");
$descr = 'Ambient Temperature';
$oid = '.1.3.6.1.2.1.33.1.2.7.0';
$value = snmp_get($device, 'upsBatteryTemperature.0', '-Oqv', 'UPS-MIB');
$value = preg_replace('/\D/', '', $value);
if (is_numeric($value) && $value > 0) {
discover_sensor($valid['sensor'], 'temperature', $device, $oid, 1, 'powerwalker', $descr, '1', '1', null, null, null, null, $value);
}
}

View File

@ -1,49 +0,0 @@
<?php
/**
* powerwalker.inc.php
*
* LibreNMS voltages sensor discovery module for PowerWalker
*
* 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 2016 Neil Lathwood
* @author Neil Lathwood <neil@lathwood.co.uk>
*/
if ($device['os'] === 'powerwalker') {
echo("PowerWalker ");
$descr = 'Battery Voltage';
$oid = '.1.3.6.1.2.1.33.1.2.5.0';
$value = snmp_get($device, 'upsBatteryVoltage.0', '-Oqv', 'UPS-MIB');
$value = preg_replace('/\D/', '', $value);
if (is_numeric($value) && $value > 0) {
discover_sensor($valid['sensor'], 'voltage', $device, $oid, 1, 'powerwalker', $descr, '1', '1', null, null, null, null, $value);
}
if (is_numeric($pre_cache['powerwalker']['upsInputVoltage'][1])) {
$descr = 'Input Voltage';
$oid = '.1.3.6.1.2.1.33.1.3.3.1.3.1';
discover_sensor($valid['sensor'], 'voltage', $device, $oid, 2, 'powerwalker', $descr, '1', '1', null, null, null, null, $value);
}
if (is_numeric($pre_cache['powerwalker']['upsOutputVoltage'][1])) {
$descr = 'Output Voltage';
$oid = '.1.3.6.1.2.1.33.1.4.4.1.2.1';
discover_sensor($valid['sensor'], 'voltage', $device, $oid, 3, 'powerwalker', $descr, '1', '1', null, null, null, null, $value);
}
}

2360
mibs/powerwalker/EPPC-MIB Normal file

File diff suppressed because it is too large Load Diff