• Stars
    star
    638
  • Rank 70,537 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 8 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

ANN

It's hard to say that this project is not maintained any longer, and it is recommended to use nginx-vtx-module instead, which supports multiple vhost_traffic_status_display_format, like <json|html|jsonp|prometheus>.

Hope you guys enjoy it, and thanks for all the contributors and the issue finders. πŸ˜ƒ

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 name Default Description
NGINX_STATUS http://localhost/status/format/json Nginx JSON format status page
METRICS_ENDPOINT /metrics Metrics endpoint exportation URI
METRICS_ADDR :9913 Metrics exportation address:port
METRICS_NS nginx Prometheus 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 data Name Exposed informations
Info {NAMESPACE}_server_info hostName, nginxVersion, uptimeSec
Connections {NAMESPACE}_server_connections status [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 data Name Exposed informations
Requests {NAMESPACE}_server_requests code [2xx, 3xx, 4xx, 5xx, total], host (or domain name)
Bytes {NAMESPACE}_server_bytes direction [in, out], host (or domain name)
Cache {NAMESPACE}_server_cache status [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 data Name Exposed informations
Requests {NAMESPACE}_filter_requests code [2xx, 3xx, 4xx, 5xx and total], filter, filter name
Bytes {NAMESPACE}_filter_bytes direction [in, out], filter, filter name
Response time {NAMESPACE}_filter_responseMsec filter, 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 data Name Exposed informations
Requests {NAMESPACE}_upstream_requests code [2xx, 3xx, 4xx, 5xx and total], upstream (or upstream name)
Bytes {NAMESPACE}_upstream_bytes direction [in, out], upstream (or upstream name)
Response time {NAMESPACE}_upstream_responseMsec backend (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

More Repositories

1

httpmq

A simple HTTP message queue written in Go with goleveldb, just like httpsqs written in C with Tokyo Cabinet.
Go
308
star
2

doggy

Lightweight, idiomatic and stable for building Go 1.7+ HTTP services
Go
283
star
3

gofluent

(Not Maintained) Something acting like fluentd rewritten in Go.
Go
180
star
4

nginx-prometheus-metrics

A production demo to collect prometheus metrics for nginx with lua embedded.
Lua
95
star
5

gobreak

Latency and fault tolerance library like Netflix's Hystrix with prometheus and gobreaker.
Go
44
star
6

go-loadbalance

A well designed loadbalance API with dozens of implementations for go-grpc loadbalance.
Go
38
star
7

goroutine-pool

A simple goroutine pool which can create and release goroutine dynamically, inspired by fasthttp.
Go
32
star
8

nginx_upstream_check_module

(Not maintained) This module can be used in pure nginx-1.4.7 and nginx-1.6.2 to check upstream servers, with several patches applied.
C
17
star
9

status-nginx-module

A http status module for pure nginx, which is in production already.
C
14
star
10

graphql-grpc-gateway

Go
10
star
11

zrpc

A lightweight distributed RPC framework powered by pure C language and based on ZeroMQ and pbc.
C
9
star
12

struct2interface

Development helper program that generates a Golang interface by inspecting the structure methods of an existing .go file.
Go
7
star
13

rsa

RAS crypto algorithm for Decrypt with Public Key and Encrypt with Private Key.
Go
6
star
14

httpmq-rs

A simple HTTP message queue written in Rust with rocksdb, just like httpmq written in Go with leveldb.
Rust
3
star
15

lua-resty-fluent

A simple fluent client based on openresty.
Lua
3
star
16

practice-to-intergrate-k8s

A practice to integrate golang, microservice and so on... with k8s
Go
2
star
17

data_struct

Common data structures
C
1
star
18

srt2fcpxml

Go
1
star
19

architecture-best-practice

Best practice from the ground up.
1
star
20

github-trending

A toy to play with weixin mp and github.
Go
1
star
21

proto

Simplify developing HTTP API through Protobuf way.
Go
1
star
22

High-Performance-Browser-Networking-cn

δΈ­ζ–‡ηΏ»θ―‘
1
star
23

awesome-nginx

A collection of awsome resources around nginx.
1
star
24

ratelimitx

A simple ratelimit for golang, implemented with memcache and gobreak, aims on high availability.
Go
1
star
25

enhanced-limit-conn-nginx-module

An enhanced limit conn nginx module.
C
1
star
26

jumpcutter

An auto jump cutter, implemented with opencv and silence detect.
Python
1
star