Sign inSign up

sophos/nginx-vts-exporter

By sophos

•Updated almost 6 years ago

Simple server that scrapes Nginx vts stats and exports them via HTTP for Prometheus consumption

Image
8

10M+

sophos/nginx-vts-exporter repository overview

⁠nginx-vts-exporter

Build Status Docker Pulls Github All Releases GitHub release Go Report Card

Simple server that scrapes Nginx vts⁠ stats and exports them via HTTP for Prometheus consumption

To support time related histogram metrics, please refer to hnlq715/nginx-prometheus-metrics⁠ or #43⁠.

⁠Table of Contents

⁠Dependency

⁠Download

Binary can be downloaded from Releases⁠ page.

⁠Compile

⁠build binary
make
⁠build RPM package
make rpm
⁠build docker image
make docker

⁠Docker Hub Image

docker pull sophos/nginx-vts-exporter:latest

It can be used directly instead of having to build the image yourself. (Docker Hub sophos/nginx-vts-exporter⁠)

⁠Run

⁠run binary
nohup /bin/nginx-vts-exporter -nginx.scrape_uri=http://localhost/status/format/json
⁠run docker
docker run  -ti --rm --env NGINX_STATUS="http://localhost/status/format/json" sophos/nginx-vts-exporter

⁠Environment variables

This image is configurable using different env variables

Variable nameDefaultDescription
NGINX_STATUShttp://localhost/status/format/json⁠Nginx JSON format status page
METRICS_ENDPOINT/metricsMetrics endpoint exportation URI
METRICS_ADDR:9913Metrics exportation address:port
METRICS_NSnginxPrometheus metrics Namespaces

⁠Metrics

Documents about exposed Prometheus metrics.

For details on the underlying metrics please see nginx-module-vts⁠

For grafana dashboard please see nginx-vts-exporter dashboard⁠

⁠Server main

Metrics details

Nginx dataNameExposed informations
Info{NAMESPACE}_server_infohostName, nginxVersion, uptimeSec
Connections{NAMESPACE}_server_connectionsstatus [active, reading, writing, waiting, accepted, handled]

Metrics output example

# Server Info
nginx_server_info{hostName="localhost", nginxVersion="1.11.1"} 9527
# Server Connections
nginx_server_connections{status="accepted"} 70606
⁠Server zones

Metrics details

Nginx dataNameExposed informations
Requests{NAMESPACE}_server_requestscode [2xx, 3xx, 4xx, 5xx, total], host (or domain name)
Bytes{NAMESPACE}_server_bytesdirection [in, out], host (or domain name)
Cache{NAMESPACE}_server_cachestatus [bypass, expired, hit, miss, revalidated, scarce, stale, updating], host (or domain name)

Metrics output example

# Server Requests
nginx_server_requests{code="1xx",host="test.domain.com"} 0

# Server Bytes
nginx_server_bytes{direction="in",host="test.domain.com"} 21

# Server Cache
nginx_server_cache{host="test.domain.com",status="bypass"} 2
⁠Filter zones

Metrics details

Nginx dataNameExposed informations
Requests{NAMESPACE}_filter_requestscode [2xx, 3xx, 4xx, 5xx and total], filter, filter name
Bytes{NAMESPACE}_filter_bytesdirection [in, out], filter, filter name
Response time{NAMESPACE}_filter_responseMsecfilter, filter name

Metrics output example

# Filter Requests
nginx_upstream_requests{code="1xx", filter="country", filterName="BY"} 0

# Filter Bytes
nginx_upstream_bytes{direction="in", filter="country", filterName="BY"} 0

# Filter Response time
nginx_upstream_responseMsec{filter="country", filterName="BY"} 99
⁠Upstreams

Metrics details

Nginx dataNameExposed informations
Requests{NAMESPACE}_upstream_requestscode [2xx, 3xx, 4xx, 5xx and total], upstream (or upstream name)
Bytes{NAMESPACE}_upstream_bytesdirection [in, out], upstream (or upstream name)
Response time{NAMESPACE}_upstream_responseMsecbackend (or server), in_bytes, out_bytes, upstream (or upstream name)

Metrics output example

# Upstream Requests
nginx_upstream_requests{code="1xx",upstream="XXX-XXXXX-3000"} 0

# Upstream Bytes
nginx_upstream_bytes{direction="in",upstream="XXX-XXXXX-3000"} 0

# Upstream Response time
nginx_upstream_responseMsec{backend="10.2.15.10:3000",upstream="XXX-XXXXX-3000"} 99

Tag summary

Content type

Image

Digest

Size

7.1 MB

Last updated

almost 6 years ago

docker pull sophos/nginx-vts-exporter