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
|
|
|
|
2015-08-18 16:26:55 +00:00
|
|
|
unset($snmpstring, $fields, $snmpdata, $snmpdata_cmd, $rrd_create);
|
2015-07-13 20:10:26 +02:00
|
|
|
$rrd_file = $config['rrd_dir'].'/'.$device['hostname'].'/netstats-ip_forward.rrd';
|
2015-05-19 19:58:46 +02:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$rrd_create = $config['rrd_rra'];
|
2015-05-19 19:58:46 +02:00
|
|
|
|
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?
|
|
|
|
$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
|
|
|
|
2015-08-18 16:26:55 +00:00
|
|
|
$fields = array();
|
2015-05-19 19:58:46 +02:00
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
foreach ($oids as $oid) {
|
|
|
|
if (is_numeric($data[0][$oid])) {
|
|
|
|
$value = $data[0][$oid];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$value = 'U';
|
|
|
|
}
|
2015-08-18 16:26:55 +00:00
|
|
|
$fields[$oid] = $value;
|
2015-07-13 20:10:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($data[0]['ipCidrRouteNumber'])) {
|
|
|
|
if (!file_exists($rrd_file)) {
|
|
|
|
rrdtool_create($rrd_file, $rrd_create);
|
|
|
|
}
|
|
|
|
|
2015-08-18 16:26:55 +00:00
|
|
|
rrdtool_update($rrd_file, $fields);
|
2015-08-19 20:58:02 +00:00
|
|
|
|
|
|
|
$tags = array();
|
|
|
|
influx_update($device,'netstats-ip_forward',$tags,$fields);
|
|
|
|
|
|
|
|
|
2015-07-13 20:10:26 +02:00
|
|
|
$graphs['netstat_ip_forward'] = true;
|
2015-05-19 19:58:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unset($oids, $data, $data_array, $oid, $protos, $snmpstring);
|