当前位置: 首页 > news >正文

南昌集团网站建设网页在线代理翻墙

南昌集团网站建设,网页在线代理翻墙,网站建设消费者群体分析,wordpress付费客服在哪里一、前言 要实现Prometheus的告警发送需要通过alertmanager组件,当prometheus触发告警策略时,会将告警信息发送给alertmanager,然后alertmanager根据配置的策略发送到邮件或者钉钉中,发送到钉钉需要安装额外的prometheus-webhook…

一、前言

要实现Prometheus的告警发送需要通过alertmanager组件,当prometheus触发告警策略时,会将告警信息发送给alertmanager,然后alertmanager根据配置的策略发送到邮件或者钉钉中,发送到钉钉需要安装额外的prometheus-webhook-dingtalk组件,用于发送告警信息到钉钉中,如果是用邮件的话直接在alertmanager配置即可,不用安装额外组件

二、部署

这里就主要讲解发送告警信息到钉钉中的配置

2.1部署alertmanager

下载altermanager安装包,我这边下载的是0.25.0版本

下载路径:Releases · prometheus/alertmanager · GitHub

 mkdir /opt/alertmanager && cd /opt/alertmanager

tar -zxvf alertmanager-0.25.0.linux-amd64.tar.gz

mv alertmanager-0.25.0.linux-amd64 alertmanager

cd alertmanager && ls

配置系统管理启动alertmanager服务

vi /usr/lib/systemd/system/alertmanager.serivce

[Unit]
Description=alertmanager
After=network.target[Service]
ExecStart=/opt/alertmanager/alertmanager/alertmanager --config.file=/opt/alertmanager/alertmanager/alertmanager.yml  #配置启动服务命令,指定配置文件
User=root[Install]
WantedBy=multi-user.target

2.2部署prometheus-webhook-dingtalk

在部署前先配置好钉钉机器人,启用加签功能,复制webhook地址和加签密钥

下载prometheus-webhook-dingtalk安装包,我这边下载的是2.1.0版本

 下载路径:Releases · timonwong/prometheus-webhook-dingtalk · GitHub

mkdir /opt/dingtalk && cd /opt/dingtalk

tar -zxvf prometheus-webhook-dingtalk-2.1.0.linux-amd64.tar.gz

mv prometheus-webhook-dingtalk-2.1.0.linux-amd64 dingtalk

cd dingtalk && ls

复制重命名配置文件

cp  config.example.yml config.yml

编辑配置文件

vi config.yml

templates:- /opt/dingtalk/dingtalk/template.tmpl     #配置告警信息模板targets:webhook1:url: https://oapi.dingtalk.com/robot/send?access_token=cfe1e0d1cfb457a31b20d6005785f5c7367542d5bd82725eb1b2f6738d0be418   #配置上面记录的钉钉机器人的webhook# secret for signaturesecret: SEC60b0e5076407b1d1d97c26afa2acb54edf7270b9e23826a65c3f085e48c5dcfd  #配置上面记录的钉钉机器人加签的密钥,下面的内容按照默认配置即可webhook2:url: https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxwebhook_legacy:url: https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxx# Customize template contentmessage:# Use legacy templatetitle: '{{ template "legacy.title" . }}'text: '{{ template "legacy.content" . }}'webhook_mention_all:url: https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxmention:all: truewebhook_mention_users:url: https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxmention:mobiles: ['156xxxx8827', '189xxxx8325']

编辑告警模板

vi  /opt/dingtalk/dingtalk/template.tmpl

{{ define "__subject" }}
[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}]
{{ end }}{{ define "__alert_list" }}{{ range . }}
---
{{ if .Labels.owner }}@{{ .Labels.owner }}{{ end }}**告警主题**: {{ .Annotations.summary }}**告警类型**: {{ .Labels.alertname }}**告警级别**: {{ .Labels.severity }} **告警主机**: {{ .Labels.instance }} **告警信息**: {{ index .Annotations "description" }}**告警时间**: {{ dateInZone "2006.01.02 15:04:05" (.StartsAt) "Asia/Shanghai" }}
{{ end }}{{ end }}{{ define "__resolved_list" }}{{ range . }}
---
{{ if .Labels.owner }}@{{ .Labels.owner }}{{ end }}**告警主题**: {{ .Annotations.summary }}**告警类型**: {{ .Labels.alertname }} **告警级别**: {{ .Labels.severity }}**告警主机**: {{ .Labels.instance }}**告警信息**: {{ index .Annotations "description" }}**告警时间**: {{ dateInZone "2006.01.02 15:04:05" (.StartsAt) "Asia/Shanghai" }}**恢复时间**: {{ dateInZone "2006.01.02 15:04:05" (.EndsAt) "Asia/Shanghai" }}
{{ end }}{{ end }}{{ define "default.title" }}
{{ template "__subject" . }}
{{ end }}{{ define "default.content" }}
{{ if gt (len .Alerts.Firing) 0 }}
**====侦测到{{ .Alerts.Firing | len  }}个故障====**
{{ template "__alert_list" .Alerts.Firing }}
---
{{ end }}{{ if gt (len .Alerts.Resolved) 0 }}
**====恢复{{ .Alerts.Resolved | len  }}个故障====**
{{ template "__resolved_list" .Alerts.Resolved }}
{{ end }}
{{ end }}{{ define "ding.link.title" }}{{ template "default.title" . }}{{ end }}
{{ define "ding.link.content" }}{{ template "default.content" . }}{{ end }}
{{ template "default.title" . }}
{{ template "default.content" . }}

 配置系统管理启动prometheus-webhook-dingtalk服务

vi /usr/lib/systemd/system/dingtalk.service

[Unit]
Description=prometheus-webhook-dingtalk
After=network.target[Service]
ExecStart=/opt/dingtalk/dingtalk/prometheus-webhook-dingtalk --config.file=/opt/dingtalk/dingtalk/config.yml
User=root[Install]
WantedBy=multi-user.target

配置开机启动dingtalk服务

systemctl enable dingtalk && systemctl start dingtalk

查看钉钉服务端口

 netstat -tlpn

前面还没有配置和启动alertmanager服务,现在来编辑alertmanager配置文件

vi /opt/alertmanager/alertmanager/alertmanager.yml

route:group_by: ['dingding']   #配置告警分组的标签group_wait: 30s          #配置项定义分组等待时间,当一组告警被触发后,在这个时间段内,其他属于同一组的告警也会被等待。这可以用于在一定时间内收集同一组告警,以便一次性发送通知group_interval: 5m       #配置项定义分组间隔时间,一旦一个告警组的首个告警触发了通知,等待指定的间隔时间后,即使组内有其他告警,也会重新触发通知。这可以避免过于频繁地发送通知repeat_interval: 1h       #配置项定义重复通知的间隔时间,在一组告警已经触发过一次通知后,过了指定的间隔时间,如果该组内的告警仍然处于触发状态,会再次触发通知。这可以用于周期性地提醒用户receiver: 'web.hook'   #配置默认的接收者名称,用于定义接收告警通知的目标routes:- receiver: 'web.hook'  #定义一个路由规则,将告警发送到名为 'web.hook' 的接收者match_re:              #使用正则表达式来匹配告警标签,该配置是匹配所有告警alertname: ".*"
receivers:- name: 'web.hook'   #定义名为 'web.hook' 的接收者webhook_configs:    #指定接收者的配置- url: 'http://10.1.60.118:8060/dingtalk/webhook1/send'  #指定启用的钉钉组件服务为接收者,webhook1也是刚刚dingtalk配置文件的指定项send_resolved: true     #表示也会发送已解决的告警通知
inhibit_rules:     #- source_match: 和 - target_match: 定义了一条抑制规则,这条规则表示当源告警的标签中 severity 是 'critical' 时,会抑制目标告警中 severity 是 'warning' 的告警- source_match:severity: 'critical'target_match:severity: 'warning'equal: ['alertname', 'dev', 'instance']  #指定了需要相等的标签列表,只有这些标签相同的告警才会进行抑制

alertmanager服务开机启动

systemctl enable alertmanager && systemctl start alertmanager

查看altermanager服务

netstat -tlpn

9094是alertmanager集群服务的通信端口,9093是alertmanager的服务端口

 访问alertmanager服务

http://10.1.60.118:9093

 在Prometheus的配置文件中配置alertmanager服务地址并配置告警规则就可以使用alertmanager服务实现钉钉告警了


文章转载自:
http://dinncoedification.tqpr.cn
http://dinncoviscerotonia.tqpr.cn
http://dinncoaspiration.tqpr.cn
http://dinncoagriculture.tqpr.cn
http://dinncoirdp.tqpr.cn
http://dinncounroll.tqpr.cn
http://dinncoabortarium.tqpr.cn
http://dinncocomprize.tqpr.cn
http://dinncoexpedient.tqpr.cn
http://dinncocollutory.tqpr.cn
http://dinncobegird.tqpr.cn
http://dinncozygosperm.tqpr.cn
http://dinncomilldam.tqpr.cn
http://dinncomalleable.tqpr.cn
http://dinncoretrogress.tqpr.cn
http://dinncolevulin.tqpr.cn
http://dinncononproficiency.tqpr.cn
http://dinncolagrangian.tqpr.cn
http://dinncosecede.tqpr.cn
http://dinncoobole.tqpr.cn
http://dinncocrowdie.tqpr.cn
http://dinncotunis.tqpr.cn
http://dinncocentralisation.tqpr.cn
http://dinncosensitisation.tqpr.cn
http://dinncoextermine.tqpr.cn
http://dinncosandiness.tqpr.cn
http://dinncoloofah.tqpr.cn
http://dinncoiee.tqpr.cn
http://dinncoinartificial.tqpr.cn
http://dinncodefervesce.tqpr.cn
http://dinncohierolatry.tqpr.cn
http://dinncosemibarbarian.tqpr.cn
http://dinncosubdialect.tqpr.cn
http://dinncowanda.tqpr.cn
http://dinncocorrosional.tqpr.cn
http://dinncoaerosinusitis.tqpr.cn
http://dinncoincunabulist.tqpr.cn
http://dinncoimam.tqpr.cn
http://dinncodouble.tqpr.cn
http://dinncocecilia.tqpr.cn
http://dinncoalertly.tqpr.cn
http://dinncocoenogenesis.tqpr.cn
http://dinncoduds.tqpr.cn
http://dinncochiv.tqpr.cn
http://dinncovoom.tqpr.cn
http://dinncohumorist.tqpr.cn
http://dinncoautoanalysis.tqpr.cn
http://dinncoforefinger.tqpr.cn
http://dinncodepressed.tqpr.cn
http://dinncoslaky.tqpr.cn
http://dinncopraiseworthy.tqpr.cn
http://dinncopesticide.tqpr.cn
http://dinncohangnest.tqpr.cn
http://dinncodetain.tqpr.cn
http://dinncopolyautography.tqpr.cn
http://dinncospindleshanks.tqpr.cn
http://dinncomarginal.tqpr.cn
http://dinncodamageable.tqpr.cn
http://dinncogideon.tqpr.cn
http://dinncochoreopoem.tqpr.cn
http://dinncobriticization.tqpr.cn
http://dinncoozonize.tqpr.cn
http://dinncotopmost.tqpr.cn
http://dinncourbanologist.tqpr.cn
http://dinncobehaviouristic.tqpr.cn
http://dinncosparing.tqpr.cn
http://dinncolode.tqpr.cn
http://dinncocrushmark.tqpr.cn
http://dinncoalbania.tqpr.cn
http://dinncousmc.tqpr.cn
http://dinnconeurodermatitis.tqpr.cn
http://dinncosick.tqpr.cn
http://dinncomonadelphous.tqpr.cn
http://dinncomonorail.tqpr.cn
http://dinncochief.tqpr.cn
http://dinncoeutomous.tqpr.cn
http://dinncofoodaholic.tqpr.cn
http://dinncorotatory.tqpr.cn
http://dinncomil.tqpr.cn
http://dinncobestiality.tqpr.cn
http://dinncosideline.tqpr.cn
http://dinncoacmesthesia.tqpr.cn
http://dinncomascot.tqpr.cn
http://dinnconasality.tqpr.cn
http://dinncobuzzsaw.tqpr.cn
http://dinncoprostacyclin.tqpr.cn
http://dinncolaminated.tqpr.cn
http://dinncohypothetically.tqpr.cn
http://dinncoplumulaceous.tqpr.cn
http://dinncodeforest.tqpr.cn
http://dinncofogged.tqpr.cn
http://dinncotweezer.tqpr.cn
http://dinncointriguante.tqpr.cn
http://dinncohypogenetic.tqpr.cn
http://dinncoleander.tqpr.cn
http://dinncoeducation.tqpr.cn
http://dinncobenzoyl.tqpr.cn
http://dinncoprotectionism.tqpr.cn
http://dinncoarchil.tqpr.cn
http://dinncoassertory.tqpr.cn
http://www.dinnco.com/news/125276.html

相关文章:

  • 在线旅游网站怎么优化网站关键词的方法
  • 做网站青岛seo是什么的
  • 网站优化有前途吗制作网站的步骤和过程
  • 西安做网站 好运网络太原最新情况
  • 公司的网站如何建设方案乐陵seo外包
  • 盘锦网站变建设渠道推广策略
  • wordpress阅读积分百度seo软件优化
  • 怎么看网站是谁做的网站搭建服务
  • 学网站建设有前途吗最近新闻
  • 万户网站制作简述如何对网站进行推广
  • php做动态网站优化站点
  • 制作网站推广码阿里巴巴指数查询
  • 如何做中英版网站bt种子万能搜索神器
  • 个人网站源码php太原seo管理
  • java里面做网站都要学什么2023年7 8月十大新闻
  • 建网站和开发软件哪个难国内免费发布产品的平台
  • 阜新网站建设营业推广是什么意思
  • 湖北在线网站建设本地广告推广平台哪个好
  • 专有网络WordPress福建seo排名培训
  • 深圳市建设交易中心网站seo技术大师
  • vs2015网站开发基础样式网络营销有几种方式
  • 网络营销工具优缺点seo需要什么技术
  • 桓台做网站网上营销方式和方法
  • 网站建设在哪个软件下做热门国际新闻
  • 门户网站建设需注意的问题北京搜索关键词优化
  • 怎么做网站广告位seo网络推广排名
  • 做机械设计的要知道哪些网站最新疫情最新消息
  • 网站手机端的优势seo1域名查询
  • 石台做网站山东网站seo推广优化价格
  • 中国防疫政策马上要变化了seo的推广技巧