docker-compose部署prometheus+grafana+alertmanager
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了docker-compose部署prometheus+grafana+alertmanager,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3585字,纯文字阅读大概需要6分钟。
内容图文
cat docker-compose.yml如下
version: ‘2‘ services: # 添加 普罗米修斯服务 prometheus: # Docker Hub 镜像 image: prom/prometheus:latest # 容器名称 container_name: Myprometheus # 容器内部 hostname hostname: prometheus # 容器支持自启动 restart: always # 容器与宿主机 端口映射 ports: - ‘9090:9090‘ # 将宿主机中的config文件夹,挂载到容器中/config文件夹 volumes: - ‘./prometheus/config:/config‘ - ‘./prometheus/data/prometheus:/prometheus/data‘ # 指定容器中的配置文件 command: - ‘--config.file=/config/prometheus.yml‘ # 支持热更新 - ‘--web.enable-lifecycle‘ # 添加告警模块 alertmanager: image: prom/alertmanager:latest container_name: Myalertmanager hostname: alertmanager restart: always ports: - ‘9093:9093‘ volumes: - ‘./prometheus/config:/config‘ - ‘./prometheus/data/alertmanager:/alertmanager/data‘ command: - ‘--config.file=/config/alertmanager.yml‘ # 添加监控可视化面板 grafana: image: docker.xxxxx.com/library/grafana:v20191225 container_name: Mygrafana hostname: grafana restart: always ports: - ‘3000:3000‘ volumes: # 配置grafana 邮件服务器 - ‘./grafana/config/grafana.ini:/etc/grafana/grafana.ini‘ - ‘./grafana/data/grafana:/var/lib/grafana‘
prometheus.yml配置文件如下
# my global config 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 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 `job=<job_name>` to any timeseries scraped from this config. - job_name: ‘promethus‘ static_configs: - targets: [‘192.168.1.100:9090‘] labels: instance: ‘Monitor-Service-01‘ platform: ‘master‘ - job_name: ‘system‘ static_configs: - targets: [‘192.168.1.101:9100‘] labels: instance: ‘Monitor Service-01‘ platform: ‘worker‘ - job_name: ‘Server‘ static_configs: - targets: [‘192.168.2.100:9100‘] labels: instance: ‘Service-web01‘ platform: ‘esc01‘ - targets: [‘192.168.2.101:9101‘] labels: instance: ‘Service-db01‘ platform: ‘esc01‘ - targets: [‘192.168.2.102:9102‘] labels: instance: ‘Service-db02‘ platform: ‘esc01‘ - targets: [‘192.168.2.103:9103‘] labels: instance: ‘Service-dbpool‘ platform: ‘esc01‘
alertmanager.yml配置信息如下
global: resolve_timeout: 1m # The smarthost and SMTP sender used for mail notifications. #smtp_smarthost: ‘‘ #smtp_from: ‘‘ #smtp_auth_username: ‘‘ #smtp_auth_password: ‘‘ route: receiver: ‘default-receiver‘ # The labels by which incoming alerts are grouped together. For example, # multiple alerts coming in for cluster=A and alertname=LatencyHigh would # be batched into a single group. #group_by: [‘alertname‘] # When a new group of alerts is created by an incoming alert, wait at # least ‘group_wait‘ to send the initial notification. # This way ensures that you get multiple alerts for the same group that start # firing shortly after another are batched together on the first # notification. # group_wait: 5s # When the first notification was sent, wait ‘group_interval‘ to send a batch # of new alerts that started firing for that group. # group_interval: 30s # If an alert has successfully been sent, wait ‘repeat_interval‘ to # resend them. repeat_interval: 1m receivers: - name: ‘default-receiver‘
原文:https://www.cnblogs.com/caidingyu/p/12163019.html
内容总结
以上是互联网集市为您收集整理的docker-compose部署prometheus+grafana+alertmanager全部内容,希望文章能够帮你解决docker-compose部署prometheus+grafana+alertmanager所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。