From b18db6d0d37997354f4e149f6299586332e93576 Mon Sep 17 00:00:00 2001 From: Skylark Date: Sat, 23 Jul 2022 01:29:52 +0000 Subject: [PATCH 1/3] Removing rrd_dir when rrdcached is being used --- map-poller.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/map-poller.php b/map-poller.php index 56e3782f..66ce2ed7 100755 --- a/map-poller.php +++ b/map-poller.php @@ -56,11 +56,19 @@ 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']; - } + if ("." != $file && ".." != $file && ".htaccess" != $file && "index.php" != $file) + { + $cmd = "php ./poller.php --config $conf_dir/$file --base-href $basehref"; + + if (!empty($config['rrdcached'])) + { + $cmd = $cmd." --daemon ".$config['rrdcached']; + } + else + { + $cmd = $cmd." --chdir ".$config['rrd_dir']; + } + $fp = popen($cmd, 'r'); while (!feof($fp)) { $read = fgets($fp); From 745a0a34ec90b32faeab7834132277049fbfc2c4 Mon Sep 17 00:00:00 2001 From: Skylark Date: Sat, 23 Jul 2022 01:36:50 +0000 Subject: [PATCH 2/3] Fixing data read of links RRDcached information is not a file so "file_exists" is failing, ($map->daemon) is being used as a rrdcached checker in other places in the same file so it can easily be use as secondary approval. --- lib/datasources/WeatherMapDataSource_rrd.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/datasources/WeatherMapDataSource_rrd.php b/lib/datasources/WeatherMapDataSource_rrd.php index 4735870c..d53611b2 100644 --- a/lib/datasources/WeatherMapDataSource_rrd.php +++ b/lib/datasources/WeatherMapDataSource_rrd.php @@ -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"); From 2481c35972daf20402629ffb0c6cbfcc2d638a03 Mon Sep 17 00:00:00 2001 From: Skylark Date: Sat, 23 Jul 2022 01:44:03 +0000 Subject: [PATCH 3/3] correction --- map-poller.php | 53 +++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/map-poller.php b/map-poller.php index 66ce2ed7..406ad169 100755 --- a/map-poller.php +++ b/map-poller.php @@ -53,30 +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 ./poller.php --config $conf_dir/$file --base-href $basehref"; - - if (!empty($config['rrdcached'])) - { - $cmd = $cmd." --daemon ".$config['rrdcached']; - } - else - { - $cmd = $cmd." --chdir ".$config['rrd_dir']; - } - - $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); + } + } + } +} ?>