一、Prometheus监控Nginx
1、监控Nginx相关插件下载地址
nginx_exporter下载地址
Nginx_module-vts下载地址
nginx-release下载地址
- Prometheus(8.3.3)和grafana(2.32.1)我使用的是官网最新版
2、编译Nginx
注意:我这边是使用rpm安装的Nginx。所以要进行编译一下,可以根据自己的实际情况进行操作
2.1 下载 nginx-release 并解压
如果有这两个目录将其删除掉
rm -rf Makefile objs
2.2 解压 Nginx-module-vts,到/opt/nginx/
2.3 执行以下命令,进行编译Nginx
./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-compat --with-debug --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_m