使用Docker部署Prometheus和Blackbox和Grafana和ImageRender

小破站老大 2022-09-21 PM 1021℃ 0条
#prometheus
docker run --name=prometheus -d -p 9090:9090 -v /etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus

#blackbox
docker run --rm -d -p 9115:9115 --name blackbox -v /etc/timezone:/etc/timezone:ro -v /etc/localtime:/etc/localtime:ro  -v /etc/blackbox:/config prom/blackbox-exporter:master --config.file=/config/blackbox.yml --log.level=debug

#grafana
docker run  -d --name grafana -p 3000:3000   -v /data/grafana:/var/lib/grafana  grafana/grafana:8.2.1

#grafana-render
docker run -d --name=grafana-image-renderer -p 8088:8088 --env GF_RENDERER_PLUGIN_TZ=Asia/Shanghai --env GF_RENDERER_PLUGIN_IGNORE_HTTPS_ERRORS=true grafana/grafana-image-renderer

#prometheus
# my global config
global:
  scrape_interval:     5s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 5s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label  to any timeseries scraped from this config.
  - job_name: 'prometheus'
    static_configs:
      - targets: 
        - 1.1.1.1:9100
  - job_name: 'HTTPPUB'
    metrics_path: /probe
    params:
      module: [http_2xx]
    static_configs:
      - targets:
        - https://www.valarx.com
        - https://www.eagleyao.com
        - https://www.ayao.ltd
        - https://www.yeyihan.top
        - https://www.eebbk.top
        - https://www.xiaco.cn
        - https://shi7zuku.live
        - https://www.izoyoi.ink
        - https://www.tencentcloud.love
        - https://www.pixiv.work
        - https://www.googles.ltd
        - https://www.eebbk.com.cn
        - https://www.domaincdn.com.cn
        - https://ap-guangzhou.cos.eagleyao.com
        - https://www.yunpan.host
        - https://www.rehiy.com
        - https://www.github.com
        - https://blog.laoda.de
        - https://www.lomcia.cn
        - https://www.vkxx.com
        - https://www.sccens.net
        - https://www.czmz.top
        - https://www.smalljun.com
        - https://www.52ghs.cn
        - https://www.lspss.com
        - https://github.awk.im
        - https://awk.im
        - https://6b78f738-cdn-share-example1-cdn2.tencentcloud.i0i0.cn
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 10.0.20.4:9115

#blackbox
modules:
  http_2xx:
    prober: http
    timeout: 5s
    http:
      preferred_ip_protocol: ip4
      method: GET
  http_post_2xx:
    prober: http
    http:
      method: GET
      preferred_ip_protocol: ip4
      ip_protocol_fallback: false
  tcp_connect:
    prober: tcp
  pop3s_banner:
    prober: tcp
    tcp:
      query_response:
        - expect: "^+OK"
      tls: true
      tls_config:
        insecure_skip_verify: false
  grpc:
    prober: grpc
    grpc:
      tls: true
      preferred_ip_protocol: "ip4"
  grpc_plain:
    prober: grpc
    grpc:
      tls: false
      service: "service1"
  ssh_banner:
    prober: tcp
    tcp:
      query_response:
        - expect: "^SSH-2.0-"
        - send: "SSH-2.0-blackbox-ssh-check"
  irc_banner:
    prober: tcp
    tcp:
      query_response:
        - send: "NICK prober"
        - send: "USER prober prober prober :prober"
        - expect: "PING :([^ ]+)"
          send: "PONG ${1}"
        - expect: "^:[^ ]+ 001"
  icmp:
    prober: icmp
  icmp_ttl5:
    prober: icmp
    timeout: 5s
    icmp:
      ttl: 5
标签: none

非特殊说明,本博所有文章均为博主原创。

评论啦~