It is just draft with basic functions.
Displays on the terminal a brief info about Grafana objects. It can be useful when you have a lot of backups from Grafana in JSON-files. Utility will help you find for example a right dashboard by tag or panel name.
The code based on autograf library.
Planned features:
- treats input as JSON and parse it for Grafana objects
- recognize dashboards, datasources, users
- get a bunch objects at once (from files or stdin)
- show brief info about each succesfully parsed object
- output important fields in key=value format (for easy grepping)
Usage example:
$ grafana-info < myfile.json
Example output:
=== Dashboard <175980> "Example API" ===
Tags: [autogenerated] [example] [dev]
Templating Vars: [env] [database] [datasource]
--- Row New row ---
| MAX DB response time | Max per handler time |
| singlestat | singlestat |
--- Row Information By Hosts ---
| Handler Max AVG [1min] r | DB Max AVG[1min] resp |
| graph | graph |
--- Row Handlers Response Time ---
| Top handlers response ti | Top handlers response | Handler RPS |
| graph | graph | table |
--- Row DB ---
| DB Top Query Duration | Top Hits Queries coun | AVG Response Time by db |
| graph | graph | |
Or for conjunction with grep
:
$ grafana-info --keys *.json
id: 175980
175980.slug: example-api
example-api.175980.dashboard: Example API
example-api.175980.tag: autogenerated
example-api.175980.tag: example
example-api.175980.tag: dev
example-api.175980.templating: env
example-api.175980.templating: datasource
example-api.175980.row: New row
example-api.175980.panel: MAX DB response time
example-api.175980.type: singlestat
So you easily can find slug and ID of the dashboard:
$ grafana-info --keys *.json | grep tag: "(dev|staging)"
example-api.175980.tag: dev
Future usage examples:
$ grafana-info path/to/backups/*.json
$ for f in *json; do cat $f; done | grafana-info --color