Skip to content

Introduce metric representing N+ license expiration date #1102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

defanator
Copy link
Member

Proposed changes

This PR adds N+ specific metric indicating license expiration date. Primary purpose of this one is to be used in associated alerting, as N+ API is the lowest possible source of truth in regard to license validity period.

The semantic is borrowed from similar cert-manager metrics which are widely used in lots of environments.

Example output in Prometheus format:

[2025-07-18 12:22:27 MDT] a.belov@F67QQWKXLK sbin % curl -fs http://localhost:9113/metrics | grep -- license
# HELP nginxplus_license_expiration_timestamp_seconds License expiration date (expressed as Unix Epoch Time)
# TYPE nginxplus_license_expiration_timestamp_seconds gauge
nginxplus_license_expiration_timestamp_seconds 1.767744e+09

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING guide
  • I have proven my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have ensured the README is up to date
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch on my own fork

@defanator defanator requested a review from a team as a code owner July 18, 2025 18:28
Copy link

nginx-bot bot commented Jul 18, 2025

Hi @defanator! Welcome to the project! 🎉

Thanks for opening this pull request!
Be sure to check out our Contributing Guidelines while you wait for someone on the team to review this.

@nginx-bot nginx-bot bot added the community Issues or PRs opened by an external contributor label Jul 18, 2025
@defanator
Copy link
Member Author

@mpstefan @pdabelf5 @javorszky appreciate extra eyes on this one gentlemen, it would be great if it could land into next release of exporter itself + hopefully included into one of the next NIC releases. We have a few ongoing and upcoming tasks where we do consider lack of proposed metric as a blocker. TIA!

@@ -283,6 +283,7 @@ func NewNginxPlusCollector(nginxClient *plusclient.NginxClient, namespace string
"ssl_handshakes": newGlobalMetric(namespace, "ssl_handshakes", "Successful SSL handshakes", constLabels),
"ssl_handshakes_failed": newGlobalMetric(namespace, "ssl_handshakes_failed", "Failed SSL handshakes", constLabels),
"ssl_session_reuses": newGlobalMetric(namespace, "ssl_session_reuses", "Session reuses during SSL handshake", constLabels),
"license_active_till": newGlobalMetric(namespace, "license_expiration_timestamp_seconds", "License expiration date (expressed as Unix Epoch Time)", constLabels),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would the license grace period be useful here too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Issues or PRs opened by an external contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants