prometheus配置nginx监控
mousemin 2021/9/29 promethenusnginx
由于没有能力自己写,去github (opens new window)找到两个方案
# nginx-module-vts方案
# 安装
编译nginx
将nginx-module-vts
模块编译进去
./configure --add-module=nginx-module-vts && make && make install
1
# 配置
nginx.conf
添加 vhost_traffic_status_zone
示例如下
http {
vhost_traffic_status_zone;
...
server {
...
/metrics {
vhost_traffic_status_display;
vhost_traffic_status_display_format prometheus;
}
}
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
更多使用方式, 请参考帮助文档 (opens new window)
访问 http://xxxxx:xxx/metrics
示例
# nginx-lua-prometheus方案
由于使用的是 nginx-1.16
, lua-nginx-module (opens new window)没有明确支持 nginx-1.16
,暂未使用