prometheus配置相关

2022-07-21

1. Prometheus热更新配置

需要按如下启动,打开web.enable-lifecycle
nohup ./prometheus --web.enable-lifecycle --config.file=prometheus.yml &
然后每次更新配置文件,只需要发送如下命令即可
curl -X POST http://localhost:9090/-/reload

2. node_exporter启动

nohup ./node_exporter --web.listen-address :8082 &

3. grafana启动

nohup ./grafana-server web &

4. grafana nginx配置

  • nginx配置
    map $http_upgrade $connection_upgrade {
      default upgrade;
      '' close;
    }
    server {
            client_max_body_size 1000M;
            listen       80;
            server_name  grafana.roshan.wanmei.com;
      location / {
        proxy_set_header Host $http_host;
        proxy_pass http://10.3.250.53:3000;
      }
    
      # Proxy Grafana Live WebSocket connections.
      location /api/live/ {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $http_host;
        proxy_pass http://10.3.250.53:3000;
      }
    
    }
    
    
  • grafana配置文件配置
    [server]
    # Protocol (http, https, h2, socket)
    protocol = http
    # The ip address to bind to, empty will bind to all interfaces
    http_addr =
    # The http port to use
    http_port = 3000
    # The public facing domain name used to access grafana from a browser
    domain = grafana.roshan.wanmei.com
    # Redirect to correct domain if host header does not match domain
    # Prevents DNS rebinding attacks
    enforce_domain = true
    # The full public facing url
    root_url = %(protocol)s://%(domain)s:%(http_port)s/
    # Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.
    serve_from_sub_path = false
    

标题:prometheus配置相关
作者:mahaonan
地址:https://mahaonan.fun/articles/2022/07/21/1658391256220.html