Cloud Native 7 min read

How to Deploy Nginx‑VTS Monitoring on a Kubernetes Master Node

This guide walks through downloading, building, and configuring the nginx‑module‑vts and nginx‑vts‑exporter on a Kubernetes master, then integrates them with Prometheus, Grafana, and Alertmanager for full‑stack monitoring and alerting.

Full-Stack DevOps & Kubernetes
Full-Stack DevOps & Kubernetes
Full-Stack DevOps & Kubernetes
How to Deploy Nginx‑VTS Monitoring on a Kubernetes Master Node

This article provides a step‑by‑step tutorial for setting up a comprehensive monitoring solution for Nginx on a Kubernetes master node using the nginx‑module‑vts and nginx‑vts‑exporter.

Download and extract required packages

nginx‑module‑vts‑master.zip: https://pan.baidu.com/s/1sG9vuSknc7p7f_AryTrBhw (extraction code: jf19)

nginx‑1.15.7.tar.gz: https://pan.baidu.com/s/1PDAi7eSFJkqejb-RC0tPHg (extraction code: uhjc)

nginx‑vts‑exporter‑0.5.zip: https://pan.baidu.com/s/1jKtpyYfU01FiS3E2VuQmfQ (extraction code: jeps)

Grafana dashboard JSON (nginx‑vts‑stats_rev2.json): https://pan.baidu.com/s/1e2ANwbwebD-dYTExhk5xRQ (extraction code: 0sei)

Install Nginx with VTS module

Unzip the module package and move it to /usr/local/.

unzip nginx-module-vts-master.zip
mv nginx-module-vts-master /usr/local/

Unzip the Nginx source, extract it, and configure with the VTS module:

tar zxvf nginx-1.15.7.tar.gz
cd nginx-1.15.7
./configure --prefix=/usr/local/nginx \
    --with-http_gzip_static_module \
    --with-http_stub_status_module \
    --with-http_ssl_module \
    --with-pcre \
    --with-file-aio \
    --with-http_realip_module \
    --add-module=/usr/local/nginx-module-vts-master
make && make install

Edit /usr/local/nginx/conf/nginx.conf to add a status location:

location /status {
    vhost_traffic_status_display;
    vhost_traffic_status_display_format html;
}

http {
    vhost_traffic_status_zone;
}

Test the configuration and start Nginx:

/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx

Install and run nginx‑vts‑exporter

Unzip the exporter package and move it to /usr/local/.

unzip nginx-vts-exporter-0.5.zip
mv nginx-vts-exporter-0.5 /usr/local/

Make the binary executable:

chmod +x /usr/local/nginx-vts-exporter-0.5/bin/nginx-vts-exporter

Run the exporter in the background, pointing to the Nginx status endpoint (replace the IP with your master node’s address):

nohup ./nginx-vts-exporter -nginx.scrape_uri http://192.168.124.16/status/format/json &

Configure Prometheus

Add a new job to prometheus-cfg.yaml to scrape the exporter:

- job_name: 'nginx'
  scrape_interval: 5s
  static_configs:
    - targets: ['192.168.124.16:9913']

Apply the configuration:

kubectl apply -f prometheus-cfg.yaml
kubectl delete -f prometheus-deploy.yaml
kubectl apply -f prometheus-deploy.yaml

Import Grafana dashboard

In Grafana, import the JSON file nginx-vts-stats_rev2.json (download link above) to visualize Nginx metrics.

Notes

The IP address in the exporter command and Prometheus target must be the host where the exporter runs.

Ensure firewall rules allow port 9913 for Prometheus to scrape.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PrometheusGrafanaVTS
Full-Stack DevOps & Kubernetes
Written by

Full-Stack DevOps & Kubernetes

Focused on sharing DevOps, Kubernetes, Linux, Docker, Istio, microservices, Spring Cloud, Python, Go, databases, Nginx, Tomcat, cloud computing, and related technologies.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.