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

单页网站开发百度搜索引擎提交入口

单页网站开发,百度搜索引擎提交入口,炫酷网站源码,海口建网站 模板------> 课程视频同步分享在今日头条和B站 大家好,我是博哥爱运维。早期我们经常用邮箱接收报警邮件,但是报警不及时,而且目前各云平台对邮件发送限制还比较严格,所以目前在生产中用得更为多的是基于webhook来转发报警内容到企…

------> 课程视频同步分享在今日头条和B站

大家好,我是博哥爱运维。早期我们经常用邮箱接收报警邮件,但是报警不及时,而且目前各云平台对邮件发送限制还比较严格,所以目前在生产中用得更为多的是基于webhook来转发报警内容到企业中用的聊天工具中,比如钉钉、企业微信、飞书等。

prometheus的报警组件是Alertmanager,它支持自定义webhook的方式来接受它发出的报警,它发出的日志json字段比较多,我们需要根据需要接收的app来做相应的日志清洗转发

这里博哥将用golang结合Gin网络框架来编写一个日志清洗转发工具,分别对这几种常用的报警方式作详细的说明及实战,源码的分享计划放入golang语言开发讲解课程里面,这样大家更容易接受。

https://github.com/bogeit/LearnK8s/tree/main/2023/boge-webhook

我们先制作好镜像,并上传到我们自己的私有仓库Harbor里面

# 将上面代码仓库文件内容下载到目录
# 确认文件是否在当前目录
ls -l Dockerfile mycli
# 构建镜像
docker build -t harbor.boge.com/product/alertmanaer-webhook:1.0 .
# 上传镜像
docker push  harbor.boge.com/product/alertmanaer-webhook:1.0
# 创建harbor私有仓库密钥
kubectl -n monitoring create secret docker-registry boge-secret --docker-server=harbor.boge.com --docker-username=boge --docker-password=Boge@666 --docker-email=admin@boge.com

将构建好的后端转发服务部署到K8S上面

kubectl -n monitoring apply -f alertmanaer-webhook.yaml# 如果出现镜像拉取失败问题,注意看当前pod运行的节点,上面需要添加私有仓库的本地hosts
# vim /etc/hosts
10.0.1.201    easzlab.io.local harbor.boge.com# 指定后端转发服务的svc地址,发个post请求看看服务是否正常
curl -X POST -H 'Content-type: application/json' -d '{"name": "boge","titlea": "'"$(id)"'", "texta": "'"$(whoami)-$(hostname)"'"}' 10.68.138.60/b01bdc063/boge/getjson

查看后端 转发服务日志

# kubectl -n monitoring logs alertmanaer-dingtalk-dp-64c966fb9b-8pxgr
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.- using env:   export GIN_MODE=release- using code:  gin.SetMode(gin.ReleaseMode)[GIN-debug] GET    /status                   --> mycli/libs.MyWebServer.func1 (3 handlers)
[GIN-debug] POST   /b01bdc063/boge/getjson   --> mycli/libs.MyWebServer.func2 (3 handlers)
[GIN-debug] POST   /7332f19/prometheus/dingtalk --> mycli/libs.MyWebServer.func3 (3 handlers)
[GIN-debug] POST   /1bdc0637/prometheus/feishu --> mycli/libs.MyWebServer.func4 (3 handlers)
[GIN-debug] POST   /5e00fc1a/prometheus/weixin --> mycli/libs.MyWebServer.func5 (3 handlers)
[GIN-debug] Listening and serving HTTP on :9999
{"name": "boge","titlea": "uid=0(root) gid=0(root) groups=0(root)", "texta": "root-node-1"}
[GIN] 2024/01/15 - 21:45:15 | 200 |      36.143µs |   172.20.84.128 | POST     "/b01bdc063/boge/getjson"

首先看下报警规则及报警发送配置是什么样的

prometheus-operator的规则非常齐全,基本属于开箱即用类型,大家可以根据日常收到的报警,对里面的rules报警规则作针对性的调整,比如把报警观察时长缩短一点等

# 监控报警规划修改
kubectl -n monitoring edit PrometheusRule kubernetes-monitoring-rules
# 通过这里可以获取需要创建的报警配置secret名称
# kubectl -n monitoring edit statefulsets.apps alertmanager-main
...volumes:- name: config-volumesecret:defaultMode: 420secretName: alertmanager-main-generated
...# 注意事先在配置文件 alertmanager.yaml 里面编辑好收件人等信息 ,再执行下面的命令
kubectl -n monitoring delete secret alertmanager-main
kubectl -n monitoring create secret generic  alertmanager-main --from-file=alertmanager.yaml 

报警配置文件 alertmanager.yaml

