Get the App
SLTechnology News&Howtos  ›  Development  › 

How to deploy a grafana+prometheus configuration using docker

Shulou Source: shulou.com Published: 2022-06-02 05:39:51 10月04日 Update

This article mainly shows you "how to use docker to deploy grafana+prometheus configuration", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to use docker to deploy grafana+prometheus configuration" this article.

Docker-compose-monitor.yml

Version: '2'networks: monitor: driver: bridgeservices: influxdb: image: influxdb:latest container_name: tig-influxdb ports:-"18083 env.influxdb' volumes # sudo mkdir-p. / influxdb/data -. / influxdb/data:/var / lib/influxdb # configure the time in docker as East eighth Zone time -. / timezone:/etc/timezone:ro -. / localtime:/etc/localtime:ro restart: unless-stopped # automatically telegraf: image: telegraf:latest container_name: tig-telegraf links:-influxdb volumes: -. / telegraf.conf:/etc/telegraf/telegraf.conf:ro-after stopping. / timezone:/etc/timezone:ro -. / localtime:/etc/localtime:ro restart: unless-stopped prometheus: image: prom/prometheus container_name: prometheus hostname: prometheus restart: always volumes:-/ home/qa/docker/grafana/prometheus.yml:/etc/prometheus/prometheus.yml-/ home/qa/docker/grafana/node_down.yml:/etc/prometheus/node_down.yml ports:- Networks:-monitor alertmanager: image: prom/alertmanager container_name: alertmanager hostname: alertmanager restart: always volumes:-/ home/qa/docker/grafana/alertmanager.yml:/etc/alertmanager/alertmanager.yml ports:-'9093 image 9093' networks:-monitor grafana: image: grafana/grafana:6.7.4 container_name: grafana hostname: grafana restart: always ports: -'13000 image 3000' networks:-monitor node-exporter: image: quay.io/prometheus/node-exporter container_name: node-exporter hostname: node-exporter restart: always ports: -' 9100V 9100' networks:-monitor cadvisor: image: google/cadvisor:latest container_name: cadvisor hostname: cadvisor restart: always volumes:-/: / rootfs:ro- / var/run:/var/run:rw-/ sys:/sys:ro-/ var/lib/docker/:/var/lib/docker:ro ports:-'18080 networks:-monitor

Alertmanager.yml

Global: resolve_timeout: 5m smtp_from: 'mailbox' smtp_smarthost: 'smtp.exmail.qq.com:25' smtp_auth_username:' mailbox 'smtp_auth_password:' password 'smtp_require_tls: false smtp_hello:' qq.com'route: group_by: ['alertname'] group_wait: 5s group_interval: 5s repeat_interval: 5m receiver:' email'receivers:- name: 'email' Email_configs:-to: 'inbox' send_resolved: trueinhibit_rules:-source_match: severity: 'critical' target_match: severity:' warning' equal: ['alertname' 'dev',' instance']

Prometheus.yml

Global: scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. Evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. # scrape_timeout is set to the global default (10s). # Alertmanager configurationalerting: alertmanagers:-static_configs:-targets: ['192.168.32.117targets'] #-alertmanager:9093# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.rule_files:-"node_down.yml" #-"node-exporter-alert-rules.yml" #-"first_rules.yml" #- "second_rules.yml" # A scrape configuration containing exactly one endpoint to scrape:# Here it's Prometheus itself.scrape_configs: # IO Storage Node Group-job_name: 'io' scrape_interval: 8s static_configs: # Port is the port initiated by node-exporter-targets: [' 192.168.32.117IO 9100']-targets: ['192.168.32.196IO 9100'] -targets: ['192.168.32.136 targets 9100']-targets: [' 192.168.32.19191RV 9100']-targets: ['192.168.32.153Rose 9100']-targets: [' 192.168.32.185purr 9100']-targets: ['192.168.32.190l019100']-targets: [' 192.168.32.192 targets'] The job name is added as a label `job= `to any timeseries scraped from this config. -job_name: 'cadvisor' static_configs: # Port is the port initiated by cadvisor-targets: [' 192.168.32.117purl 18080']-targets: ['192.168.32.193pur8080']-targets: [' 192.168.32.153pur8080']-targets: ['192.168.32.185pur8080']-targets: [' 192 .168.32.190: 18080']-targets: ['192.168.32.192 purl 18080']

Node_down.yml

Groups:-name: node_down rules:-alert: InstanceDown expr: up = = 0 for: 1m labels: user: test annotations: summary: 'Instance {{$labels.instance}} down' description:' {{$labels.instance}} of job {{$labels.job}} has been down for more than 1 minutes.' # remaining memory is less than 10% -alert: the remaining memory is less than 10% expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes * 100

< 10 for: 2m labels: severity: warning annotations: summary: Host out of memory (instance {{ $labels.instance }}) description: "Node memory is filling up (< 10% left)\n VALUE = {{ $value }}\n LABELS = {{ $labels }}" #剩余磁盘小于10% - alert: 剩余磁盘小于10% expr: (node_filesystem_avail_bytes * 100) / node_filesystem_size_bytes < 10 and ON (instance, device, mountpoint) node_filesystem_readonly == 0 for: 2m labels: severity: warning annotations: summary: Host out of disk space (instance {{ $labels.instance }}) description: "Disk is almost full (< 10% left)\n VALUE = {{ $value }}\n LABELS = {{ $labels }}" #cpu负载 >

80-alert: CPU load > 80% expr: 100-(avg by (instance) (rate (node_cpu_seconds_total {mode= "idle"} [2m])) * 100) > 80 for: 0m labels: severity: warning annotations: summary: Host high CPU load (instance {{$labels.instance}}) description: "CPU load is > 80%\ n VALUE = {{$value}}\ nLABELS = {{$labels}} "above is all the content of the article" how to deploy a grafana+prometheus configuration using docker " Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Configuration port remaining content article mailbox memory time disk learning help password easy to understand more organization knowledge ribbon node industry information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Microsoft OPPO Reno Apple Shulou Tech Info