[pbn] dropped dbfetch from discovery/sensors (#13789)

This commit is contained in:
Peca Nesovanovic
2022-02-15 22:39:23 +01:00
committed by GitHub
parent 8b831f5c6f
commit 700c6ae9c3
4 changed files with 22 additions and 13 deletions

View File

@@ -7,8 +7,9 @@
* 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.
*
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
*/
echo 'PBN ';
$multiplier = 1;
@@ -16,7 +17,8 @@ $divisor = 1000000;
foreach ($pre_cache['pbn_oids'] as $index => $entry) {
if (is_numeric($entry['curr']) && ($entry['curr'] !== '-65535')) {
$oid = '.1.3.6.1.4.1.11606.10.9.63.1.7.1.6.' . $index;
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$index, $device['device_id']]) . ' Current';
$interface = get_port_by_index_cache($device['device_id'], $index)['ifDescr'];
$descr = $interface . ' Current';
$limit_low = 8000 / $divisor;
$warn_limit_low = 8500 / $divisor;
$limit = 15000 / $divisor;

View File

@@ -7,8 +7,9 @@
* 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.
*
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
*/
echo 'PBN ';
$multiplier = 1;
@@ -16,7 +17,8 @@ $divisor = 1;
foreach ($pre_cache['pbn_oids'] as $index => $entry) {
if (is_numeric($entry['rxPower']) && ($entry['rxPower'] !== '-65535')) {
$oid = '.1.3.6.1.4.1.11606.10.9.63.1.7.1.3.' . $index;
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$index, $device['device_id']]) . ' Rx Power';
$interface = get_port_by_index_cache($device['device_id'], $index)['ifDescr'];
$descr = $interface . ' Rx Power';
$limit_low = -30 / $divisor;
$warn_limit_low = -25 / $divisor;
$limit = -2 / $divisor;
@@ -29,7 +31,8 @@ foreach ($pre_cache['pbn_oids'] as $index => $entry) {
if (is_numeric($entry['txPower']) && ($entry['txPower'] !== '-65535')) {
$oid = '.1.3.6.1.4.1.11606.10.9.63.1.7.1.2.' . $index;
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$index, $device['device_id']]) . ' Tx Power';
$interface = get_port_by_index_cache($device['device_id'], $index)['ifDescr'];
$descr = $interface . ' Tx Power';
$limit_low = -30 / $divisor;
$warn_limit_low = -25 / $divisor;
$limit = -2 / $divisor;

View File

@@ -7,8 +7,9 @@
* 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.
*
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
*/
echo 'PBN ';
$multiplier = 1;
@@ -16,7 +17,8 @@ $divisor = 256;
foreach ($pre_cache['pbn_oids'] as $index => $entry) {
if (is_numeric($entry['temperature']) && ($entry['temperature'] !== '-65535')) {
$oid = '.1.3.6.1.4.1.11606.10.9.63.1.7.1.4.' . $index;
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$index, $device['device_id']]) . ' Temperature';
$interface = get_port_by_index_cache($device['device_id'], $index)['ifDescr'];
$descr = $interface . ' Temperature';
$limit_low = -256;
$warn_limit_low = 10;
$limit = 256;

View File

@@ -7,8 +7,9 @@
* 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.
*
* @author Peca Nesovanovic <peca.nesovanovic@sattrakt.com>
*/
echo 'PBN ';
$multiplier = 1;
@@ -16,7 +17,8 @@ $divisor = 10000;
foreach ($pre_cache['pbn_oids'] as $index => $entry) {
if (is_numeric($entry['voltage']) && ($entry['voltage'] !== '-65535')) {
$oid = '.1.3.6.1.4.1.11606.10.9.63.1.7.1.5.' . $index;
$descr = dbFetchCell('SELECT `ifDescr` FROM `ports` WHERE `ifIndex`= ? AND `device_id` = ?', [$index, $device['device_id']]) . ' Voltage';
$interface = get_port_by_index_cache($device['device_id'], $index)['ifDescr'];
$descr = $interface . ' Voltage';
$limit_low = 30000 / $divisor;
$warn_limit_low = 32100 / $divisor;
$limit = 35000 / $divisor;