系统相关
首页 > 系统相关> > prometheus nginx-prometheus-exporter 二进制

prometheus nginx-prometheus-exporter 二进制

作者:互联网

nginx

        location /status {
                stub_status;
                access_log off;
                allow 127.0.0.1;
                allow 192.168.1.0/24;
                deny all;
        }

启动

wget -c https://github.com/nginxinc/nginx-prometheus-exporter/releases/download/v0.10.0/nginx-prometheus-exporter_0.10.0_linux_amd64.tar.gz
mkdir -p /usr/local/nginx_prometheus_exporter
tar -xf nginx-prometheus-exporter_0.10.0_linux_amd64.tar.gz -C /usr/local/nginx_prometheus_exporter/
cd /usr/local/nginx_prometheus_exporter/

nohup  ./nginx-prometheus-exporter -nginx.scrape-uri  http://test.well.curefun.com/status &

配置
prometheus.yml 增加一段

  - job_name: "nginx_status"
    file_sd_configs:
      - files:
        - targets/nginx-*.yaml
        refresh_interval: 2m

cat targets/nginx-all.yaml

- targets:
  - 192.168.1.52:9113
  - 192.168.1.96:9113
  labels:
    app: nginx_prometheus_exporter
    job: nginx_status

注:
metric

nginx_connections_active当前客户端连接数
nginx_connections_accepted接受的客户端连接的总数
nginx_connections_handledhandled状态的连接数
nginx_connections_reading-读取客户端请求的连接数-
nginx_http_requests_total客户端请求数
nginx_connections_writing回写客户端的连接数
nginx_up是否启动
nginx_connections_waiting等待中的连接数

这里只监控,不告警,告警请见之前文档

------------------end

标签:status,exporter,连接数,connections,nginx,prometheus
来源: https://blog.csdn.net/oToyix/article/details/122343408