Bash script that uploads the data from guitos JSON backups to influxdb
- bash
- coreutils (date)
- curl
- gzip
- influxdb v2+
- jq
- Optional:
-
Export guitos.app data as JSON.
-
See instructions here: guitos
-
Note that each budget name should follow this format:
YYYY-MM(2023-12)otherwise it won't be possible to parse correctly the period that it corresponds to.
-
-
Copy
guitos_exporter_default.confto a new file named asguitos_exporter.confand configure it (see the section below). -
Execute
guitos_exporter.shwith the path to the guitos json export file as the first argument.
Example:
./guitos_exporter.sh ~/downloads/guitos-2023-05-23T19_40_19.json-
Build the docker image.
docker build . --tag guitos-exporter -
Run it.
docker run --rm --init --tty --interactive --volume ./guitos_exporter.conf:/app/guitos_exporter.conf:ro --volume ~/downloads/guitos-2023-09-18T20_40_20.json:/export.json:ro ghcr.io/rare-magma/guitos-exporter:latest /export.json
The configuration file has a few options:
INFLUXDB_HOST='influxdb.example.com'
INFLUXDB_API_TOKEN='ZXhhbXBsZXRva2VuZXhhcXdzZGFzZGptcW9kcXdvZGptcXdvZHF3b2RqbXF3ZHFhc2RhCg=='
ORG='home'
BUCKET='guitos'INFLUXDB_HOSTshould be the FQDN of the influxdb server.ORGshould be the name of the influxdb organization that contains the guitos price data bucket defined below.BUCKETshould be the name of the influxdb bucket that will hold the guitos data.INFLUXDB_API_TOKENshould be the influxdb API token value.- This token should have write access to the
BUCKETdefined above.
- This token should have write access to the
Run the script manually with bash set to trace:
bash -x ./guitos_exporter.sh- period: The name of the budget
- expenses: The total amount of expenses
- revenue: The total amount of revenue
- available: = revenue - expenses
- goal: % of revenue that should go into savings
- saved: = goal * available / 100
- with_goal: = available - saved
- reserves: emergency fund/cash
guitos,period=2023-05 expenses=600.10 revenue=1000 available=200.10 with_goal=120.20 saved=100 goal=10 reserves=1000 1612134000In grafana-dashboard.json there is an example of the kind of dashboard that can be built with guitos-exporter data:
Import it by doing the following:
- Create a dashboard
- Click the dashboard's settings button on the top right.
- Go to JSON Model and then paste there the content of the
grafana-dashboard.jsonfile.