Skip to content

msedv/Grafana

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grafana

Collection of scripts and informations regarding automatization of Grafana-tasks

Showing/exporting Grafana-configuration

https://github.com/msedv/Grafana/blob/main/showgrafana.py exports the Grafana-Dashboard-Definitions:

python3 showgrafana.py # all dashboards
python3 showgrafana.py <dashboard-name> # one dashboard

Changing legends with Python

The initial discussion: https://community.grafana.com/t/lookup-of-device-ids-for-legend/60401; more details and How-To for overrides: https://github.com/msedv/Grafana/blob/main/Grafana%20Overrides.md.

Where is Grafana data stored: https://stackoverflow.com/questions/65860003/physical-location-of-grafana-dashboards

  • the configuration of the dashboards etc. can usually be found in /var/lib/grafana/grafana.db
  • which is a sqlite-Database with only one entry per dashboard
  • the "real" definitions are JSON-encoded in the "data" field of the dashboard-table
  • where there's an element "overrides" which is what we need

To get an overview of the data: https://sqlitebrowser.org/

To change it with SQL from the BASH: https://sqlite.org/cli.html

apt install sqlite3
sqlite3 /var/lib/grafana/grafana.db
.tables
SELECT data FROM dashboard;
.exit

But: additional parsing of the JSON-data is needed. Python supports sqlite and JSON de-/encoding thus I built the POC (proof of concept) parsegrafana.py which uses the CSV-file parsegrafana.csv to translate machine names to human readable names.

sqlite-access from Python: https://docs.python.org/3/library/sqlite3.html

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages