. * * @link http://librenms.org * @copyright 2020 Roman Tutkevich * @author Roman Tutkevich */ $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);