2018-04-17 09:53:57 -07:00
# Grafana Scripts
2018-02-09 23:49:01 -08:00
Repo for api scripts written (both pushing and pulling) to aggregate data into influxdb for grafana
2018-04-17 08:44:32 -07:00
2018-04-17 09:53:57 -07:00
Requirements /w install links: [Grafana ](http://docs.grafana.org/installation/ ), [Python3 ](https://www.python.org/downloads/ ), [InfluxDB ](https://docs.influxdata.com/influxdb/v1.5/introduction/installation/ )
2018-04-17 08:44:32 -07:00
2018-04-17 09:53:57 -07:00
## Quick Setup
2018-04-24 08:29:57 -07:00
1. Install requirements (If using tautulli.py you need to `pip3 install geoip2` )
2018-04-17 09:53:57 -07:00
2. Create your plex database in influx
```sh
user@server: ~$ influx
> CREATE DATABASE plex
> quit
```
3. After completing the [getting started ](http://docs.grafana.org/guides/getting_started/ ) portion of grafana, create your datasource for influxdb. At a minimum, you will need the plex database.
4. Click the + on your menu and click import. Using the .json provided in this repo, paste it in and customize as you like.
2018-04-17 09:15:14 -07:00
2018-04-17 09:53:57 -07:00
## Notes
2018-04-17 10:00:30 -07:00
To run the python scripts crontab is currently leveraged. Examples:
```sh
### Modify paths as appropriate. python3 is located in different places for different users. (`which python3` will give you the path)
### to edit your crontab entry, do not modify /var/spool/cron/crontabs/<user> directly, use `crontab -e`
### Crontabs require an empty line at the end or they WILL not run. Make sure to have 2 lines to be safe
### It is bad practice to run any cronjob more than once a minute. For timing help: https://crontab.guru/
* * * * * /usr/bin/python3 /path-to-grafana-scripts/ombi.py
* * * * * /usr/bin/python3 /path-to-grafana-scripts/tautulli.py
*/30 * * * * /usr/bin/python3 /path-to-grafana-scripts/radarr.py
*/30 * * * * /usr/bin/python3 /path-to-grafana-scripts/sonarr.py
*/30 * * * * /usr/bin/python3 /path-to-grafana-scripts/sickrage.py
```