inCaller / prometheus_bot

Telegram bot for prometheus alerting
MIT License
394 stars 182 forks source link

Value nul #76

Closed azizzailani closed 2 years ago

azizzailani commented 2 years ago

why are the type(summary), Instance and description empty?

config template.tmpl:

Type: "{{ .CommonAnnotations.description }}"
Summary: "{{.CommonAnnotations.summary}}"
Alertname: "{{ .CommonLabels.alertname }}"
Instance: "{{ .CommonLabels.instance }}"
Severity: {{ .CommonLabels.severity}}
Status:  {{ .Status }}

output:

Type: ""
Summary: ""
Alertname: "HostOutOfMemory"
Instance: ""
Severity: warning
Status:  firing

This happens because every time series is uniquely identified by its metric name and a set of labels. And every unique combination of key-value label pairs represents a new alert for this time series.

azizzailani commented 2 years ago

@hryamzik

mulderx commented 2 years ago

didn't you try this production_example.tmpl ?

azizzailani commented 2 years ago

didn't you try this production_example.tmpl ?

already, but no output received by telegram

hryamzik commented 2 years ago

What's in your rules file?

azizzailani commented 2 years ago

example my rules

  - alert: HostOutOfMemory
    expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes * 100 < 10
    for: 5m
    labels:
      severity: critical
    annotations:
      summary: Host out of memory (instance {{ $labels.instance }})
      description: "{{ $labels.instance }} node memory is filling up (< 10% left)"

@hryamzik

hryamzik commented 2 years ago

Did you take a look at sniffed traffic between alert manager and prometheus bot? Did you try to leave just plain text in summary?

ricky-rocky commented 2 years ago

I also have this problem

template.tmpl Type: {{.CommonAnnotations.description}} Summary: {{.CommonAnnotations.summary}} Alertname: {{ .CommonLabels.alertname }} Instance: {{ .CommonLabels.instance }} Serverity: {{ .CommonLabels.serverity}} Status: {{ .Status }}

rule:

TG output

Type: Summary: Alertname: NodeMemoryUsage Instance: Serverity: Status: firing

system centOS7 .9

Please help

@hryamzik

ivzyukov commented 2 years ago

you miss spaces after {{ and before brackets }}