SmartAX supports IF-MIB, skip custom polling and fix polling GPON ports (#13579)

* Smartax supports IF-MIB, skip custom discovery and fix polling GPON ports in and out traffic

* This file seems to break GPON port polling on SmartAXes firmware versions R017 and R018, deleting the file fixes GPON polling

* Added necessary test files so that polling tests do not fail
This commit is contained in:
carranzamarioagustin
2021-12-02 01:54:12 -03:00
committed by GitHub
parent d4022e2d4e
commit 1675cd8c17
2 changed files with 9 additions and 81 deletions

View File

@@ -1,72 +0,0 @@
<?php
/**
* smartax.inc.php
*
* 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 <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
*
* @copyright 2020 Roman Tutkevich
* @author Roman Tutkevich <race.fdm@gmail.com>
*/
$inoctets = snmpwalk_cache_oid($device, '.1.3.6.1.4.1.2011.6.128.1.1.4.21.1.15', []); // hwGponOltEthernetStatisticReceivedBytes
$outoctets = snmpwalk_cache_oid($device, '.1.3.6.1.4.1.2011.6.128.1.1.4.21.1.30', []); // hwGponOltEthernetStatisticSendBytes
$inbpackets = snmpwalk_cache_oid($device, '.1.3.6.1.4.1.2011.6.128.1.1.4.21.1.5', []); // hwGponOltEthernetStatisticReceivedBroadcastPakts
$outbpackets = snmpwalk_cache_oid($device, '.1.3.6.1.4.1.2011.6.128.1.1.4.21.1.20', []); // hwGponOltEthernetStatisticSendBroadcastPakts
$inmpackets = snmpwalk_cache_oid($device, '.1.3.6.1.4.1.2011.6.128.1.1.4.21.1.6', []); // hwGponOltEthernetStatisticReceivedMulticastPakts
$outmpackets = snmpwalk_cache_oid($device, '.1.3.6.1.4.1.2011.6.128.1.1.4.21.1.21', []); // hwGponOltEthernetStatisticSendMulticastPakts
$inupackets = snmpwalk_cache_oid($device, '.1.3.6.1.4.1.2011.6.128.1.1.4.21.1.7', []); // hwGponOltEthernetStatisticReceivedUnicastPakts
$outupackets = snmpwalk_cache_oid($device, '.1.3.6.1.4.1.2011.6.128.1.1.4.21.1.22', []); // hwGponOltEthernetStatisticSendUnicastPakts
foreach ($inoctets as $index => $value) {
$index = preg_replace("/^(.*?)\.([0-9]+)$/", '$2', $index);
$port_stats[$index]['ifHCInOctets'] = $value['enterprises'];
}
foreach ($outoctets as $index => $value) {
$index = preg_replace("/^(.*?)\.([0-9]+)$/", '$2', $index);
$port_stats[$index]['ifHCOutOctets'] = $value['enterprises'];
}
foreach ($inbpackets as $index => $value) {
$index = preg_replace("/^(.*?)\.([0-9]+)$/", '$2', $index);
$port_stats[$index]['ifHCInBroadcastPkts'] = $value['enterprises'];
}
foreach ($outbpackets as $index => $value) {
$index = preg_replace("/^(.*?)\.([0-9]+)$/", '$2', $index);
$port_stats[$index]['ifHCOutBroadcastPkts'] = $value['enterprises'];
}
foreach ($inmpackets as $index => $value) {
$index = preg_replace("/^(.*?)\.([0-9]+)$/", '$2', $index);
$port_stats[$index]['ifHCInMulticastPkts'] = $value['enterprises'];
}
foreach ($outmpackets as $index => $value) {
$index = preg_replace("/^(.*?)\.([0-9]+)$/", '$2', $index);
$port_stats[$index]['ifHCOutMulticastPkts'] = $value['enterprises'];
}
foreach ($inupackets as $index => $value) {
$index = preg_replace("/^(.*?)\.([0-9]+)$/", '$2', $index);
$port_stats[$index]['ifHCInUcastPkts'] = $value['enterprises'];
}
foreach ($outupackets as $index => $value) {
$index = preg_replace("/^(.*?)\.([0-9]+)$/", '$2', $index);
$port_stats[$index]['ifHCOutUcastPkts'] = $value['enterprises'];
}
unset($inoctets);
unset($outoctets);
unset($inbpackets);
unset($outbpackets);
unset($inmpackets);
unset($outmpackets);
unset($inupackets);
unset($outupackets);

View File

@@ -3922,8 +3922,8 @@
"ifName": "InLoopBack0",
"portName": null,
"ifIndex": 128,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifConnectorPresent": "false",
"ifPromiscuousMode": "false",
"ifOperStatus": "up",
@@ -4027,8 +4027,8 @@
"ifName": "null0",
"portName": null,
"ifIndex": 262,
"ifSpeed": null,
"ifSpeed_prev": 0,
"ifSpeed": 0,
"ifSpeed_prev": null,
"ifConnectorPresent": "false",
"ifPromiscuousMode": "false",
"ifOperStatus": "up",
@@ -6055,11 +6055,11 @@
"pagpEthcOperationMode": null,
"pagpDeviceId": null,
"pagpGroupIfIndex": null,
"ifInUcastPkts": 0,
"ifInUcastPkts": 152213731,
"ifInUcastPkts_prev": 0,
"ifInUcastPkts_delta": null,
"ifInUcastPkts_rate": null,
"ifOutUcastPkts": 0,
"ifOutUcastPkts": 387401192,
"ifOutUcastPkts_prev": 0,
"ifOutUcastPkts_delta": null,
"ifOutUcastPkts_rate": null,
@@ -6071,11 +6071,11 @@
"ifOutErrors_prev": 0,
"ifOutErrors_delta": null,
"ifOutErrors_rate": null,
"ifInOctets": 0,
"ifInOctets": 60133115351,
"ifInOctets_prev": 0,
"ifInOctets_delta": null,
"ifInOctets_rate": null,
"ifOutOctets": 0,
"ifOutOctets": 536753139573,
"ifOutOctets_prev": 0,
"ifOutOctets_delta": null,
"ifOutOctets_rate": null,
@@ -6108,7 +6108,7 @@
"ifOutBroadcastPkts_prev": 0,
"ifOutBroadcastPkts_delta": null,
"ifOutBroadcastPkts_rate": null,
"ifInMulticastPkts": 98279,
"ifInMulticastPkts": 98280,
"ifInMulticastPkts_prev": 0,
"ifInMulticastPkts_delta": null,
"ifInMulticastPkts_rate": null,