Skip to content

Instantly share code, notes, and snippets.

@benjvi
Created January 26, 2022 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjvi/73b1556b4749be2a4e19fb83de890653 to your computer and use it in GitHub Desktop.
Save benjvi/73b1556b4749be2a4e19fb83de890653 to your computer and use it in GitHub Desktop.
Sample Alert For Expiring Cert Manager Certificates
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: ingress-certificate-expiry
namespace: monitoring
labels:
prometheus: k8s
role: alert-rules
spec:
groups:
- name: IngressCertificateExpiry
rules:
- alert: CertificateMissedExpectedRotation28Days
annotations:
message: Certificate for {{ $labels.instance }} will expire in less than 28 days, has not been rotated as expected.
expr: |-
(probe_ssl_earliest_cert_expiry - time()) < ( 86400 * 28 )
for: 15m
labels:
severity: warning
- alert: CertificateMissedExpectedRotation24Hours
annotations:
message: Certificate for {{ $labels.instance }} will expire in less than 24 hours, has not been rotated as expected.
expr: |-
(probe_ssl_earliest_cert_expiry - time()) > ( 3600 * 24 )
for: 15m
labels:
severity: critical
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment