Files
librenms-librenms/includes/polling/netstats/netstats-icmp.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

59 lines
1.6 KiB
PHP

<?php
use Illuminate\Support\Str;
use LibreNMS\RRD\RrdDefinition;
if (!Str::startsWith($device['os'], array('Snom', 'asa'))) {
echo ' ICMP';
// Below have more oids, and are in trees by themselves, so we can snmpwalk_cache_oid them
$oids = array(
'icmpInMsgs',
'icmpOutMsgs',
'icmpInErrors',
'icmpOutErrors',
'icmpInEchos',
'icmpOutEchos',
'icmpInEchoReps',
'icmpOutEchoReps',
'icmpInDestUnreachs',
'icmpOutDestUnreachs',
'icmpInParmProbs',
'icmpInTimeExcds',
'icmpInSrcQuenchs',
'icmpInRedirects',
'icmpInTimestamps',
'icmpInTimestampReps',
'icmpInAddrMasks',
'icmpInAddrMaskReps',
'icmpOutTimeExcds',
'icmpOutParmProbs',
'icmpOutSrcQuenchs',
'icmpOutRedirects',
'icmpOutTimestamps',
'icmpOutTimestampReps',
'icmpOutAddrMasks',
'icmpOutAddrMaskReps',
);
$data = snmpwalk_cache_oid($device, 'icmp', array(), 'IP-MIB');
$data = $data[0];
if (isset($data['icmpInMsgs']) && isset($data['icmpOutMsgs'])) {
$rrd_def = new RrdDefinition();
$fields = array();
foreach ($oids as $oid) {
$rrd_def->addDataset($oid, 'COUNTER', null, 100000000000);
$fields[substr($oid, 0, 19)] = isset($data[$oid]) ? $data[$oid] : 'U';
}
$tags = compact('rrd_def');
data_update($device, 'netstats-icmp', $tags, $fields);
$os->enableGraph('netstat_icmp');
$os->enableGraph('netstat_icmp_info');
}
unset($oids, $data, $rrd_def, $fields, $tags);
}//end if