nginxinc/nginx-prometheus-exporter

Expose cache metrics through exporter

brianehlert opened this issue ยท 11 comments

When running NGINX as a cache server in Kubernetes or a container infrastructure I want to be able to monitor my cache configuration through Prometheus just like all my other metrics.

Extend the exporter to include /caches/ data from the NGINX Plus API

Hi @brianehlert , i would like to work on this issue. Is it necessary for me to be assigned ? I am not sure if I would be able to do it soon.

Thanks @sheharyaar we consider any contributions as folks are able.
We are happy to add your work to the project.

In this case, if you are not in a place to begin working, I would not assign. But don't let that stop you from starting and submitting a PR.

I am waiting for my NGINX Plus trial keys, will start working on this once I receive them.

Thanks! The trial should come through pretty quickly. Let me know if you have any problems with that.

It's been a week but I haven't received the keys yet. I tried contacting the team at evaluations@nginx.com but I received not response.

Thank you.
You can probably use demo.nginx.com to get started.
Let me see if anything is obvious from our side.

Thanks, I will use the demo website for now.

Hey @brianehlert , which of the following metrics should I use :

{
    "http_cache": {
        "size": 24371200,
        "max_size": 536870912,
        "cold": false,
        "hit": {
            "responses": 2332023,
            "bytes": 301085821488
        },
        "stale": {
            "responses": 0,
            "bytes": 0
        },
        "updating": {
            "responses": 0,
            "bytes": 0
        },
        "revalidated": {
            "responses": 0,
            "bytes": 0
        },
        "miss": {
            "responses": 1740,
            "bytes": 213781632,
            "responses_written": 1715,
            "bytes_written": 213781632
        },
        "expired": {
            "responses": 5626,
            "bytes": 698524200,
            "responses_written": 5625,
            "bytes_written": 698524200
        },
        "bypass": {
            "responses": 0,
            "bytes": 0,
            "responses_written": 0,
            "bytes_written": 0
        }
    }
}

https://demo.nginx.com/api/5/http/caches
[target]/api/[one of many versions]/http/caches

"http_cache" in this example is the name of a zone. there could be a second that is "foo_cache" and so forth. This is configuration driven.
Everything under that are the metrics available.

https://demo.nginx.com/#caches
https://demo.nginx.com/#shared_zones

https://docs.nginx.com/nginx/admin-guide/monitoring/live-activity-monitoring/

Hi, I am ready with an iteration of the PR. I will test and create a PR soon.

@brianehlert please review the PR. Thanks !