https://github.com/stackhpc/ansible-role-grafana-conf
Ansible role for configuring Grafana dashboards and data sources
https://github.com/stackhpc/ansible-role-grafana-conf
Last synced: 4 days ago
JSON representation
Ansible role for configuring Grafana dashboards and data sources
- Host: GitHub
- URL: https://github.com/stackhpc/ansible-role-grafana-conf
- Owner: stackhpc
- License: apache-2.0
- Created: 2017-11-22T10:20:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-08-03T08:02:24.000Z (almost 4 years ago)
- Last Synced: 2024-04-14T22:50:17.262Z (about 2 years ago)
- Language: Python
- Homepage:
- Size: 33.2 KB
- Stars: 1
- Watchers: 8
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
Configure Grafana datasources and dashboards
============================================
A simple role for loading dashboards and datasources for
Grafana. It follows the rule that if a dashboard or datasource
with the same name already exists, then it is not updated.
It currently works at the organisation level.
Usage
-----
An example of how to use the role is included in ```example/```.
Requires Ansible >=2.2. If your distro doesn't provide this
you can run Ansible from a venv:
1. Create venv: ```$ virtualenv ansible```
2. Activate venv: ```$ source ansible/bin/activate```
3. Update pip (optional): ```$ pip install -U pip```
4. Install Ansible: ```$ pip install ansible```
Creating dashboards
-------------------
To prevent Grafana stripping out datasource names dashboards
should be downloaded via the API. This can be done via [curl](http://docs.grafana.org/tutorials/api_org_token_howto/#api-tutorial-how-to-create-api-tokens-and-dashboards-for-a-specific-organization),
or via a browser. In this case an example is given for a
browser.
In Grafana switch to the organisation in which the dashboard you
wish to save is located. Then in the same browser access the
dashboard via the API:
http://10.1.2.3:3000/api/dashboards/db/tenant-logs
This will return the dashboard as a JSON string. To allow the
dashboard to load successfully it is required to nullify the
dashboard id. For example:
```
"dashboard":{
"annotations":{"list":[]},
"editable":true",
"gnetId":null,
"hideControls":false,
"id":null, <-- Must be null
"links":[],
"rows":
```