Is there a way to list all dashbaords that use a datasource in Grafana?

Hi again,

Coming from a discussion with @chenlujjj and @jangaraj at How to find out unused datasources?, we recently added a few new features to grafana-wtf. One of them is explore dashboards, which might fit very well in this context.

To make the story short, those two command invocations, combined with jq, can aid in helping to find dashboards using specific data sources, either by name or by type.

# Display all dashboards which use a specific data source, filtered by data source name.
grafana-wtf explore dashboards --format=json | jq 'select( .[] | .datasources | .[].name=="<datasource_name>" )'

# Display all dashboards using data sources with a specific type. Here: InfluxDB.
grafana-wtf explore dashboards --format=json | jq 'select( .[] | .datasources | .[].type=="influxdb" )'

With kind regards,
Andreas.