I have a dashboard with a repeated panel, this panel is a single value panel that shows the time till expiration of SSL certificates using the probe_ssl_earliest_cert_expiry
metric from Blackbox Exporter.
probe_ssl_earliest_cert_expiry{instance=~"$instance"} - time()
It works, but the panels aren't ascending, neither descending. What I'd like is these panels to be ordered ascending so that SSL certificates that are earliest to expire are listed first.
I tried using sort_desc(-(probe_ssl_earliest_cert_expiry{instance=~"$instance"} - time()))
to get this to work but it didn't, the panels were still unsorted.
Update
I realised that Grafana sorts the repeating panels by the order that the $instance
template variable is in that the panel is repeated by.
I used the probe_success
metric for this template variable but I now use the probe_ssl_earliest_cert_expiry
metric for this as well.
I feel like I'm a step closer, but using numerical sorting on this template variable doesn't seem to properly order based on the metric value.
Is there a way to do this in Grafana or are panels ordered based on something completely different?