将 https://github.com/vozlt/nginx-module-vts 模块编译进 nginx
然后在 nginx 配置文件添加如下配置:
http {
vhost_traffic_status_zone;
... ...
server {
listen 9109;
# 只允许 prometheus 服务器访问
allow 192.168.137.200;
location /status/format/prometheus {
vhost_traffic_status_display;
vhost_traffic_status_display_format prometheus;
}
}
}
重启 nginx 即可