Files
librenms-librenms/includes/polling/ipSystemStats.inc.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

122 lines
5.1 KiB
PHP
Raw Normal View History

<?php
// IP-MIB::ipSystemStatsInReceives.ipv4 = Counter32: 1062322382
// IP-MIB::ipSystemStatsInReceives.ipv6 = Counter32: 5229983
// IP-MIB::ipSystemStatsHCInReceives.ipv4 = Counter64: 1062322382
// IP-MIB::ipSystemStatsHCInReceives.ipv6 = Counter64: 5229983
// IP-MIB::ipSystemStatsHCInOctets.ipv4 = Counter64: 0
// IP-MIB::ipSystemStatsHCInOctets.ipv6 = Counter64: 0
// IP-MIB::ipSystemStatsInHdrErrors.ipv4 = Counter32: 199
// IP-MIB::ipSystemStatsInHdrErrors.ipv6 = Counter32: 0
// IP-MIB::ipSystemStatsInAddrErrors.ipv4 = Counter32: 0
// IP-MIB::ipSystemStatsInAddrErrors.ipv6 = Counter32: 0
// IP-MIB::ipSystemStatsInUnknownProtos.ipv4 = Counter32: 1
// IP-MIB::ipSystemStatsInUnknownProtos.ipv6 = Counter32: 0
// IP-MIB::ipSystemStatsInForwDatagrams.ipv4 = Counter32: 4350883
// IP-MIB::ipSystemStatsInForwDatagrams.ipv6 = Counter32: 0
// IP-MIB::ipSystemStatsHCInForwDatagrams.ipv4 = Counter64: 4350883
// IP-MIB::ipSystemStatsHCInForwDatagrams.ipv6 = Counter64: 0
// IP-MIB::ipSystemStatsReasmReqds.ipv4 = Counter32: 0
// IP-MIB::ipSystemStatsReasmReqds.ipv6 = Counter32: 0
// IP-MIB::ipSystemStatsReasmOKs.ipv4 = Counter32: 573
// IP-MIB::ipSystemStatsReasmOKs.ipv6 = Counter32: 191
// IP-MIB::ipSystemStatsReasmFails.ipv4 = Counter32: 2
// IP-MIB::ipSystemStatsReasmFails.ipv6 = Counter32: 0
// IP-MIB::ipSystemStatsInDiscards.ipv4 = Counter32: 0
// IP-MIB::ipSystemStatsInDiscards.ipv6 = Counter32: 0
// IP-MIB::ipSystemStatsInDelivers.ipv4 = Counter32: 1053500708
// IP-MIB::ipSystemStatsInDelivers.ipv6 = Counter32: 5229756
// IP-MIB::ipSystemStatsHCInDelivers.ipv4 = Counter64: 1053500708
// IP-MIB::ipSystemStatsHCInDelivers.ipv6 = Counter64: 5229756
// IP-MIB::ipSystemStatsOutRequests.ipv4 = Counter32: 874021272
// IP-MIB::ipSystemStatsOutRequests.ipv6 = Counter32: 5157066
// IP-MIB::ipSystemStatsHCOutRequests.ipv4 = Counter64: 874021272
// IP-MIB::ipSystemStatsHCOutRequests.ipv6 = Counter64: 5157066
// IP-MIB::ipSystemStatsOutNoRoutes.ipv4 = Counter32: 1
// IP-MIB::ipSystemStatsOutNoRoutes.ipv6 = Counter32: 0
// IP-MIB::ipSystemStatsHCOutForwDatagrams.ipv4 = Counter64: 0
// IP-MIB::ipSystemStatsHCOutForwDatagrams.ipv6 = Counter64: 0
// IP-MIB::ipSystemStatsOutDiscards.ipv4 = Counter32: 205
// IP-MIB::ipSystemStatsOutDiscards.ipv6 = Counter32: 0
// IP-MIB::ipSystemStatsOutFragFails.ipv4 = Counter32: 0
// IP-MIB::ipSystemStatsOutFragFails.ipv6 = Counter32: 0
// IP-MIB::ipSystemStatsOutFragCreates.ipv4 = Counter32: 0
// IP-MIB::ipSystemStatsOutFragCreates.ipv6 = Counter32: 68
// IP-MIB::ipSystemStatsDiscontinuityTime.ipv4 = Timeticks: (0) 0:00:00.00
// IP-MIB::ipSystemStatsDiscontinuityTime.ipv6 = Timeticks: (0) 0:00:00.00
// IP-MIB::ipSystemStatsRefreshRate.ipv4 = Gauge32: 30000 milli-seconds
// IP-MIB::ipSystemStatsRefreshRate.ipv6 = Gauge32: 30000 milli-seconds
2015-07-13 20:10:26 +02:00
use LibreNMS\RRD\RrdDefinition;
$data = snmpwalk_cache_oid($device, 'ipSystemStats', null, 'IP-MIB');
if ($data) {
$oids = [
'ipSystemStatsInReceives',
'ipSystemStatsInHdrErrors',
'ipSystemStatsInAddrErrors',
'ipSystemStatsInUnknownProtos',
'ipSystemStatsInForwDatagrams',
'ipSystemStatsReasmReqds',
'ipSystemStatsReasmOKs',
'ipSystemStatsReasmFails',
'ipSystemStatsInDiscards',
'ipSystemStatsInDelivers',
'ipSystemStatsOutRequests',
'ipSystemStatsOutNoRoutes',
'ipSystemStatsOutDiscards',
'ipSystemStatsOutFragFails',
'ipSystemStatsOutFragCreates',
'ipSystemStatsOutForwDatagrams',
];
foreach ($data as $af => $stats) {
echo "$af ";
2015-07-13 20:10:26 +02:00
// Use HC counters instead if they're available.
if (isset($stats['ipSystemStatsHCInReceives'])) {
$stats['ipSystemStatsInReceives'] = $stats['ipSystemStatsHCInReceives'];
}
2015-07-13 20:10:26 +02:00
if (isset($stats['ipSystemStatsHCInForwDatagrams'])) {
$stats['ipSystemStatsInForwDatagrams'] = $stats['ipSystemStatsHCInForwDatagrams'];
}
2015-07-13 20:10:26 +02:00
if (isset($stats['ipSystemStatsHCInDelivers'])) {
$stats['ipSystemStatsInDelivers'] = $stats['ipSystemStatsHCInDelivers'];
}
2015-07-13 20:10:26 +02:00
if (isset($stats['ipSystemStatsHCOutRequests'])) {
$stats['ipSystemStatsOutRequests'] = $stats['ipSystemStatsHCOutRequests'];
}
2015-07-13 20:10:26 +02:00
if (isset($stats['ipSystemStatsHCOutForwDatagrams'])) {
$stats['ipSystemStatsOutForwDatagrams'] = $stats['ipSystemStatsHCOutForwDatagrams'];
2015-07-13 20:10:26 +02:00
}
$rrd_name = ['ipSystemStats', $af];
$rrd_def = new RrdDefinition();
$fields = [];
2015-07-13 20:10:26 +02:00
foreach ($oids as $oid) {
$oid_ds = str_replace('ipSystemStats', '', $oid);
$rrd_def->addDataset($oid_ds, 'COUNTER');
if (strstr($stats[$oid], 'No') || strstr($stats[$oid], 'd') || strstr($stats[$oid], 's')) {
$stats[$oid] = '0';
}
Refactor Datastores to allow future improvements. OpenTSDB Tags. (#11283) * Datastores to object oriented code, using the Laravel IoC container Change instantiation better DI move OpenTSDB Small re-orgs remove unused stuff Fix graphs and other scripts Use DI for all except rrd fix up connection error handling Add tests, fix up a "few" things Add Config::forget() Style fixes Don't reference legacy code remove accidental code paste Add datastores phpunit groups some tests * rebase fixes * some test fixes * shorter tests * shorter tests * Don't except when rrdtool can't be started. * restore tests * fix rrd tests * fix iterable change upstream * fix isValidDataset * fix invalid data bug * fix mysql incorrect ds * fix issue with data that is too long * use regular data_update() * Use log facade * OpenTSDB mis-ordered arguments fix * Making a singleton with different options makes different singletons. Just use the global config settings to disable datastores. * only filter tags for datastores that won't it don't modify the tags permanently * Update copyrights to include original authors. * Stats for all datastores * Fix mysql sends different rrd / other ds names * fix snmp last stats not initialized remove unused function * remove unused function and move single use function closer to its use * InfluxDB does not need to update null or U values. Skip write if all fields are empty * Fix smart value checks * fix style issues * Make sure port data is stored the same way as before for Graphite and OpenTSDB Add ifIndex tag to all to be compatible * Missed rrdtool_tune() call * Test update WIP * OpenTSDB now includes tags * fix style
2020-03-16 09:17:58 -05:00
$fields[$oid_ds] = $stats[$oid];
}
2015-07-13 20:10:26 +02:00
$tags = compact('af', 'rrd_name', 'rrd_def');
data_update($device, 'ipSystemStats', $tags, $fields);
2015-07-13 20:10:26 +02:00
// FIXME per-AF?
$os->enableGraph("ipsystemstats_$af");
$os->enableGraph("ipsystemstats_{$af}_frag");
}//end foreach
2015-07-13 20:10:26 +02:00
}//end if
unset($oids, $data);
echo "\n";