doublemarket / grafana-rrd-server

A HTTP server that helps Grafana read RRD files via Grafana Simple JSON Datasource plugin
MIT License
153 stars 37 forks source link

Allow RrdPaths without trailing slash #33

Closed juliogonzalez closed 6 years ago

juliogonzalez commented 6 years ago

So far a path without trailing slash failed silently.

For example:

$ ll /tmp/pnp4nagios
total 0
drwxr-xr-x 1 nagios www-data 334 feb  4 19:23 perfdata
$ grafana-rrd-server -r /tmp/pnp4nagios

Did fail silenty, returning null data to Grafana.

Problem is that line 174 produced the following assignation to fileSearchPath

/tmp/pnp4nagiosperfdata/Myhost/Current_Load.rrd

This patch just removes the trailing slash if it exists, and adds a new trailing slash. This work for when there is and when there is not trailing slash.

doublemarket commented 6 years ago

@juliogonzalez Thank you very much for this small but useful fix!