joe-elliott / cert-exporter

A Prometheus exporter that publishes cert expirations on disk and in Kubernetes secrets
Apache License 2.0
316 stars 87 forks source link

Formulate looks wrong #90

Closed rajivml closed 2 years ago

rajivml commented 3 years ago

HI,

The formulae to calculate cert expiration count seems wrong, it should looks like this instead,

Right now if the first expression for example the below one returns empty , then even if second or 3rd expression returns value greater than 0 , it's not getting taken into account as undefined + anything + anything is undefined

count(15724800 < cert_exporter_cert_expires_in_seconds and cert_exporter_cert_expires_in_seconds <= 31536000)

 (count(15724800 < cert_exporter_cert_expires_in_seconds and cert_exporter_cert_expires_in_seconds <= 31536000) OR on() vector(0) ) 
+(count(15724800 < cert_exporter_kubeconfig_expires_in_seconds and cert_exporter_kubeconfig_expires_in_seconds <= 31536000) OR on() vector(0) )
+(count(15724800 < cert_exporter_secret_expires_in_seconds and cert_exporter_secret_expires_in_seconds <= 31536000) OR on() vector(0))
joe-elliott commented 3 years ago

Sure, if you have tested this change and would like to submit a PR I would take it.

joe-elliott commented 2 years ago

Fixed by #91