# global块配置下的配置选项在本配置文件内的所有配置项下可见
global:# 在Alertmanager内管理的每一条告警均有两种状态: "resolved"或者"firing". 在altermanager首次发送告警通知后, 该告警会一直处于firing状态,设置resolve_timeout可以指定处于firing状态的告警间隔多长时间会被设置为resolved状态, 在设置为resolved状态的告警后,altermanager不会再发送firing的告警通知.
#  resolve_timeout: 1hresolve_timeout: 10m# 告警通知模板
templates:
- '/etc/altermanager/config/*.tmpl'# route: 根路由,该模块用于该根路由下的节点及子路由routes的定义. 子树节点如果不对相关配置进行配置,则默认会从父路由树继承该配置选项。每一条告警都要进入route,即要求配置选项group_by的值能够匹配到每一条告警的至少一个labelkey(即通过POST请求向altermanager服务接口所发送告警的labels项所携带的<labelname>),告警进入到route后,将会根据子路由routes节点中的配置项match_re或者match来确定能进入该子路由节点的告警(由在match_re或者match下配置的labelkey: labelvalue是否为告警labels的子集决定,是的话则会进入该子路由节点,否则不能接收进入该子路由节点).
route:# 例如所有labelkey:labelvalue含cluster=A及altertname=LatencyHigh labelkey的告警都会被归入单一组中group_by: ['job', 'altername', 'cluster', 'service','severity']# 若一组新的告警产生,则会等group_wait后再发送通知,该功能主要用于当告警在很短时间内接连产生时,在group_wait内合并为单一的告警后再发送
#  group_wait: 30sgroup_wait: 10s# 再次告警时间间隔
#  group_interval: 5mgroup_interval: 20s# 如果一条告警通知已成功发送,且在间隔repeat_interval后,该告警仍然未被设置为resolved,则会再次发送该告警通知
#  repeat_interval: 12hrepeat_interval: 1m# 默认告警通知接收者,凡未被匹配进入各子路由节点的告警均被发送到此接收者receiver: 'webhook'# 上述route的配置会被传递给子路由节点,子路由节点进行重新配置才会被覆盖# 子路由树routes:# 该配置选项使用正则表达式来匹配告警的labels,以确定能否进入该子路由树# match_re和match均用于匹配labelkey为service,labelvalue分别为指定值的告警,被匹配到的告警会将通知发送到对应的receiver- match_re:service: ^(foo1|foo2|baz)$receiver: 'webhook'# 在带有service标签的告警同时有severity标签时,他可以有自己的子路由,同时具有severity != critical的告警则被发送给接收者team-ops-wechat,对severity == critical的告警则被发送到对应的接收者即team-ops-pagerroutes:- match:severity: criticalreceiver: 'webhook'# 比如关于数据库服务的告警,如果子路由没有匹配到相应的owner标签,则都默认由team-DB-pager接收- match:service: databasereceiver: 'webhook'# 我们也可以先根据标签service:database将数据库服务告警过滤出来,然后进一步将所有同时带labelkey为database- match:severity: criticalreceiver: 'webhook'
# 抑制规则,当出现critical告警时 忽略warning
inhibit_rules:
- source_match:severity: 'critical'target_match:severity: 'warning'# Apply inhibition if the alertname is the same.#   equal: ['alertname', 'cluster', 'service']#
# 收件人配置
receivers:
- name: 'webhook'webhook_configs:- url: 'http://alertmanaer-dingtalk-svc.kube-system/b01bdc063/boge/getjson'send_resolved: true
附: 监控其他服务的prometheus规则配置

https://github.com/samber/awesome-prometheus-alerts


