refactor: Update collectd functions.php to use non-conflict rrd_info function #5478 (#5642)

This commit is contained in:
Neil Lathwood
2017-01-28 00:52:12 +00:00
committed by GitHub
parent a402b1f450
commit 340935e5b0

View File

@@ -386,7 +386,7 @@ function rrd_strip_quotes($str)
* @param string $file Name of RRD file to analyse * @param string $file Name of RRD file to analyse
* @return array Array describing the RRD file * @return array Array describing the RRD file
*/ */
function rrd_info($file) function _rrd_info($file)
{ {
$info = array('filename' => $file); $info = array('filename' => $file);
@@ -443,7 +443,7 @@ function rrd_info($file)
}//end if }//end if
return $info; return $info;
}//end rrd_info() }//end _rrd_info()
function rrd_get_color($code, $line = true) function rrd_get_color($code, $line = true)
@@ -499,7 +499,7 @@ function collectd_draw_rrd($host, $plugin, $type, $pinst = null, $tinst = null,
$rrdfile = sprintf('%s/%s%s%s/%s%s%s', $host, $plugin, is_null($pinst) ? '' : '-', $pinst, $type, is_null($tinst) ? '' : '-', $tinst); $rrdfile = sprintf('%s/%s%s%s/%s%s%s', $host, $plugin, is_null($pinst) ? '' : '-', $pinst, $type, is_null($tinst) ? '' : '-', $tinst);
foreach ($config['datadirs'] as $datadir) { foreach ($config['datadirs'] as $datadir) {
if (is_file($datadir.'/'.$rrdfile.'.rrd')) { if (is_file($datadir.'/'.$rrdfile.'.rrd')) {
$rrdinfo = rrd_info($datadir.'/'.$rrdfile.'.rrd'); $rrdinfo = _rrd_info($datadir.'/'.$rrdfile.'.rrd');
if (isset($rrdinfo['RRA']) && is_array($rrdinfo['RRA'])) { if (isset($rrdinfo['RRA']) && is_array($rrdinfo['RRA'])) {
break; break;
} else { } else {