mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 16:04:35 +02:00
Merge pull request #2740 from paulgear/unified-data-storage-rrd-influx
First cut at unified data storage for rrdtool & influxdb
This commit is contained in:
@@ -268,47 +268,30 @@ function poll_device($device, $options) {
|
||||
$device_run = ($device_end - $device_start);
|
||||
$device_time = substr($device_run, 0, 5);
|
||||
|
||||
// TODO: These should be easy converts to rrd_create_update()
|
||||
// Poller performance rrd
|
||||
$poller_rrd = $config['rrd_dir'].'/'.$device['hostname'].'/poller-perf.rrd';
|
||||
if (!is_file($poller_rrd)) {
|
||||
rrdtool_create($poller_rrd, 'DS:poller:GAUGE:600:0:U '.$config['rrd_rra']);
|
||||
}
|
||||
|
||||
// Poller performance
|
||||
if (!empty($device_time)) {
|
||||
$tags = array(
|
||||
'rrd_def' => 'DS:poller:GAUGE:600:0:U',
|
||||
);
|
||||
$fields = array(
|
||||
'poller' => $device_time,
|
||||
);
|
||||
rrdtool_update($poller_rrd, $fields);
|
||||
|
||||
$tags = array();
|
||||
influx_update($device,'poller-perf',$tags,$fields);
|
||||
|
||||
data_update($device, 'poller-perf', $tags, $fields);
|
||||
}
|
||||
|
||||
// Ping response rrd
|
||||
if (can_ping_device($attribs) === true) {
|
||||
$ping_rrd = $config['rrd_dir'].'/'.$device['hostname'].'/ping-perf.rrd';
|
||||
if (!is_file($ping_rrd)) {
|
||||
rrdtool_create($ping_rrd, 'DS:ping:GAUGE:600:0:65535 '.$config['rrd_rra']);
|
||||
}
|
||||
|
||||
if (!empty($ping_time)) {
|
||||
$fields = array(
|
||||
'ping' => $ping_time,
|
||||
);
|
||||
|
||||
rrdtool_update($ping_rrd, $fields);
|
||||
}
|
||||
// Ping response
|
||||
if (can_ping_device($attribs) === true && !empty($ping_time)) {
|
||||
$tags = array(
|
||||
'rrd_def' => 'DS:ping:GAUGE:600:0:65535',
|
||||
);
|
||||
$fields = array(
|
||||
'ping' => $ping_time,
|
||||
);
|
||||
|
||||
$update_array['last_ping'] = array('NOW()');
|
||||
$update_array['last_ping_timetaken'] = $ping_time;
|
||||
|
||||
rrdtool_update($ping_rrd, $fields);
|
||||
|
||||
$tags = array();
|
||||
influx_update($device,'ping-perf',$tags,$fields);
|
||||
|
||||
data_update($device, 'ping-perf', $tags, $fields);
|
||||
}
|
||||
|
||||
$update_array['last_polled'] = array('NOW()');
|
||||
|
||||
Reference in New Issue
Block a user