Merge ethernetprobe2 into akcp and improve akcp (#9465)

* Merge ethernetprobe2 into akcp and improve akcp
Use higher resolution temperature values if available
Properly hand F/C temperature scales (LibreNMS always uses C)
Add current, voltage, airflow (no test data)
Move humidity to yaml

* Update akcp.snmprec

* Update akcp-serverprobe8.json

* Add group

* Update test data
remove old MIB
This commit is contained in:
Tony Murray
2019-01-17 11:38:33 -06:00
committed by GitHub
parent f1928461a8
commit 5f752361f5
18 changed files with 3913 additions and 16194 deletions

View File

@@ -5,11 +5,5 @@ mib_dir: akcp
over: over:
- { graph: device_temperature, text: temperature } - { graph: device_temperature, text: temperature }
discovery: discovery:
- sysDescr_regex: - sysObjectID:
- '/^sensorProbe/i'
- '/^securityProbe/i'
-
sysObjectID:
- .1.3.6.1.4.1.3854 - .1.3.6.1.4.1.3854
sysDescr_regex:
- '/^SP(2|X)\+* /'

View File

@@ -1,17 +1,85 @@
mib: HHMSAGENT-MIB mib: SPAGENT-MIB
modules: modules:
sensors: sensors:
state: state:
data: data:
- -
oid: hhmsSensorArrayTable oid: spStatus
value: hhmsSensorArraySwitchStatus num_oid: '.1.3.6.1.4.1.3854.1.1.2.{{ $index }}'
num_oid: '.1.3.6.1.4.1.3854.1.2.2.1.18.1.3.{{ $index }}' descr: 'Probe Status'
descr: '{{ $hhmsSensorArraySwitchDescription }}' group: Probes
index: 'hhmsSensorArraySwitchStatus.{{ $index }}'
skip_values: 1
states: states:
- { descr: noStatus, graph: 1, value: 1, generic: 3 } - { descr: noStatus, graph: 1, value: 1, generic: 3 }
- { descr: normal, graph: 1, value: 2, generic: 0 } - { descr: normal, graph: 1, value: 2, generic: 0 }
- { descr: critical, graph: 1, value: 4, generic: 2 } - { descr: critical, graph: 1, value: 4, generic: 2 }
- { descr: sensorError, graph: 1, value: 7, generic: 3 } - { descr: sensorError, graph: 1, value: 7, generic: 3 }
-
oid: sensorProbeSwitchTable
value: sensorProbeSwitchStatus
num_oid: '.1.3.6.1.4.1.3854.1.2.2.1.18.1.3.{{ $index }}'
descr: sensorProbeSwitchDescription
group: Switches
index: 'hhmsSensorArraySwitchStatus.{{ $index }}'
skip_values:
-
oid: sensorProbeSwitchOnline
op: '!='
value: 2
states:
- { descr: noStatus, graph: 1, value: 1, generic: 3 }
- { descr: normal, graph: 1, value: 2, generic: 0 }
- { descr: critical, graph: 1, value: 4, generic: 2 }
- { descr: sensorError, graph: 1, value: 7, generic: 3 }
humidity:
data:
-
oid: sensorProbeHumidityTable
value: sensorProbeHumidityRaw
num_oid: '.1.3.6.1.4.1.3854.1.2.2.1.17.1.13.{{ $index }}'
descr: sensorProbeHumidityDescription
divisor: 10
low_limit: sensorProbeHumidityLowCritical
low_warn_limit: sensorProbeHumidityLowWarning
warn_limit: sensorProbeHumidityHighWarning
high_limit: sensorProbeHumidityHighCritical
skip_values:
-
oid: sensorProbeHumidityOnline
op: '!='
value: 2
current:
data:
-
oid: current4to20mASensorTable
value: current4to20mASensorRaw
num_oid: '.1.3.6.1.4.1.3854.2.5.5.1.20.{{ $index }}'
descr: current4to20mASensorDescription
divisor: 10
low_limit: current4to20mASensorLowCritical
low_warn_limit: current4to20mASensorLowWarning
warn_limit: current4to20mASensorHighWarning
high_limit: current4to20mASensorHighCritical
voltage:
data:
-
oid: dcVoltageSensorTable
value: dcVoltageSensorRaw
num_oid: '.1.3.6.1.4.1.3854.2.5.6.1.20.{{ $index }}'
descr: dcVoltageSensorDescription
divisor: 10
low_limit: dcVoltageSensorLowCritical
low_warn_limit: dcVoltageSensorLowWarning
warn_limit: dcVoltageSensorHighWarning
high_limit: dcVoltageSensorHighCritical
airflow:
data:
-
oid: airflowSensorTable
value: airflowSensorRaw
num_oid: '.1.3.6.1.4.1.3854.2.5.7.1.20.{{ $index }}'
descr: airflowSensorDescription
divisor: 10
low_limit: airflowSensorLowCritical
low_warn_limit: airflowSensorLowWarning
warn_limit: airflowSensorHighWarning
high_limit: airflowSensorHighCritical

View File

@@ -1,11 +0,0 @@
os: ethernetprobe2
text: 'Atal Ethernetprobe2'
type: environment
icon: atal
mib_dir:
- atal
over:
- { graph: device_bits, text: 'Device Traffic' }
discovery:
- sysDescr:
- EthernetProbe2

View File

@@ -1,36 +0,0 @@
<?php
$oids = snmp_walk($device, '.1.3.6.1.4.1.3854.1.2.2.1.16.1.4', '-Osqn', '');
d_echo($oids."\n");
$oids = trim($oids);
if ($oids) {
echo 'AKCP ';
}
foreach (explode("\n", $oids) as $data) {
$data = trim($data);
if ($data) {
list($oid,$status) = explode(' ', $data, 2);
if ($status == 2) {
// 2 = normal, 0 = not connected
$split_oid = explode('.', $oid);
$index = $split_oid[(count($split_oid) - 1)];
$descr_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.1.$index";
$oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.3.$index";
$warnlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.7.$index";
$limit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.8.$index";
$warnlowlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.9.$index";
$lowlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.17.1.10.$index";
$descr = trim(snmp_get($device, $descr_oid, '-Oqv', ''), '"');
$humidity = snmp_get($device, $oid, '-Oqv', '');
$warnlimit = snmp_get($device, $warnlimit_oid, '-Oqv', '');
$limit = snmp_get($device, $limit_oid, '-Oqv', '');
$lowlimit = snmp_get($device, $lowlimit_oid, '-Oqv', '');
$warnlowlimit = snmp_get($device, $warnlowlimit_oid, '-Oqv', '');
discover_sensor($valid['sensor'], 'humidity', $device, $oid, $index, 'akcp', $descr, '1', '1', $lowlimit, $warnlowlimit, $limit, $warnlimit, $humidity);
}
}
}

View File

@@ -1,39 +0,0 @@
<?php
/**
* etherprobe2.inc.php
*
* LibreNMS temperature sensor discover module for Atal EtherProbe2
*
* 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>
*/
foreach ($pre_cache['ethernetprobe2_sensorProbeHumidityTable'] as $index => $data) {
if ($data['sensorProbeHumidityOnline'] === 'online') {
if (is_numeric($data['sensorProbeHumidityRaw'])) {
$oid = '.1.3.6.1.4.1.3854.1.2.2.1.17.1.13.' . $index;
$descr = $data['sensorProbeHumidityDescription'];
$value = $data['sensorProbeHumidityRaw'];
$low_limit = $data['sensorProbeHumidityLowCritical'];
$low_warn_limit = $data['sensorProbeHumidityLowWarning'];
$warn_limit = $data['sensorProbeHumidityHighWarning'];
$high_limit = $data['sensorProbeHumidityHighCritical'];
discover_sensor($valid['sensor'], 'humidity', $device, $oid, $index, 'ethernetprobe2', $descr, 1, '1', $low_limit, $low_warn_limit, $warn_limit, $high_limit, $value);
}
}
}

View File

@@ -1,30 +0,0 @@
<?php
/**
* etherprobe2.inc.php
*
* LibreNMS pre-cache discover module for Atal EtherProbe2
*
* 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>
*/
echo 'sensorProbeTempTable ';
$pre_cache['ethernetprobe2_sensorProbeTempTable'] = snmpwalk_cache_oid($device, 'sensorProbeTempTable', array(), 'SPAGENT-MIB');
echo 'sensorProbeHumidityTable ';
$pre_cache['ethernetprobe2_sensorProbeHumidityTable'] = snmpwalk_cache_oid($device, 'sensorProbeHumidityTable', array(), 'SPAGENT-MIB');

View File

@@ -1,53 +0,0 @@
<?php
/**
* etherprobe2.inc.php
*
* LibreNMS state discover module for Atal EtherProbe2
*
* 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>
*/
$status_value = snmp_get($device, 'spStatus.0', '-Oqve', 'SPAGENT-MIB');
if (is_numeric($status_value)) {
$state = 'spStatus';
$state_index_id = create_state_index($state);
if ($state_index_id) {
$states = array(
array($state_index_id, 'noStatus', 1, 1, 1),
array($state_index_id, 'normal', 1, 2, 0),
array($state_index_id, 'warning', 1, 3, 1),
array($state_index_id, 'critical', 1, 4, 2),
array($state_index_id, 'sensorError', 1, 5, 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');
}
discover_sensor($valid['sensor'], 'state', $device, '.1.3.6.1.4.1.3854.1.1.2.0', 'ethernetprobe2', $state, 'Sensor state', '1', '1', null, null, null, null, $status_value);
create_sensor_to_state_index($device, $state, 'ethernetprobe2');
}

View File

@@ -1,36 +1,41 @@
<?php <?php
$oids = snmp_walk($device, '.1.3.6.1.4.1.3854.1.2.2.1.16.1.4', '-Osqn', ''); $oids = snmpwalk_cache_oid($device, 'sensorProbeTempTable', [], 'SPAGENT-MIB');
d_echo($oids."\n"); d_echo($oids."\n");
$oids = trim($oids); foreach ($oids as $index => $entry) {
if ($oids) { if ($entry['sensorProbeTempOnline'] == 'online') {
echo 'AKCP '; $scale = $entry['sensorProbeTempDegreeType'] == 'fahr' ? 'fahrenheit' : $entry['sensorProbeTempDegreeType'];
}
foreach (explode("\n", $oids) as $data) { if (isset($entry['sensorProbeTempDegreeRaw'])) {
$data = trim($data); $oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.14.$index";
if ($data) { $divisor = 10;
list($oid,$status) = explode(' ', $data, 2); $value = $entry['sensorProbeTempDegreeRaw'] / $divisor;
if ($status == 2) { } else {
// 2 = normal, 0 = not connected $oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.3.$index";
$split_oid = explode('.', $oid); $divisor = 1;
$temperature_id = $split_oid[(count($split_oid) - 1)]; $value = $entry['sensorProbeTempDegree'];
$descr_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.1.$temperature_id";
$temperature_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.3.$temperature_id";
$warnlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.7.$temperature_id";
$limit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.8.$temperature_id";
$lowwarnlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.9.$temperature_id";
$lowlimit_oid = ".1.3.6.1.4.1.3854.1.2.2.1.16.1.10.$temperature_id";
$descr = trim(snmp_get($device, $descr_oid, '-Oqv', ''), '"');
$temperature = snmp_get($device, $temperature_oid, '-Oqv', '');
$lowwarnlimit = snmp_get($device, $lowwarnlimit_oid, '-Oqv', '');
$warnlimit = snmp_get($device, $warnlimit_oid, '-Oqv', '');
$limit = snmp_get($device, $limit_oid, '-Oqv', '');
$lowlimit = snmp_get($device, $lowlimit_oid, '-Oqv', '');
discover_sensor($valid['sensor'], 'temperature', $device, $temperature_oid, $temperature_id, 'akcp', $descr, '1', '1', $lowlimit, $low_warn_limit, $warnlimit, $limit, $temperature);
} }
discover_sensor(
$valid['sensor'],
'temperature',
$device,
$oid,
$index,
'akcp',
$entry['sensorProbeTempDescription'],
$divisor,
1,
fahrenheit_to_celsius($entry['sensorProbeTempLowCritical'], $scale),
fahrenheit_to_celsius($entry['sensorProbeTempLowWarning'], $scale),
fahrenheit_to_celsius($entry['sensorProbeTempHighWarning'], $scale),
fahrenheit_to_celsius($entry['sensorProbeTempHighCritical'], $scale),
fahrenheit_to_celsius($value, $scale),
'snmp',
null,
null,
$scale == 'fahrenheit' ? 'fahrenheit_to_celsius' : null
);
} }
} }

View File

@@ -1,40 +0,0 @@
<?php
/**
* etherprobe2.inc.php
*
* LibreNMS temperature sensor discover module for Atal EtherProbe2
*
* 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>
*/
foreach ($pre_cache['ethernetprobe2_sensorProbeTempTable'] as $index => $data) {
if ($data['sensorProbeTempOnline'] === 'online') {
if (is_numeric($data['sensorProbeTempDegreeRaw'])) {
$oid = '.1.3.6.1.4.1.3854.1.2.2.1.16.1.14.' . $index;
$descr = $data['sensorProbeTempDescription'];
$divisor = 10;
$value = (fahrenheit_to_celsius($data['sensorProbeTempDegreeRaw'], $data['sensorProbeTempDegreeType']) / $divisor);
$low_limit = $data['sensorProbeTempLowCritical'];
$low_warn_limit = $data['sensorProbeTempLowWarning'];
$warn_limit = $data['sensorProbeTempHighWarning'];
$high_limit = $data['sensorProbeTempHighCritical'];
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'ethernetprobe2', $descr, $divisor, '1', $low_limit, $low_warn_limit, $warn_limit, $high_limit, $value);
}
}
}

View File

@@ -2,3 +2,9 @@
$hardware = trim(snmp_get($device, "1.3.6.1.4.1.3854.1.1.6.0", "-OQv", "", ""), '"'); $hardware = trim(snmp_get($device, "1.3.6.1.4.1.3854.1.1.6.0", "-OQv", "", ""), '"');
$hardware .= ' ' . trim(snmp_get($device, "1.3.6.1.4.1.3854.1.1.8.0", "-OQv", "", ""), '" '); $hardware .= ' ' . trim(snmp_get($device, "1.3.6.1.4.1.3854.1.1.8.0", "-OQv", "", ""), '" ');
if (empty(trim($hardware))) {
preg_match('/SP\d+/', $device['sysDescr'], $matches);
$hardware = $matches[0];
}

View File

@@ -1,26 +0,0 @@
<?php
/**
* etherprobe2.inc.php
*
* LibreNMS os polling module for Atal Etherprobe2
*
* 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>
*/
list(,$hardware,) = explode(' ', $device['sysDescr']);

View File

@@ -1,28 +0,0 @@
<?php
/**
* ethernetprobe2.inc.php
*
* LibreNMS sensors temp poller module for Atal EthernetProbe2
*
* 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>
*/
$temp_type = snmp_get($device, '.1.3.6.1.4.1.3854.1.2.2.1.16.1.12.' . $sensor['sensor_index'], '-Oqv', 'SPAGENT-MIB');
$sensor_value = fahrenheit_to_celsius($sensor_value, $temp_type);
unset($temp_type);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1,2 @@
1.3.6.1.2.1.1.1.0|4|SensorProbe 1.3.6.1.2.1.1.1.0|4|SensorProbe
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.3854.1

View File

@@ -1,2 +1,2 @@
1.3.6.1.2.1.1.1.0|4|EthernetProbe2 SP2403 071009 1.3.6.1.2.1.1.1.0|4|EthernetProbe2 SP2403 071009
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.3854.1 1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.3854.1

File diff suppressed because it is too large Load Diff