From 8a7210deee4679e60ffa892b10f312da57991a04 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sat, 18 Dec 2021 00:36:54 +0100 Subject: [PATCH] Add two more examples about using `explore dashboards` with `jq` - Display all dashboards which use a specific data source, by name. - Display all dashboards using data sources with a specific type. --- grafana_wtf/commands.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/grafana_wtf/commands.py b/grafana_wtf/commands.py index 279c0e1..add876a 100644 --- a/grafana_wtf/commands.py +++ b/grafana_wtf/commands.py @@ -87,6 +87,12 @@ def run(): # Display only dashboards which have missing data sources, along with their names. grafana-wtf explore dashboards --format=json | jq '.[] | select( .datasources_missing ) | .dashboard + {ds_missing: .datasources_missing[] | [.name]}' + # Display all dashboards which use a specific data source, filtered by data source name. + grafana-wtf explore dashboards --format=json | jq 'select( .[] | .datasources | .[].name=="" )' + + # Display all dashboards using data sources with a specific type. Here: InfluxDB. + grafana-wtf explore dashboards --format=json | jq 'select( .[] | .datasources | .[].type=="influxdb" )' + Find dashboards and data sources: