Files
librenms-librenms/includes/polling/netstats/netstats-udp.inc.php
T
Tony MurrayandGitHub 020c5fd7e1 Remove legacy code and fix missing device graphs (#11950)
* removing $graphs global

* remove unused things

* fix some additional graphs

* Fix graphs persisting too soon

* correct name for poller module performance graph

* only one type of graph is used here
2020-07-23 09:57:22 -05:00

35 lines
912 B
PHP

<?php
use Illuminate\Support\Str;
use LibreNMS\RRD\RrdDefinition;
if (!Str::startsWith($device['os'], ['Snom', 'asa'])) {
echo ' UDP';
$oids = [
'udpInDatagrams',
'udpOutDatagrams',
'udpInErrors',
'udpNoPorts',
];
$data = snmp_getnext_multi($device, $oids, '-OQUs', 'UDP-MIB');
if (is_numeric($data['udpInDatagrams']) && is_numeric($data['udpOutDatagrams'])) {
$rrd_def = new RrdDefinition();
$fields = [];
foreach ($oids as $oid) {
$rrd_def->addDataset($oid, 'COUNTER', null, 1000000); // Limit to 1MPPS?
$fields[$oid] = is_numeric($data[$oid]) ? $data[$oid] : 'U';
}
$tags = compact('rrd_def');
data_update($device, 'netstats-udp', $tags, $fields);
$os->enableGraph('netstat_udp');
unset($rrd_def, $fields, $tags, $oid);
}
unset($oids, $data);
}//end if