cert

Reference for the `cert` collector.

cert · collector · run nanook doc cert for the same content in your terminal.

Reads the TLS leaf certificate from a host and reports expiry signals.

Options

OptionTypeDefaultDescription
hoststringrequiredtarget hostname or IP
portstring443target port
server_namestringSNI override (defaults to host when it parses as a DNS name)
timeoutstring10sdial + handshake timeout (e.g. 5s)

Metrics

MetricKindUnitDescription
cert.handshake_okbooltrue if the TLS handshake completed. Labels: addr.
cert.days_until_expirynumericdays remaining before the leaf cert not_after. Negative once expired. Labels: addr.
cert.not_afternumericsecondsleaf cert not_after as seconds since the unix epoch. Labels: addr.
cert.not_beforenumericsecondsleaf cert not_before as seconds since the unix epoch. Labels: addr.
cert.validbooltrue when current time is within [not_before, not_after]. Labels: addr.

Examples

Watch a TLS endpoint

[[collectors]]
name = "api-cert"
kind = "cert"
interval = 3600
[collectors.opts]
host = "api.example.com"
port = 443
timeout = "10s"

Alert weeks before expiry

[[alerts]]
expr = "api-cert::cert.days_until_expiry < 14"
count = 1
channel = "ops"
escalate = { after = 86400, channel = "oncall" }

Catch handshake failures

[[alerts]]
expr = 'api-cert::cert.handshake_ok is "false"'
count = 3
channel = "ops"

SNI override

[collectors.opts]
host = "10.0.0.42"
port = 443
server_name = "api.example.com"