Giter Site home page Giter Site logo

sysulq / nginx-vts-exporter Goto Github PK

View Code? Open in Web Editor NEW
627.0 28.0 139.0 18.67 MB

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

Home Page: https://hnlq715.github.io/nginx-vts-exporter/

License: MIT License

Go 85.42% Shell 12.94% Dockerfile 1.64%
vts nginx-vts-exporter nginx prometheus-exporter prometheus go

nginx-vts-exporter's Introduction

nginx-vts-exporter

Go Docker Pulls Github All Releases GitHub release Go Report Card

nginx-vts-exporter is powered by Kod, which is a dependency injection framework for Go.
It is designed to be simple and easy to use, and to provide a consistent way to manage dependencies across your application.

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

To support time related histogram metrics, please refer to sysulq/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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.