天天看点

prometheus 监控nginx

nginx 编译

需要配置状态模块

location /status {
         vhost_traffic_status_display;
         vhost_traffic_status_display_format html;
     }
           
prometheus 监控nginx

浏览器访问

prometheus 监控nginx
prometheus 监控nginx

拉取镜像

docker pull sophos/nginx-vts-exporter:latest
#运行
docker run  -d --rm -p9913:9913 --env NGINX_STATUS="http://10.98.2.60:8081/status/format/json" sophos/nginx-vts-exporter:latest
           

访问得到

prometheus 监控nginx

到prometheus服务器端 vim prometheus.yml

- job_name: 'nginx'
    static_configs:
    - targets: ['10.98.2.60:9913']
      labels:
        instance: nginx
           
prometheus 监控nginx

继续阅读