RRDcached monitoring - custom rrdcached.sock dir

Hi,

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);

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');
    }
}

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?

Thanks and regards,
Marcelo

good point, could you do a Pull Request and do the fix in it?

I can certainly try, never done that before :slight_smile:

maintainers will help you on problems :slight_smile:

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.

i took a look to help you and found in global settings this:
Isn’t it what you’re searching for?

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.

ah ok, there we are …
you have to enable it in Device Settings where RRDCached is running on:

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'); }

But my file is not in any of those.

yeah,i found it too.

writing a PR now to fix this issue

Great, thanks!