docker部署釘釘機(jī)器人報(bào)警通知的實(shí)現(xiàn)
本文主要介紹了docker部署釘釘機(jī)器人報(bào)警通知的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
目錄結(jié)構(gòu)
[root@node1 ~]# tree prom
prom
├── docker-compose.yml #docker-compose文件
├── grafana #grafana數(shù)據(jù)掛載
├── prometheus_data #Prometheus數(shù)據(jù)掛載
├── rules #報(bào)警規(guī)則文件
│ ├── cpu_over.yml
│ ├── disk_over.yml
│ ├── memory_over.yml
│ └── node_alived.yml
└── yml
├── alertmanager.yml alertmanager配置
├── config.yml 釘釘機(jī)器人配置
└── prometheus.yml Prometheus配置[root@node1 prom]# cat docker-compose.yml
version: "3.7"
services:
node-exporter:
image: prom/node-exporter:latest
container_name: "node-exporter"
ports:
- "9100:9100"
restart: always
cadvisor:
image: google/cadvisor:latest
container_name: cadvisor
restart: always
ports:
- '8080:8080'
prometheus:
image: prom/prometheus:latest
container_name: prometheus
ports:
- "9090:9090"
restart: always
volumes:
- "./yml/prometheus.yml:/etc/prometheus/prometheus.yml"
- "./prometheus_data:/prometheus"
- "./rules:/etc/prometheus/rules"
grafana:
image: grafana/grafana
container_name: "grafana"
ports:
- "3000:3000"
restart: always
volumes:
- "./grafana:/var/lib/grafana"
alertmanager:
image: prom/alertmanager:latest
restart: "always"
ports:
- 9093:9093
container_name: "alertmanager"
volumes:
- "./yml/alertmanager.yml:/etc/alertmanager/alertmanager.yml"
webhook:
image: timonwong/prometheus-webhook-dingtalk
restart: "always"
ports:
- 8060:8060
container_name: "webhook"
volumes:
- "./yml/config.yml:/etc/prometheus-webhook-dingtalk/config.yml"
[root@node1 prom]# cat yml/prometheus.yml
# my global config
global: # 此片段指定的是prometheus的全局配置, 比如采集間隔,抓取超時(shí)時(shí)間等.
scrape_interval: 1m # 抓取間隔 默認(rèn)1m
evaluation_interval: 1m # 評(píng)估規(guī)則間隔 默認(rèn)1m
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
# 此片段指定報(bào)警配置, 這里主要是指定prometheus將報(bào)警規(guī)則推送到指定的alertmanager實(shí)例地址
alerting:
alertmanagers:
- static_configs:
- targets:
- 192.168.10.10:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
- "/etc/prometheus/rules/*.yml" #報(bào)警規(guī)則文件
# - "cpu_over.yml"
# - "disk_over.yml"
# - "memory_over.yml"
# - "node_alived.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
# 抓取配置列表
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "linux"
static_configs:
- targets: ["192.168.10.10:9100","192.168.10.10:8080","192.168.10.20:9100","192.168.10.20:8080"]
[root@node1 prom]#cat alertmanager.yml
global:
resolve_timeout: 5m #在指定時(shí)間內(nèi)沒(méi)有新的事件就發(fā)送恢復(fù)通知
route:
receiver: webhook #設(shè)置接收人
group_wait: 1m #組告警等待時(shí)間。在等待時(shí)間結(jié)束后,如果有同組告警一起發(fā)出
group_interval: 1m #兩組告警間隔時(shí)間。
repeat_interval: 1m #重復(fù)告警間隔時(shí)間,減少相同郵件的發(fā)送頻率。
group_by: [alertname] #采用那個(gè)標(biāo)簽來(lái)作為分組。
receivers: #通知接收者列表
- name: webhook
webhook_configs:
- url: http://192.168.10.10:8060/dingtalk/webhook1/send
send_resolved: true
#########################################################
[root@node1 prom]# cat yml/config.yml
targets:
webhook1:
url: https://oapi.dingtalk.com/robot/send?access_token=XXXXXX #webhook
secret: SEC000000 #加簽
[root@node1 prom]#cat alertmanager.yml
global:
resolve_timeout: 5m #在指定時(shí)間內(nèi)沒(méi)有新的事件就發(fā)送恢復(fù)通知
route:
receiver: webhook #設(shè)置接收人
group_wait: 1m #組告警等待時(shí)間。在等待時(shí)間結(jié)束后,如果有同組告警一起發(fā)出
group_interval: 1m #兩組告警間隔時(shí)間。
repeat_interval: 1m #重復(fù)告警間隔時(shí)間,減少相同郵件的發(fā)送頻率。
group_by: [alertname] #采用那個(gè)標(biāo)簽來(lái)作為分組。
receivers: #通知接收者列表
- name: webhook
webhook_configs:
- url: http://192.168.10.10:8060/dingtalk/webhook1/send
send_resolved: true
#########################################################
[root@node1 prom]# cat yml/config.yml
targets:
webhook1:
url: https://oapi.dingtalk.com/robot/send?access_token=XXXXXX #webhook
secret: SEC000000 #加簽
配置完成后docker-compose up -d 啟動(dòng)容器
http://localhost:8080 #cadvisor
http://localhost:8080/metrics #cadvisor數(shù)據(jù)
http://localhost:9100/metrics #node-exporter數(shù)據(jù)
http://localhost:9090 #prometheus
http://localhost:3000 #grafana
http://localhost:9090/alerts

實(shí)現(xiàn)效果

到此這篇關(guān)于docker部署釘釘機(jī)器人報(bào)警通知的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)docker 釘釘機(jī)器人報(bào)警內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
使用Docker compose編排Laravel應(yīng)用的方法
本篇文章主要介紹了使用Docker compose編排Laravel應(yīng)用的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-07-07
docker容器狀態(tài)的轉(zhuǎn)換實(shí)現(xiàn)
這篇文章主要介紹了docker容器狀態(tài)的轉(zhuǎn)換實(shí)現(xiàn),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-11-11
如何解決mysql配置文件錯(cuò)誤導(dǎo)致在docker中無(wú)法啟動(dòng)的問(wèn)題
這篇文章主要介紹了如何解決mysql配置文件錯(cuò)誤導(dǎo)致在docker中無(wú)法啟動(dòng)的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-01-01
Docker數(shù)據(jù)卷掛載命令volume(-v)與mount的使用總結(jié)
本文主要介紹了Docker數(shù)據(jù)卷掛載命令volume(-v)與mount的使用總結(jié),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2022-08-08
Docker學(xué)習(xí)筆記之Weave實(shí)現(xiàn)跨主機(jī)容器互聯(lián)
這篇文章主要介紹了Docker學(xué)習(xí)筆記之Weave實(shí)現(xiàn)跨主機(jī)容器互聯(lián),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-04-04
docker搭建es集群實(shí)現(xiàn)過(guò)程詳解
這篇文章主要為大家介紹了docker搭建es集群實(shí)現(xiàn)過(guò)程詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-01-01
docker?搭建?ElasticSearch過(guò)程解析
這篇文章主要介紹了docker搭建ElasticSearch的過(guò)程,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,,需要的朋友可以參考下2023-08-08
docker-compose啟動(dòng)mongo容器的使用
這篇文章主要介紹了docker-compose啟動(dòng)mongo容器的使用,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-01-01
CentOS7如何修改Docker鏡像默認(rèn)存儲(chǔ)位置
這篇文章主要介紹了CentOS7如何修改Docker鏡像默認(rèn)存儲(chǔ)位置問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-11-11

