zoukankan      html  css  js  c++  java
  • prometheus针对blackbox-exporter监控

    blackbox配置文件

    modules:
      http_2xx:
        prober: http
      http_post_2xx:
        prober: http
        http:
          method: POST
      tcp_connect:
        prober: tcp
      pop3s_banner:
        prober: tcp
        tcp:
          query_response:
          - expect: "^+OK"
          tls: true
          tls_config:
            insecure_skip_verify: false
      ssh_banner:
        prober: tcp
        tcp:
          query_response:
          - expect: "^SSH-2.0-"
      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

    blackbox-exporter

    
    

    apiVersion: v1
    kind: Service
    metadata:
    annotations:
    prometheus/scrape: "true"
    labels:
    name: blackbox-exporter
    name: blackbox-exporter
    namespace: kube-system
    spec:
    ports:
    - name: blackbox-exporter
    nodePort: 30115
    port: 9115
    protocol: TCP
    targetPort: 9115
    selector:
    app: blackbox-exporter
    sessionAffinity: ClientIP
    sessionAffinityConfig:
    clientIP:
    timeoutSeconds: 10800
    type: NodePort

    ---

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      annotations:
        deployment.kubernetes.io/revision: "21"
      generation: 1
      labels:
        app: blackbox-exporter
      name: blackbox-exporter
      namespace: kube-system 
    spec:
      progressDeadlineSeconds: 600
      replicas: 1
      revisionHistoryLimit: 2
      selector:
        matchLabels:
          app: blackbox-exporter
      strategy:
        rollingUpdate:
          maxSurge: 25%
          maxUnavailable: 25%
        type: RollingUpdate
      template:
        metadata:
          labels:
            app: blackbox-exporter
        spec:
          containers:
          - args:
            - --config.file=/config/blackbox/blackbox.yml   
            image: prom/blackbox-exporter
            imagePullPolicy: IfNotPresent
            livenessProbe:
              failureThreshold: 5
              initialDelaySeconds: 30
              periodSeconds: 60
              successThreshold: 1
              tcpSocket:
                port: 9115
              timeoutSeconds: 2
            name: blackbox-exporter
            ports:
            - containerPort: 9115
              protocol: TCP
            readinessProbe:
              failureThreshold: 3
              httpGet:
                path: /metrics
                port: 9115
                scheme: HTTP
              initialDelaySeconds: 30
              periodSeconds: 60
              successThreshold: 1
              timeoutSeconds: 10
            terminationMessagePath: /dev/termination-log
            terminationMessagePolicy: File
            volumeMounts:
            - mountPath: /config/blackbox
              name: blackbox-config
          dnsPolicy: ClusterFirst
          nodeSelector:
            com.zhonganonline.usefor: prometheus
          restartPolicy: Always
          schedulerName: default-scheduler
          terminationGracePeriodSeconds: 30
          volumes:
          - configMap:
              defaultMode: 420
              name: blackbox
            name: blackbox-config

    prometheus配置文件

    # Global config
    global:
      # How frequently to scrape targets by default.
      scrape_interval:        60s
    
      # How long until a scrape request times out.
      scrape_timeout:         20s
    
      # How frequently to evaluate rules.
      evaluation_interval:    60s
    
      # Attach these labels to any time series or alerts when communicating with
      # external systems (federaten, remote storage, Alertmanager).
      external_labels:
          monitor: '10022-test-monitor' 
    
    remote_write:
    - url: "http://localhost:8080/receive"
    
    rule_files:
      - "/etc/prometheus/platform/k8s-metrics.rules"
      - "/etc/prometheus/platform/k8s-alert.rules"
      - "/etc/prometheus/departments/*.rules"
    
    scrape_configs:
    - job_name: ecs-prometheus
      file_sd_configs:
      - files:
        - /etc/prometheus/ips/custom_sd.json
        refresh_interval: 10s
      metric_relabel_configs:
      - source_labels: [__name__]
        regex: node_cpu_seconds_total|node_disk_reads_completed_total|node_disk_writes_completed_total|node_disk_read_bytes_total|node_disk_written_bytes_total|node_filesystem_size_bytes|node_filesystem_avail_bytes|node_network_transmit_bytes_total|node_network_receive_bytes_total|up|node_netstat_Tcp_CurrEstab|node_memory_MemAvailable_bytes|node_memory_MemTotal_bytes|node_memory_MemFree_bytes
        action: keep
    
    - job_name: process-prometheus
      file_sd_configs:
      - files:
        - /etc/prometheus/ips/process_sd.json
        refresh_interval: 10s
    - job_name: 'traefik-prometheus'
      file_sd_configs:
      - files:
        - /etc/prometheus/ips/traefik_sd.json
        refresh_interval: 10s 
    
    - job_name: 'ICMP'
      metrics_path: /probe
      params:
        module: [icmp]
      file_sd_configs:
        - files:
           #- /etc/prometheus/za-warden/ips/tcp.yml
             - /etc/prometheus/ips/custom_sd.json
          refresh_interval: 10m
      relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: http://blackbox-exporter:9115 #配置blackbox的svc地址+端口
      - target_label: job
        replacement: TCP
  • 相关阅读:
    poj 2763 Housewife Wind
    hdu 3966 Aragorn's Story
    poj 1655 Balancing Act 求树的重心
    有上下界的网络流问题
    URAL 1277 Cops and Thieves 最小割 无向图点带权点连通度
    ZOJ 2532 Internship 网络流求关键边
    ZOJ 2760 How Many Shortest Path 最大流+floyd求最短路
    SGU 438 The Glorious Karlutka River =) 拆点+动态流+最大流
    怎么样仿写已知网址的网页?
    5-10 公路村村通 (30分)
  • 原文地址:https://www.cnblogs.com/gavin11/p/12845631.html
Copyright © 2011-2022 走看看