mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Remove nfs requirement for distributed poller (with rrdtool 1.5+)
Use data_update instead of rrd_update/rrd_create and influx_update Centralize rrd file check so we can check against a remote rrdcached server too Use rrd_name() to generate rrd file names
This commit is contained in:
@@ -7,21 +7,18 @@ if ($device['os'] != 'Snom') {
|
||||
$oids = array('ipCidrRouteNumber');
|
||||
|
||||
unset($snmpstring, $fields, $snmpdata, $snmpdata_cmd, $rrd_create);
|
||||
$rrd_file = $config['rrd_dir'].'/'.$device['hostname'].'/netstats-ip_forward.rrd';
|
||||
|
||||
$rrd_create = $config['rrd_rra'];
|
||||
|
||||
$rrd_def = array();
|
||||
$snmpstring = '';
|
||||
foreach ($oids as $oid) {
|
||||
$oid_ds = truncate($oid, 19, '');
|
||||
$rrd_create .= " DS:$oid_ds:GAUGE:600:U:1000000";
|
||||
// Limit to 1MPPS?
|
||||
$oid_ds = truncate($oid, 19, '');
|
||||
$rrd_create[] = "DS:$oid_ds:GAUGE:600:U:1000000"; // Limit to 1MPPS?
|
||||
$snmpstring .= ' IP-FORWARD-MIB::'.$oid.'.0';
|
||||
}
|
||||
|
||||
$data = snmp_get_multi($device, $snmpstring, '-OQUs', 'IP-FORWARD-MIB');
|
||||
|
||||
$fields = array();
|
||||
|
||||
foreach ($oids as $oid) {
|
||||
if (is_numeric($data[0][$oid])) {
|
||||
$value = $data[0][$oid];
|
||||
@@ -33,18 +30,11 @@ if ($device['os'] != 'Snom') {
|
||||
}
|
||||
|
||||
if (isset($data[0]['ipCidrRouteNumber'])) {
|
||||
if (!file_exists($rrd_file)) {
|
||||
rrdtool_create($rrd_file, $rrd_create);
|
||||
}
|
||||
|
||||
rrdtool_update($rrd_file, $fields);
|
||||
|
||||
$tags = array();
|
||||
influx_update($device,'netstats-ip_forward',$tags,$fields);
|
||||
|
||||
$tags = compact('rrd_def');
|
||||
data_update($device,'netstats-ip_forward',$tags,$fields);
|
||||
|
||||
$graphs['netstat_ip_forward'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
unset($oids, $data, $data_array, $oid, $protos, $snmpstring);
|
||||
unset($oids, $rrd_def, $data, $oid, $fields, $snmpstring, $tags);
|
||||
|
||||
Reference in New Issue
Block a user