首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从普罗米修斯舵图发出警告以放松

从普罗米修斯舵图发出警告以放松
EN

Stack Overflow用户
提问于 2020-12-04 15:07:29
回答 1查看 3.5K关注 0票数 3

我正试图在Prometheus上创建Kubernetes上的警报,并将它们发送到Slack频道。为此,我使用了普罗米修斯-社区头盔图表(已经包括了警报管理器)。由于我想使用我自己的警报,我还创建了一个来自这里的强烈灵感的这里(如下图所示)。如果我向前推进普罗米修斯,我可以看到我的警报从不活跃,到待定到触发,但没有消息被发送到松弛。我很有信心我的警报管理器配置很好(因为我已经用另一个图表的一些预构建警报进行了测试,并且它们被发送到了松弛状态)。因此,我最好的猜测是,我以错误的方式添加了警报(在serverFiles部分中),但我不知道如何正确地处理它。而且,在我看来,警报管理器日志看起来很正常。有人知道我的问题从何而来吗?

代码语言:javascript
复制
---
serverFiles:
  alerting_rules.yml: 
    groups:
    - name: example
      rules:
      - alert: HighRequestLatency
        expr: sum(rate(container_network_receive_bytes_total{namespace="kube-logging"}[5m]))>20000
        for: 1m
        labels:
          severity: page
        annotations:
          summary: High request latency

alertmanager:
  persistentVolume:
    storageClass: default-hdd-retain
  ## Deploy alertmanager
  ##
  enabled: true

  ## Service account for Alertmanager to use.
  ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
  ##
  serviceAccount:
    create: true
    name: ""

  ## Configure pod disruption budgets for Alertmanager
  ## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/#specifying-a-poddisruptionbudget
  ## This configuration is immutable once created and will require the PDB to be deleted to be changed
  ## https://github.com/kubernetes/kubernetes/issues/45398
  ##
  podDisruptionBudget:
    enabled: false
    minAvailable: 1
    maxUnavailable: ""

  ## Alertmanager configuration directives
  ## ref: https://prometheus.io/docs/alerting/configuration/#configuration-file
  ##      https://prometheus.io/webtools/alerting/routing-tree-editor/
  ##
  config:
    global:
      resolve_timeout: 5m
      slack_api_url: "I changed this url for the stack overflow question"
    route:
      group_by: ['job']
      group_wait: 30s
      group_interval: 5m
      repeat_interval: 12h
      #receiver: 'slack'
      routes:
      - match:
          alertname: DeadMansSwitch
        receiver: 'null'
      - match:
        receiver: 'slack'
        continue: true
    receivers:
    - name: 'null'
    - name: 'slack'
      slack_configs:
      - channel: 'alerts'
        send_resolved: false
        title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
        text: >-
          {{ range .Alerts }}
            *Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
            *Description:* {{ .Annotations.description }}
            *Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:> *Runbook:* <{{ .Annotations.runbook }}|:spiral_note_pad:>
            *Details:*
            {{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
            {{ end }}
          {{ end }}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-07 09:40:50

所以我终于解决了这个问题。问题显然是库贝-普罗米修斯-堆栈普罗米修斯头盔图的工作方式有点不同。因此,我不得不在alertmanager.config上插入代码(从全局开始),而不是alertmanagerFiles.alertmanager.yml。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65145962

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档