Hi Saurabh,
For any calculations where you compare the current state to the past state as a correctness check (where the past state represents the desired / expected state), you always have some limitations: First, it's already possible that mountpoints are missing before you even start collecting data, in which case you would never be able to notice those missing mount points. Second, Prometheus is a sliding window system, so any reference of the current to the past will "slide" over your data, and eventually your current state will become the past, whether it's in the originally desired state or not (thus you will stop noticing problems at that time / alerts will stop firing). For example, you can compare the current set of mountpoints to the set 10 minutes ago, and you can get an alert if some mountpoint went missing. But if you wait another 10 minutes, then when the alert calculation runs again, both the current and old state used for comparisons will no longer contain the now-missing mountpoints, so the alert would stop firing.
Still, given those caveats, you could write an alert expression like this:
node_filesystem_readonly offset 1h
unless
node_filesystem_readonly
This basically says "alert me if there was a filesystem 1h ago, unless it is also currently present ". But beware that this alert will auto-resolve after 1 hour, due to the sliding window effect described above. So to be somewhat more resilient, you could increase the 1h to 1d or something. But be aware that for the alert to work, you need at least 1d of history in your TSDB then, so in a fresh Prometheus, the alert will always need at least 1d to start working.
In the end, it's always better to have a proper authoritative source of truth somewhere that tells the monitoring system which mountpoints are expected (possibly, for each type of server or so), rather than relying on past/current comparisons, but this can be a workaround.
Regards,
Julius