Check the availability of Prometheus datasource in Scripted dashboard

I would like to set up a scripted dashboard to monitor a number of VMs. The VM could be up and down,

In my script, can I check the availability of the exporter, and skip to generate the panel, if the the exporter is unavailable?

Hi,

Maybe you can use https://prometheus.io/docs/prometheus/latest/querying/api/#targets.

However, I would suggest you to use template variables in Grafana instead. Then you can quite easily filter out the hosts that are UP and possibly use repeating panels/row or only query hosts that are UP without using scripting. Please note that I think you’re referring to the grafana feature called scripted dashboards - a feature that haven’t got any love for quite a while and may be replaced with something else in the future.

If you’re talking about building dashboards programmatically then there are different solutions/tools out there that may help you.

Good luck

Marcus