Skip to content

rrdcached local socket issue #88

@lwhitworth

Description

@lwhitworth

Weathermap seemed to not be reading RRDs properly when using rrdached on a socket such as unix:/run/rrdcached.sock

Stepping through the cmd as built in map-poller.php got me:

php ./weathermap.php --config /opt/librenms/html/plugins/Weathermap/configs/myconf.conf --base-href /plugins/Weathermap/ --daemon unix:/var/run/rrdcached.sock --chdir '' --debug

This threw:

DEBUG: [wmrrd_read_from_real_rrdtool@WeatherMapDataSource_rrd.php:245] /opt/librenms/html/plugins/Weathermap/configs/myconf.conf: RRD ReadData: Running: /usr/bin/rrdtool fetch myswitch/port-id5044.rrd AVERAGE --start now-800 --end now --daemon unix:/var/run/rrdcached.sock 
ERROR: realpath(myswitch/port-id5044.rrd): No such file or directory

So it's looking for the rrd file on an incomplete path. Running:

 /usr/bin/rrdtool fetch /opt/librenms/rrd/myswitch/port-id5044.rrd AVERAGE --start now-800 --end now --daemon unix:/var/run/rrdcached.sock 

Confirmed it worked, so for my issue to be fixed I had to modify map-poller.php line 71 to read:

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

I then had to comment out two instances of the following in lib/datasources/WeatherMapDataSource_rrd.php:

// rrdcached Support: strip "./" from Data Source
if ($map->daemon)
{
    $rrdfile = trim($rrdfile,"^./"); 
}

Reading through previous pulls / commits I see that plenty of logic has been added recently by @LoveSkylark for their use case which I think uses rrdcached exposed via an ip:port as oppsed to a socket, so I would imagine some extra logic needs to be written around to account for when rrdcached references a socket......unless someone wnats to tell me I'm way off the mark!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions