Skip to content

Commit

Permalink
Merge pull request #1 from LoveSkylark/RRD
Browse files Browse the repository at this point in the history
remote rrdcached fix
  • Loading branch information
LoveSkylark authored Jul 24, 2022
2 parents 018334a + 2481c35 commit f8010e2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/datasources/WeatherMapDataSource_rrd.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ function ReadData($targetstring, &$map, &$item)
{
wm_debug("poller_output didn't get anything useful. Kicking it old skool.\n");
}
if(file_exists($rrdfile))
if(file_exists($rrdfile) || ($map->daemon))
{
wm_debug ("RRD ReadData: Target DS names are ".$dsnames[IN]." and ".$dsnames[OUT]."\n");

Expand Down
45 changes: 27 additions & 18 deletions map-poller.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,31 @@
// Change to directory that map-poller is in.
chdir(__DIR__);

if (is_dir($conf_dir)) {
if ($dh = opendir($conf_dir)) {
while (($file = readdir($dh)) !== false) {
if ("." != $file && ".." != $file && ".htaccess" != $file && "index.php" != $file) {
$cmd = "php ./weathermap.php --config $conf_dir/$file --base-href $basehref --chdir ".$config['rrd_dir'];
if (!empty($config['rrdcached'])) {
$cmd = $cmd." --daemon ".$config['rrdcached'];
}
$fp = popen($cmd, 'r');
while (!feof($fp)) {
$read = fgets($fp);
echo $read;
}
pclose($fp);
}
}
}
}
if (is_dir($conf_dir)) {
if ($dh = opendir($conf_dir)) {
while (($file = readdir($dh)) !== false) {
if ("." != $file && ".." != $file && ".htaccess" != $file && "index.php" != $file)
{
$cmd = "php ./weathermap.php --config $conf_dir/$file --base-href $basehref";

if (!empty($config['rrdcached']))
{
$cmd = $cmd." --daemon ".$config['rrdcached']." --chdir ''";
}
else
{
$cmd = $cmd." --chdir ".$config['rrd_dir'];
}

$fp = popen($cmd, 'r');

while (!feof($fp)) {
$read = fgets($fp);
echo $read;
}
pclose($fp);
}
}
}
}
?>

0 comments on commit f8010e2

Please sign in to comment.