Merge pull request #2041 from f0o/issue-2037

Check rrdcached before creating rrds
This commit is contained in:
Neil Lathwood
2015-10-04 00:10:16 +01:00
+8 -1
View File
@@ -191,7 +191,7 @@ function rrdtool($command, $filename, $options) {
print $console_color->convert('RRD[%g'.$cmd.'%n] ');
}
else {
$tmp = stream_get_contents($rrd_pipes[1]).stream_get_contents($rrd_pipes[2]);
return array(stream_get_contents($rrd_pipes[1]),stream_get_contents($rrd_pipes[2]));
}
}
@@ -206,6 +206,13 @@ function rrdtool($command, $filename, $options) {
function rrdtool_create($filename, $options) {
global $config;
if( $config['rrdcached'] && $config['rrdtool_version'] >= 1.5 ) {
$chk = rrdtool('info', $filename, '');
if (!empty($chk[0])) {
return true;
}
}
return rrdtool('create', $filename, str_replace(array("\r", "\n"), '', $options));
}