-
Notifications
You must be signed in to change notification settings - Fork 50
Description
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!