参考自: https://blog.51cto.com/xujpxm/2080146 https://github.com/hnlq715/nginx-vts-exporter#environment-variables
下载解压
wget https://github.com/vozlt/nginx-module-vts/archive/v0.1.18.tar.gz # nginx -V将之前的编译参数完整复制一份,加上vts模块 重新编译 nginx-1.16.0
./configure \ --user=nginx --group=nginx --with-debug \ --prefix=/usr/local/nginx \ --sbin-path=/usr/local/sbin/nginx \ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --pid-path=/var/run/nginx/nginx.pid \ --lock-path=/var/lock/nginx.lock \ --with-stream --with-http_sub_module \ --with-http_realip_module \ --with-http_stub_status_module \ --with-http_gzip_static_module \ --with-http_mp4_module \ --with-pcre --with-http_ssl_module \ --with-stream_ssl_module \ --add-module=../nginx-module-vts-0.1.18启动Nginx,检查结果
curl http://localhost/status/format/json浏览器打开 http://x.x.x.x:9913/metrics
grafana dashboard模板参考 https://grafana.com/grafana/dashboards?search=Nginx
