Skip to content

Commit 6cde67f

Browse files
committed
Fix wrong jq commands in documentation
1 parent 51794ef commit 6cde67f

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ in progress
77
===========
88

99
- Use 60 minutes as default cache TTL
10+
- Fix wrong ``jq`` commands in documentation. Thanks, @rahulnandan.
1011

1112
2023-10-03 0.16.0
1213
=================

README.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,16 @@ How to find dashboards which use non-existing data sources?
192192

193193
# Display only dashboards which have missing data sources, along with their names.
194194
grafana-wtf explore dashboards --format=json | \
195-
jq '.[] | select( .datasources_missing ) | .dashboard + {ds_missing: .datasources_missing[] | [.name]}'
195+
jq '.[] | select(.datasources_missing) | .dashboard + {ds_missing: .datasources_missing[] | [.name]}'
196+
197+
How to find dashboards using specific data sources?
198+
::
199+
200+
# Display all dashboards which use a specific data source, filtered by data source name.
201+
grafana-wtf explore dashboards --format=json | jq '.[] | select(.datasources | .[].type=="<datasource_name>")'
202+
203+
# Display all dashboards using data sources with a specific type. Here: InfluxDB.
204+
grafana-wtf explore dashboards --format=json | jq '.[] | select(.datasources | .[].type=="influxdb")'
196205

197206
How to list all queries used in all dashboards?
198207
::

grafana_wtf/commands.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ def run():
8989
grafana-wtf explore dashboards --format=yaml
9090
9191
# Display only dashboards which have missing data sources, along with their names.
92-
grafana-wtf explore dashboards --format=json | jq '.[] | select( .datasources_missing ) | .dashboard + {ds_missing: .datasources_missing[] | [.name]}'
92+
grafana-wtf explore dashboards --format=json | jq '.[] | select(.datasources_missing) | .dashboard + {ds_missing: .datasources_missing[] | [.name]}'
9393
9494
# Display all dashboards which use a specific data source, filtered by data source name.
95-
grafana-wtf explore dashboards --format=json | jq 'select( .[] | .datasources | .[].name=="<datasource_name>" )'
95+
grafana-wtf explore dashboards --format=json | jq '.[] | select(.datasources | .[].type=="<datasource_name>")'
9696
9797
# Display all dashboards using data sources with a specific type. Here: InfluxDB.
98-
grafana-wtf explore dashboards --format=json | jq 'select( .[] | .datasources | .[].type=="influxdb" )'
98+
grafana-wtf explore dashboards --format=json | jq '.[] | select(.datasources | .[].type=="influxdb")'
9999
100100
# Display dashboards and many more details about where data source queries are happening.
101101
# Specifically, within "panels/targets", "annotations", and "templating" slots.

0 commit comments

Comments
 (0)