Skip to content

Instantly share code, notes, and snippets.

@gilangvperdana
Last active October 5, 2022 13:14
Show Gist options
  • Save gilangvperdana/5e901161c9a23778489e3ecd7d36fbe7 to your computer and use it in GitHub Desktop.
Save gilangvperdana/5e901161c9a23778489e3ecd7d36fbe7 to your computer and use it in GitHub Desktop.
Monitoring Certificate Expire with Prometheus & Grafana

Monitor Certificate with Nodecert Exporter

Install Node Cert Exporter

wget https://github.com/amimof/node-cert-exporter/releases/download/v1.1.2/node-cert-exporter-linux-amd64
cp node-cert-exporter-linux-amd64 /usr/local/bin/node-cert-exporter
chmod a+x /usr/local/bin/node-cert-exporter

Create systemd Node Cert Exporter

nano /etc/systemd/system/node-cert-exporter.service

---
[Unit]
Description=Node Cert Exporter

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/node-cert-exporter --path=/etc/kolla
Restart=always

[Install]
WantedBy=multi-user.target

---

systemctl enable node-cert-exporter
systemctl start node-cert-exporter

You can change --path to your certificate who you want to monitor.

Add to Prometheus.yml

nano /etc/kolla/prometheus-server/prometheus.yml
- job_name: node-cert-exporter
  static_configs:
  - targets:
    - 10.24.12.12:9117

Add Panel to Grafana

  • You can import with ID 9999
  • You can use this query to scrape it to Grafana.
sum(ssl_certificate_expiry_seconds{}) by (instance, path)

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment