安装Nginx及stub_status模块
参考历史文章:www.cnblogs.com/jruing/p/17…
安装Nginx-exporter
# 下载
wget https://github.com/nginxinc/nginx-prometheus-exporter/releases/download/v0.11.0/nginx-prometheus-exporter_0.11.0_linux_amd64.tar.gz
# 解压
tar -zxvf nginx-prometheus-exporter_0.11.0_linux_amd64.tar.gz
# 启动
cd nginx-prometheus-exporter
./nginx-prometheus-exporter -nginx.scrape-uri=http://192.168.137.10:80/stub_status //这里需要改成自己的地址
修改Prometheus配置文件
scrape_configs:
- job_name: 'nginx'
scrape_interval: 10s
static_configs:
- targets: ['192.168.137.10:9113']
Nginx-exporter预览地址
http://192.168.137.10:9113/
Prometheus展示页面
http://192.168.137.10:9090/targets?search=