I was trying to enable the RRD application monitoring in Libre and faced an issue with the rrdcached.inc.php parameters.
`
$sock = fsockopen($device[‘hostname’], 42217, $errno, $errstr, 5);
These are the options for the sock file that are available in the file, but mine is in a different directory:/database/rrdtool/rrdcached.sock`
I managed to make it work adding my directory to the file, but when I do that, I get the error in validate saying that the file is not the same as the one available in git:
[WARN] Your local git contains modified files, this could prevent automatic updates. [FIX]: You can fix this with ./scripts/github-remove Modified Files: includes/polling/applications/rrdcached.inc.php
Would it be possible to get the path to the .sock file from the config.php parameters?
Well, I tried for a few hours and I found out that I’d have to go about learning PHP from zero to be able to do that on my own.
Could you, or anyone else, give me some pointers on how to import a variable from the config.php file? I have tried reverse-engineering the validate.php file for that, but failed.
No, I am not looking for the RRDcached configuration itself, I have it running smoothly. What I tried to do was adding RRDcached as an application to be monitored by Libre, same as MySQL and Apache.
I did that, but it was not plotting. I then ran the polling in debug mode and found out that the rrdcached.inc.php script was failing because it could not locate the .sock file. And that is when I opened the topic.
These are the paths the script checks: if (!$sock) { if (file_exists('/var/run/rrdcached.sock')) { $sock = fsockopen('unix:///var/run/rrdcached.sock'); } elseif (file_exists('/var/run/rrdcached/rrdcached.sock')) { $sock = fsockopen('unix:///var/run/rrdcached/rrdcached.sock'); } elseif (file_exists('/run/rrdcached.sock')) { $sock = fsockopen('unix:///run/rrdcached.sock'); } elseif (file_exists('/tmp/rrdcached.sock')) { $sock = fsockopen('unix:///tmp/rrdcached.sock'); }
Hi, now it is working properly, but there is just one detail that needs to be watched.
In the config.php file, when you define the socket file, you have to start with unix://<path to file>/file.sock
If you define it without the “//” , as suggested in the documentation, the rrdcached.inc.php script will fail.
In my case: $config['rrdcached'] = 'unix:///db/rrdtool/rrdcached.sock'; Works $config['rrdcached'] = 'unix:/db/rrdtool/rrdcached.sock'; Does not work