2010-07-28 12:59:59 +00:00
|
|
|
<?php
|
|
|
|
|
|
2017-02-23 22:45:50 +00:00
|
|
|
use LibreNMS\RRD\RrdDefinition;
|
|
|
|
|
|
2016-12-12 16:25:20 +02:00
|
|
|
if (!starts_with($device['os'], array('Snom', 'asa'))) {
|
2015-07-13 20:10:26 +02:00
|
|
|
echo ' IP';
|
|
|
|
|
|
|
|
|
|
// These are at the start of large trees that we don't want to walk the entirety of, so we snmp_get_multi them
|
|
|
|
|
$oids = array(
|
|
|
|
|
'ipForwDatagrams',
|
|
|
|
|
'ipInDelivers',
|
|
|
|
|
'ipInReceives',
|
|
|
|
|
'ipOutRequests',
|
|
|
|
|
'ipInDiscards',
|
|
|
|
|
'ipOutDiscards',
|
|
|
|
|
'ipOutNoRoutes',
|
|
|
|
|
'ipReasmReqds',
|
|
|
|
|
'ipReasmOKs',
|
|
|
|
|
'ipReasmFails',
|
|
|
|
|
'ipFragOKs',
|
|
|
|
|
'ipFragFails',
|
|
|
|
|
'ipFragCreates',
|
|
|
|
|
'ipInUnknownProtos',
|
|
|
|
|
'ipInHdrErrors',
|
|
|
|
|
'ipInAddrErrors',
|
|
|
|
|
);
|
|
|
|
|
|
2017-02-23 22:45:50 +00:00
|
|
|
$rrd_def = new RrdDefinition();
|
2016-07-07 01:33:43 -05:00
|
|
|
$snmpstring = '';
|
2015-07-13 20:10:26 +02:00
|
|
|
foreach ($oids as $oid) {
|
2017-03-04 18:14:20 +00:00
|
|
|
$rrd_def->addDataset($oid, 'COUNTER', null, 100000000000);
|
2015-07-13 20:10:26 +02:00
|
|
|
$snmpstring .= ' IP-MIB::'.$oid.'.0';
|
|
|
|
|
}
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$data = snmp_get_multi($device, $snmpstring, '-OQUs', 'IP-MIB');
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2015-08-18 16:26:55 +00:00
|
|
|
$fields = array();
|
2015-07-13 20:10:26 +02:00
|
|
|
foreach ($oids as $oid) {
|
|
|
|
|
if (is_numeric($data[0][$oid])) {
|
|
|
|
|
$value = $data[0][$oid];
|
2016-08-28 12:32:58 -05:00
|
|
|
} else {
|
2015-07-13 20:10:26 +02:00
|
|
|
$value = 'U';
|
|
|
|
|
}
|
2015-08-18 16:26:55 +00:00
|
|
|
$fields[$oid] = $value;
|
2015-07-13 20:10:26 +02:00
|
|
|
}
|
2010-07-28 12:59:59 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
if (isset($data[0]['ipOutRequests']) && isset($data[0]['ipInReceives'])) {
|
2016-07-07 01:33:43 -05:00
|
|
|
$tags = compact('rrd_def');
|
|
|
|
|
data_update($device, 'netstats-ip', $tags, $fields);
|
2015-08-19 20:58:02 +00:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$graphs['netstat_ip'] = true;
|
|
|
|
|
$graphs['netstat_ip_frag'] = true;
|
2011-03-16 01:11:27 +00:00
|
|
|
}
|
2015-07-13 20:10:26 +02:00
|
|
|
}//end if
|
2011-03-16 01:11:27 +00:00
|
|
|
|
2016-07-07 01:33:43 -05:00
|
|
|
unset($oids, $data, $snmpstring, $rrd_def, $fields, $tags);
|