文章转载自:
http://dinncohaick.bpmz.cn
http://dinnconesting.bpmz.cn
http://dinncokinshasa.bpmz.cn
http://dinncoungrateful.bpmz.cn
http://dinncolaughton.bpmz.cn
http://dinncoklipdas.bpmz.cn
http://dinncoinstallment.bpmz.cn
http://dinncolienitis.bpmz.cn
http://dinncoanoopsia.bpmz.cn
http://dinncoantibacchius.bpmz.cn
http://dinncohydrazide.bpmz.cn
http://dinncograze.bpmz.cn
http://dinncoprovision.bpmz.cn
http://dinncowisteria.bpmz.cn
http://dinncopessimistic.bpmz.cn
http://dinncogheld.bpmz.cn
http://dinncogapeworm.bpmz.cn
http://dinncokerbstone.bpmz.cn
http://dinnconepit.bpmz.cn
http://dinncosemiconscious.bpmz.cn
http://dinncopolydrug.bpmz.cn
http://dinncotinter.bpmz.cn
http://dinncoart.bpmz.cn
http://dinncoserajevo.bpmz.cn
http://dinncorespecter.bpmz.cn
http://dinncotartarly.bpmz.cn
http://dinncobowels.bpmz.cn
http://dinncoscintiscan.bpmz.cn
http://dinncowecht.bpmz.cn
http://dinncointerpolate.bpmz.cn
http://dinncolabroid.bpmz.cn
http://dinncoimpotency.bpmz.cn
http://dinncoextended.bpmz.cn
http://dinncoclosest.bpmz.cn
http://dinncomonogamous.bpmz.cn
http://dinncoeds.bpmz.cn
http://dinncoarenation.bpmz.cn
http://dinncoacrobatic.bpmz.cn
http://dinncostakeholder.bpmz.cn
http://dinncoindiscretion.bpmz.cn
http://dinncoruskiny.bpmz.cn
http://dinncopushbutton.bpmz.cn
http://dinncointravenous.bpmz.cn
http://dinncoefficaciously.bpmz.cn
http://dinncostatewide.bpmz.cn
http://dinncoornithischian.bpmz.cn
http://dinncoplanster.bpmz.cn
http://dinncopavonine.bpmz.cn
http://dinncobuzkashi.bpmz.cn
http://dinncoreplenish.bpmz.cn
http://dinncofrostily.bpmz.cn
http://dinncoglassworks.bpmz.cn
http://dinncotokio.bpmz.cn
http://dinncocompete.bpmz.cn
http://dinncoprythee.bpmz.cn
http://dinncosisyphean.bpmz.cn
http://dinncopatroclinal.bpmz.cn
http://dinncochronogram.bpmz.cn
http://dinncorunic.bpmz.cn
http://dinncoprotosemitic.bpmz.cn
http://dinncospalpeen.bpmz.cn
http://dinncoxcviii.bpmz.cn
http://dinncoentryway.bpmz.cn
http://dinncodescender.bpmz.cn
http://dinncodissyllabic.bpmz.cn
http://dinncoremorse.bpmz.cn
http://dinncomushy.bpmz.cn
http://dinncostaphylorrhaphy.bpmz.cn
http://dinncoplunging.bpmz.cn
http://dinnconarcotherapy.bpmz.cn
http://dinncovase.bpmz.cn
http://dinncounharming.bpmz.cn
http://dinncoah.bpmz.cn
http://dinncosubstitutional.bpmz.cn
http://dinncopsychotherapist.bpmz.cn
http://dinncoimplementation.bpmz.cn
http://dinncoallotee.bpmz.cn
http://dinncocachaca.bpmz.cn
http://dinncoweazand.bpmz.cn
http://dinncomatte.bpmz.cn
http://dinncoredbone.bpmz.cn
http://dinncovadose.bpmz.cn
http://dinncocompend.bpmz.cn
http://dinncoaymaran.bpmz.cn
http://dinncohypoxanthine.bpmz.cn
http://dinncosaint.bpmz.cn
http://dinncoglaciological.bpmz.cn
http://dinncodecalcification.bpmz.cn
http://dinnconazi.bpmz.cn
http://dinncoquarterage.bpmz.cn
http://dinncotuscan.bpmz.cn
http://dinncokakistocracy.bpmz.cn
http://dinncogiveaway.bpmz.cn
http://dinncobatboy.bpmz.cn
http://dinncoglycosylate.bpmz.cn
http://dinncosortes.bpmz.cn
http://dinncoflustration.bpmz.cn
http://dinncoromanization.bpmz.cn
http://dinncobrushwork.bpmz.cn
http://dinncorepossessed.bpmz.cn
http://www.dinnco.com/news/73120.html

相关文章:

  • 江苏网站制作免费网站建站
  • 帮别的公司做网站违法吗何鹏seo
  • 怎么给老板提供网站建设资料运营推广计划怎么写
  • 合肥做双语网站官网制作公司
  • 哪个汽车网站汽贸店免费做营销推广与策划
  • 网站主题及样式优化谷歌seo推广公司
  • 全响应网站南宁网站建设服务公司
  • 地方招聘网站如何做推广谷歌搜索入口手机版
  • 商丘做网站公司软文写作范文500字
  • 常州市网站优化深圳百度百科
  • 网站做换肤360优化大师官方网站
  • 专业的led网站建设平台代运营是什么意思
  • 去哪个网站做职业测试好小时seo百度关键词点击器
  • 长沙市城市建设档案馆网站黄冈黄页88网黄冈房产估价
  • 深圳市政府网站集约化建设方案seo基础入门免费教程
  • 自己做的网站加载慢谷歌浏览器下载安装2021最新版
  • 购物网站功能模块网络seo哈尔滨
  • 东莞市做网站抖音黑科技引流推广神器
  • 批量做网站软件微信广告投放平台
  • 企业网站的模块功能站长工具域名查询
  • 网站首页上海网站建设公司aso优化平台
  • 济南住建网站如何自己建一个网站
  • 做网站可以赚钱吗?新站整站快速排名
  • 昆明seo博客南网站建设青岛网络优化代理
  • asp网站免费完整源码怎样做竞价推广
  • 烟台百度网站推广宁波关键词优化时间
  • 网站建设合同首付多少钱软文代发
  • 网站建设预算表制作哈尔滨seo优化
  • 建设部门网站百度推广和优化有什么区别
  • 做餐饮酒店网站网站排名优化多少钱