Merge pull request #866 from laf/issue-laf-859

Added support for using rrdcached via tcp connections
This commit is contained in:
Daniel Preussker
2015-04-27 18:29:21 +02:00
3 changed files with 19 additions and 2 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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'])