Add metrics from NGINX Plus API version 9 by haywoodsh · Pull Request #530 · nginx/nginx-prometheus-exporter (original) (raw)

˜### Proposed changes

Add metrics for NGINX worker data, connection accepted, dropped, current active, current idle, http request total and current.

Example NGINX Plus API response /workers/

[
    {
        "id": 0,
        "pid": 970577,
        "connections": {
            "accepted": 12364048,
            "dropped": 0,
            "active": 1,
            "idle": 80
        },
        "http": {
            "requests": {
                "total": 21726744,
                "current": 0
            }
        }
    },
    {
        "id": 1,
        "pid": 970578,
        "connections": {
            "accepted": 13538199,
            "dropped": 0,
            "active": 2,
            "idle": 66
        },
        "http": {
            "requests": {
                "total": 22635133,
                "current": 1
            }
        }
    }
]

Prometheus metrics for workers

# HELP nginxplus_worker_connection_accepted The total number of accepted client connections
# TYPE nginxplus_worker_connection_accepted counter
nginxplus_worker_connection_accepted{id="0",pid="970577"} 1.2363957e+07
nginxplus_worker_connection_accepted{id="1",pid="970578"} 1.3538027e+07
# HELP nginxplus_worker_connection_active The current number of active client connections
# TYPE nginxplus_worker_connection_active gauge
nginxplus_worker_connection_active{id="0",pid="970577"} 2
nginxplus_worker_connection_active{id="1",pid="970578"} 1
# HELP nginxplus_worker_connection_dropped The total number of dropped client connections
# TYPE nginxplus_worker_connection_dropped counter
nginxplus_worker_connection_dropped{id="0",pid="970577"} 0
nginxplus_worker_connection_dropped{id="1",pid="970578"} 0
# HELP nginxplus_worker_connection_idle The current number of idle client connections
# TYPE nginxplus_worker_connection_idle gauge
nginxplus_worker_connection_idle{id="0",pid="970577"} 77
nginxplus_worker_connection_idle{id="1",pid="970578"} 63
# HELP nginxplus_worker_http_requests_current The current number of client requests that are currently being processed by the worker process
# TYPE nginxplus_worker_http_requests_current gauge
nginxplus_worker_http_requests_current{id="0",pid="970577"} 1
nginxplus_worker_http_requests_current{id="1",pid="970578"} 0
# HELP nginxplus_worker_http_requests_total The total number of client requests received by the worker process
# TYPE nginxplus_worker_http_requests_total counter
nginxplus_worker_http_requests_total{id="0",pid="970577"} 2.1726533e+07
nginxplus_worker_http_requests_total{id="1",pid="970578"} 2.2634942e+07

Checklist

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