prometheus-operator的安装和配置
admin
2023-03-25 09:41:23
0

1、安装prometheus-operator,具体安装步骤链接:https://www.qikqiak.com/k8s-book/docs/58.Prometheus%20Operator.html
2、修改配置文件
/root/prometheus-operator/kube-prometheus/manifests
vim alertmanager.yaml
global:
resolve_timeout: 60m
smtp_smarthost: 'smtp.139.com:25'
smtp_from: '15859527102@139.com'
smtp_auth_username: '15859527102@139.com'
smtp_auth_password: 'x84l_asus_ak'
smtp_hello: '139.com'
smtp_require_tls: false
wechat_api_url: 'https://qyapi.weixin.qq.com/cgi-bin/'
wechat_api_secret: '03vUA6wHSOtfCwfi8f7DkfXc0G4V6juaYOPDRjspnGU'
wechat_api_corp_id: 'wwae01588e36d3f448'
templates:

  • "*.tmpl"
    route:
    group_by: ['job', 'severity']
    group_wait: 30s
    group_interval: 60m
    repeat_interval: 12h
    receiver: default
    routes:
  • receiver: wechat
    match:
    alertname: CPUThrottlingHigh
    receivers:
    • name: 'default'
      email_configs:
  • to: '313841662@qq.com'
    send_resolved: true
    • name: 'webhook'
      webhook_configs:
  • url: 'http://dingtalk-hook.kube-system.svc.cluster.local:5000'
    send_resolved: true
    • name: 'wechat'
      wechat_configs:
  • send_resolved: true
    agent_id: '1000002'
    to_user: '@all'
    corp_id: 'wwae01588e36d3f448'
    api_secret: '03vUA6wHSOtfCwfi8f7DkfXc0G4V6juaYOPDRjspnGU'

    PS:生成企业微信id和secret步骤详见前面zabbix配置微信报警
    3、创建微信报警模板
    vim wechat.tmpl
    {{ define "wechat.default.message" }}
    {{ range .Alerts }}
    ========start=========
    告警程序: prometheus_alert
    告警级别: {{ .Labels.serverity }}
    告警类型: {{ .Labels.alertname }}
    故障主机: {{ .Labels.instance }}
    告警主题: {{ .Annotations.summary }}
    告警详情: {{ .Annotations.description }}
    触发时间: {{ (.StartsAt.Add 28800e9).Format "2006-01-02 15:04:05" }}
    =========end===========
    {{ end }}
    {{ end }}

4、# 先将之前的 secret 对象删除,重新创建
$ kubectl delete secret alertmanager-main -n monitoring
secret "alertmanager-main" deleted
kubectl create secret generic alertmanager-main --from-file=alertmanager.yaml --from-file=wechat.tmpl -n monitoring

相关内容

热门资讯

特朗普下令不打了,美国的“余粮... 可以说戛然而止,快得让很多人都无法适应。前两周,每一天美国都要打击伊朗一通。就在7月24日白宫会议前...
穆杰塔巴最新表态:支持黎真主党 △伊朗最高领袖穆杰塔巴·哈梅内伊(资料图)当地时间7月26日晚,伊朗最高领袖穆杰塔巴·哈梅内伊对黎巴...
美军瘫痪一艘驶向伊朗的油轮,特... 美国总统特朗普虽下令暂停打击伊朗,但美军仍在执行对霍尔木兹海峡的封锁任务。针对美军瘫痪一艘驶向伊朗油...
“小牌大耍”的底气到底是哪里来... 澎湃首席评论员 李平这两天,“艺人李权哲乘高铁占座事件”在网上引发热议,该艺人参加的活动主办方曾发布...
越南籍船舶南海遇险沉没,中方已... 据凤凰卫视报道,一艘越南船舶7月24日夜间在越南庆和以东220海里附近遇险沉没,船上共62名越南籍人...
李权哲占座、蒙面、装死:娱乐圈... 你买了一张高铁一等座的票,找到自己的位置,18A。有人坐着。你拿出手机看了眼购票记录——没错,18A...
杭州景区咖啡店闯入1条幼蛇,仅... 夏天气温高、湿度大,蛇类活动进入高峰期,千万别被“小蛇无害”的刻板印象骗了!有些幼蛇看着迷你可爱,实...
AI开源公开信签署企业增至50... IT之家 7 月 26 日消息,英伟达、微软、IBM、Meta 等 25 家美国科技企业本周(7 月...
南阳快手短视频代运营企业的服务... 在短视频平台快速发展的背景下,企业通过快手等渠道进行内容运营已成为常见的市场动作。对于希望借助短视频...
普通人该如何跟上科技发展的步伐 这个被称作科技的词汇, 听起来既有宏大之感, 又颇为遥远, 好似仅仅归属于在实验室里专心致志钻研的科...