Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kubernetes 普罗米修斯吊舱内存使用自定义警报_Kubernetes_Prometheus Alertmanager - Fatal编程技术网

Kubernetes 普罗米修斯吊舱内存使用自定义警报

Kubernetes 普罗米修斯吊舱内存使用自定义警报,kubernetes,prometheus-alertmanager,Kubernetes,Prometheus Alertmanager,我在普罗米修斯创建了吊舱内存使用的警报规则。警报在我的slack频道上完美地显示,但它不包含pod的名称,因此很难理解哪个pod出现问题 它只是显示[点火:35](POD\u内存\u高利用率默认值/k8s警告)。但是,当我查看普罗米修斯用户界面中的“警报”部分时,我可以看到带有pod名称的触发规则。有人能帮忙吗 我的警报通知模板如下所示: alertname: TargetDown alertname: POD_CPU_HIGH_UTILIZATION alertname

我在普罗米修斯创建了吊舱内存使用的警报规则。警报在我的slack频道上完美地显示,但它不包含pod的名称,因此很难理解哪个pod出现问题

它只是显示
[点火:35](POD\u内存\u高利用率默认值/k8s警告)
。但是,当我查看普罗米修斯用户界面中的“警报”部分时,我可以看到带有pod名称的触发规则。有人能帮忙吗


我的警报通知模板如下所示:

alertname: TargetDown
      alertname: POD_CPU_HIGH_UTILIZATION
      alertname:  POD_MEMORY_HIGH_UTILIZATION
receivers:

    - name: 'slack-notifications'

      slack_configs:

      - channel: '#devops'
        title: '{{ .CommonAnnotations.summary }}'
        text: '{{ .CommonAnnotations.description }}'

        send_resolved: true
我在警报通知模板中添加了选项
title:{{.CommonAnnotations.summary}}文本:{{{.CommonAnnotations.description}}
,现在它显示了描述。我的描述是
description:pod{{$labels.pod}}正在使用高内存
。但仅显示
时使用的是高内存
。如果没有如中所述指定pod名称,则应检查警报规则,并在必要时进行更新。请参见一个示例:

ALERT ElasticacheCPUUtilisation
  IF aws_elasticache_cpuutilization_average > 80
  FOR 10m
  LABELS { severity = "warning" }
    ANNOTATIONS {
    summary = "ElastiCache CPU Utilisation Alert",
    description = "Elasticache CPU Usage has breach the threshold set (80%) on cluster id {{ $labels.cache_cluster_id }}, now at {{ $value }}%",
    runbook = "https://mywiki.com/ElasticacheCPUUtilisation",
  }
receivers:
  - name: 'iw-team-slack'
    slack_configs:
    - channel: alert-events
      send_resolved: true
      api_url: https://hooks.slack.com/services/<your_token>
      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 }}
要为prometheus GUI提供外部URL,请将CLI参数应用于prometheus服务器并重新启动它:

-web.external-url=http://externally-available-url:9090/
之后,您可以将这些值放入alertmanager配置中。请参见一个示例:

ALERT ElasticacheCPUUtilisation
  IF aws_elasticache_cpuutilization_average > 80
  FOR 10m
  LABELS { severity = "warning" }
    ANNOTATIONS {
    summary = "ElastiCache CPU Utilisation Alert",
    description = "Elasticache CPU Usage has breach the threshold set (80%) on cluster id {{ $labels.cache_cluster_id }}, now at {{ $value }}%",
    runbook = "https://mywiki.com/ElasticacheCPUUtilisation",
  }
receivers:
  - name: 'iw-team-slack'
    slack_configs:
    - channel: alert-events
      send_resolved: true
      api_url: https://hooks.slack.com/services/<your_token>
      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 }}
接收器:
-名称:“iw团队松弛”
slack\u配置:
-频道:警报事件
发送解决方案:正确
api_网址:https://hooks.slack.com/services/
标题:“[{.Status | toUpper}{{{if eq.Status“firing”}}:{{{.Alerts.firing | len}}}{{{end}]监视事件通知”
正文:>-
{{range.Alerts}
*警报:{{.Annotations.summary}-`{{.Labels.severity}`
*说明:{{.Annotations.Description}
*图表:**运行手册:*
*详情:*
{range.Labels.SortedPairs}}•*{{.Name}::`{.Value}`
{{end}
{{end}

您必须分享从普罗米修斯到Slack的数据共享方式-如果没有这一点,很难回答问题我的警报通知模板如下:----------------------------------------路由:分组人:[“作业”]组等待:1s组间隔:1m重复间隔:12h接收器:“空闲通知”路由:-匹配:alertname:POD\u内存\u高利用率接收器:-名称:“空闲通知”空闲配置:-通道:“#devops”标题:“{{.CommonAnnotations.summary}}”文本:'{{.CommonAnnotations.description}}'发送解析:true------------------我在我的警报通知模板中添加了选项“title:{{.CommonAnnotations.summary}”文本:{{.CommonAnnotations.description}',现在它显示了描述。我的描述是“description:pod{$labels.pod}”“正在使用高内存”。但仅显示“正在使用高内存”。未指定pod名称。标签未预先填充,您必须在alart级别进行配置。您是否也可以添加此额外信息?这将有助于其他人检查: