So I made a custom metric with the textfile collector from the node exporter, which checks the size of a database and if that database backup for the current day is not found, it returns Nan as a value. So my metric looks something like this.
custom_cronjob_db_size {database="prod"} Nan
Now I'm trying to alert on that if the value is Nan. To test my expression I went to the Prometheus webinterface and tried this:
custom_cronjob_db_size == Nan
Which does not work, even though the value of custom_cronjob_database_backup_size shows Nan in the webinterface.
How can I alert on this?
NaN is a special floating point value, a 0/1 Boolean meric would be simpler. However you can do custom_cronjob_db_size != custom_cronjob_db_size
to detect it.