amimof / node-cert-exporter

An SSL certificate Prometheus exporter
Apache License 2.0
174 stars 36 forks source link

--include-glob not working as expected #100

Closed the02 closed 2 weeks ago

the02 commented 2 weeks ago

Description When setting the --include-glob parameter I can see that in the processlist this gets expanded and adds all matching files as parameters. Still when checking the metrics I only see them for the first file in the list

All files are readable by the user that is running the ssl exporter

Steps to reproduce the issue:

  1. run node-cert-exporter with --include-glob ./node-cert-exporter-linux-amd64 --include-glob /path/to/something/*/path/to/cert/*.pem
  2. checking ps list with ps aux | grep cert ./node-cert-exporter-linux-amd64 --include-glob /path/to/something/first/path/to/cert/first.pem /path/to/something/second/path/to/cert/second.pem /path/to/something/third/path/to/cert/third.pem /path/to/something/fourth/path/to/cert/fourth.pem
  3. checking metrics ssl_certificate_expiry_seconds{job="sslcheck"}
    ssl_certificate_expiry_seconds{alg="SHA256-RSA", hostname="host", instance="host:9117", issuer="<masked>", job="sslcheck", path="/path/to/something/first/path/to/cert/first.pem", serial="<masked>", subject="<masked>", version="1"}  1043450

Describe the results you received: only the first file from the expanded glob is shown in the metrics

Describe the results you expected: see the relevant information for all files

Additional information:

Output of node-cert-exporter --version:

Version: v1.1.7
Commit: 02a20354f82483a54bd9005994802272818bc3ac
Branch: HEAD
GoVersion: 1.23.2

Additional environment details:

NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye

Linux host 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux
the02 commented 2 weeks ago

Even the docs do not state it, quoting the glob string solved the issue. --include-glob "/path/to/something/*/path/to/cert/*.pem"