Grafana JSON DataSource server for Ledger-cli.
This is a small Go backend server for using with Grafana's SimpleJson DataSource plugin.
Note: There is a hacky PHP alternative here which uses directly ledger-cli for data access.
Note: This is only a proof of concept project. Use it at your own risk.
Make sure you have Go installed.
Install the server:
go get github.com/aquilax/grafana-ledger-data-source-server
Now you can run the server like that:
grafana-ledger-data-source-server -f path/to/your/file.ledger
The easiest way to get started is by using the docker image for following these instructions.
At the time of writing the command to run is:
docker run \
-d \
-p 3000:3000 \
--name=grafana \
-e "GF_INSTALL_PLUGINS=grafana-simple-json-datasource" \
grafana/grafana
Note that the GF_INSTALL_PLUGINS=grafana-simple-json-datasource
installs the grafana-simple-json-datasource plugin.
After the command runs successfully, head to http://localhost:3000 and log in with admin/admin
.
Add data source
.SimpleJSON
plugin from the list.http://localhost:8080
in the URL fieldBrowser
in the Access fieldIf the server is running, you should see a success message
Add Query
.SimpleJSON
data source (for new installation it is also the default)timeserie
(default)Both exact account names and account groups can be used when query-ing the data. For example for the following ledger transaction:
2015/10/12 Exxon
Expenses:Food:Lunch 10.00
Expenses:Food:Dinner 20.00
Liabilities:MasterCard
These are all available accounts to select from:
Liabilities:
Liabilities:MasterCard
Expenses:
Expenses:Food:
Expenses:Food:Dinner
Expenses:Food:Lunch
For the names that end on :
, the data will be aggregated for all accounts that start with the selected prefix. For example the value for Expenses:Food:
will be 30.00
for 2015/10/12
.