Files
librenms-librenms/includes/polling/netstats-ip_forward.inc.php

40 lines
1.1 KiB
PHP
Raw Normal View History

2015-05-19 19:58:46 +02:00
<?php
2015-07-13 20:10:26 +02:00
if ($device['os'] != 'Snom') {
echo ' IP-FORWARD';
2015-05-19 19:58:46 +02:00
2015-07-13 20:10:26 +02:00
// Below have more oids, and are in trees by themselves, so we can snmpwalk_cache_oid them
$oids = array('ipCidrRouteNumber');
2015-05-19 19:58:46 +02:00
unset($snmpstring, $fields, $snmpdata, $snmpdata_cmd, $rrd_create);
2015-05-19 19:58:46 +02:00
$rrd_def = array();
$snmpstring = '';
2015-07-13 20:10:26 +02:00
foreach ($oids as $oid) {
$oid_ds = truncate($oid, 19, '');
$rrd_create[] = "DS:$oid_ds:GAUGE:600:U:1000000"; // Limit to 1MPPS?
2015-07-13 20:10:26 +02:00
$snmpstring .= ' IP-FORWARD-MIB::'.$oid.'.0';
}
2015-05-19 19:58:46 +02:00
2015-07-13 20:10:26 +02:00
$data = snmp_get_multi($device, $snmpstring, '-OQUs', 'IP-FORWARD-MIB');
2015-05-19 19:58:46 +02: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];
} else {
2015-07-13 20:10:26 +02:00
$value = 'U';
}
$fields[$oid] = $value;
2015-07-13 20:10:26 +02:00
}
if (isset($data[0]['ipCidrRouteNumber'])) {
$tags = compact('rrd_def');
data_update($device, 'netstats-ip_forward', $tags, $fields);
2015-08-19 20:58:02 +00:00
2015-07-13 20:10:26 +02:00
$graphs['netstat_ip_forward'] = true;
2015-05-19 19:58:46 +02:00
}
}
unset($oids, $rrd_def, $data, $oid, $fields, $snmpstring, $tags);