A simple HTTP server that reads RRD files and responds to requests from Grafana with Grafana Simple JSON Datasource plugin.
This server supports all endpoints (urls) defined in the Grafana Simple JSON Datasource plugin documentation but:
- You can use
*as a wildcard in thetargetvalues (but not fords) for the/queryendpoint.
- librrd-dev (rrdtool)
- Go
- Grafana 3.0 and newer + Simple JSON Datasource plugin 1.0.0 and newer
-
Install librrd-dev (rrdtool).
On Ubuntu/Debian:
sudo apt install librrd-devOn CentOS:
sudo yum install rrdtool-develOn openSUSE
sudo zypper in rrdtool-develOn Mac:
brew install rrdtool -
Get the package.
go get github.com/doublemarket/grafana-rrd-serverOtherwise, download the latest release, gunzip it, and put the file in a directory included in
$PATH:gunzip grafana-rrd-server_linux_amd64.gz -
Run the server.
grafana-rrd-serverYou can use the following options:
-h: Shows help messages.-p: Specifies server port. (default: 9000)-i: Specifies server listen address. (default: any)-r: Specifies a directory path keeping RRD files. (default: "./sample/")- The server recursively searches RRD files under the directory and returns a list of them for the
/searchendpoint.
- The server recursively searches RRD files under the directory and returns a list of them for the
-a: Specifies the annotations file. It should be a CSV file which has a title line at the top like the sample file.-s: Default graph step in second. (default: 10)- You can see the step for your RRD file using:
$ rrdtool info [rrd file] | grep step step = 300
- You can see the step for your RRD file using:
-
Optionally set up systemd unit:
useradd grafanarrd
cat > /etc/systemd/system/grafana-rrd-server.service <<EOF
[Unit]
Description=Grafana RRD Server
After=network.service
[Service]
User=grafanarrd
Group=grafanarrd
Restart=on-failure
Environment="LD_LIBRARY_PATH=/opt/rrdtool-1.6/lib"
ExecStart=/opt/grafana-rrd-server/grafana-rrd-server -p 9000 -r /path/to/rrds -s 300
RestartSec=10s
[Install]
WantedBy=default.target
EOF
systemctl daemon-reload
systemctl enable grafana-rrd-server
systemctl start grafana-rrd-server
-
Setup Grafana and Simple JSON Datastore plugin.
-
Create datasource.
-
Install librrd-dev (rrdtool).
See the Usage section.
-
Clone the repository.
-
Commit your code on a separate branch.
-
Create a pull request.
MIT