Alert on difference between two values in single result

Hi, I’ve been searching for a solution to this problem for a while, and now I finally gave up and wrote this question. I’m hoping there’s someone here who could help.

I’m trying to find a way to send me an alert when the Common Name in a certificate doesn’t match the host that’s being checked.
Specifically I’m using the Prometheus blackbox https_cert module to get the results into Grafana. The results from the probe_ssl_last_chain_info metric look like this:

{__name__="probe_ssl_last_chain_info", fingerprint_sha256="longstringhere", instance="", issuer="CN=R3,O=Let's Encrypt,C=US", job="blackbox_cert", subject="", subjectalternative=""}

What I would like to have is an alert whenever the hostname in subject=“” doesn’t match the hostname in instance=“”. Is this even possible? Or will I have to resort to external methods for this?

Thanks in advance!

Technically, those are not values, but those are labels. And they are not matching at all. You may try to use some PromQL label replace (if it is available) function to remove protocol part and then use PromQL for timeseries comparison.