From 567a31f45f251789906aebb3c92ecc7ffa3de2f4 Mon Sep 17 00:00:00 2001 From: laf Date: Mon, 27 Apr 2015 10:04:57 +0100 Subject: [PATCH 1/2] Added support for using rrdcached via tcp connections --- includes/defaults.inc.php | 1 + includes/rrdtool.inc.php | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index b22b0957bb..1efe586178 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -85,6 +85,7 @@ $config['rrd_rra'] .= " RRA:LAST:0.5:1:1440 "; // RRDCacheD - Make sure it can write to your RRD dir! #$config['rrdcached'] = "unix:/var/run/rrdcached.sock"; +$config['rrdcached_dir'] = FALSE;// Set this if you are using tcp connections to rrdcached // Web Interface Settings diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index d00d5105ed..e8f0fd4f1d 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -107,6 +107,10 @@ function rrdtool_graph($graph_file, $options) if ($config['rrdcached']) { + if (isset($config['rrdcached_dir']) && $config['rrdcached_dir'] !== FALSE) { + $options = str_replace($config['rrd_dir']."/",$config['rrdcached_dir']."/",$options); + $options = str_replace($config['rrd_dir'] ,$config['rrdcached_dir']."/",$options); + } fwrite($rrd_pipes[0], "graph --daemon " . $config['rrdcached'] . " $graph_file $options"); } else { fwrite($rrd_pipes[0], "graph $graph_file $options"); @@ -150,10 +154,15 @@ function rrdtool($command, $filename, $options) { global $config, $debug, $rrd_pipes, $console_color; - $cmd = "$command $filename $options"; if ($command != "create" && $config['rrdcached']) { - $cmd .= " --daemon " . $config['rrdcached']; + if (isset($config['rrdcached_dir']) && $config['rrdcached_dir'] !== FALSE) { + $filename = str_replace($config['rrd_dir']."/",$config['rrdcached_dir']."/",$filename); + $filename = str_replace($config['rrd_dir'] ,$config['rrdcached_dir']."/",$filename); + } + $cmd = "$command $filename $options --daemon " . $config['rrdcached']; + } else { + $cmd = "$command $filename $options"; } if ($config['norrd']) From 28ae1bf6a831fa6d2f99259335e21e77eedd6c4f Mon Sep 17 00:00:00 2001 From: laf Date: Mon, 27 Apr 2015 15:17:02 +0100 Subject: [PATCH 2/2] Added simple doc to distributed poller setup --- doc/Extensions/Distributed-Poller.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/Extensions/Distributed-Poller.md b/doc/Extensions/Distributed-Poller.md index 59beb53175..05dfc74831 100644 --- a/doc/Extensions/Distributed-Poller.md +++ b/doc/Extensions/Distributed-Poller.md @@ -81,3 +81,10 @@ RRDCached: - You will need to tune RRDCached to suite your environment. - The following is used in this example setup "-l 0:42217 -j /var/lib/rrdcached/journal/ -F -b /opt/librenms/rrd -B -w 1800 -z 900 -p /var/run/rrdcached.pid" +```php +$config['rrdcached'] = "127.0.0.1:42217"; +$config['rrd_dir'] = "/opt/librenms/rrd"; +$config['rrdcached_dir'] = ""; +``` + +$config['rrdcached_dir'] Is only needed if you are using tcp connections for rrd cached and needs only to be set if you want to store rrd files within a sub directory of your rrdcached base directory.