Disabling grouping seems to inhibit Slack alert delivery

26 views
Skip to first unread message

Federico Buti

unread,
Jun 10, 2020, 4:55:02 AM6/10/20
to Prometheus Users
Hi all.


We were recently testing grouping via the special value '...' for a specific Slack receiver. 
Looking at the documentation this seems feasible and correct. However, after introducing the grouping, no alert belonging to the receiver was delivered to Slack any more. 

The routing configuration looks like the following:

route:
  receiver
: 'none'
  group_by
: [severity, stack, environment]
  group_wait
: 30s
  group_interval
: 5m
  repeat_interval
: 6h
  routes
:
   
- receiver: 'slack_firmware_rc'
      match_re
:
        stack
: xxx
        instance
: yyy
   
#
   
# other "stack"-based receivers here
   
#
   
- receiver: 'slack_it'
      group_by
: ['...']   # disables grouping
      match_re
:
        stack
: it
   
#
   
# other "stack"-based receivers here    
   
#

I've omitted the other receivers: they weren't touched and seem to continue working fine. The only receiver that is not working is the "slack_it" one. Notably we reworked also the templates for the receiver but there is no error in the log at all, meaning the new templates are correctly loaded. Anyway, just for completion here are the changed parts:

- name: slack_it
  slack_configs
:
 
- api_url: 'xxx'
    icon_url
: 'yyy'
    username
: 'zzz'
    channel
: '#out_channel'
    send_resolved
: true
    color
: '{{ template "yakkity-color" . }}'
    title
: '{{ template "yakkity-simple-title" . }}'
    text
:  '{{ template "yakkity-simple-text" . }}'
    thumb_url
: '{{ template "yakkity-thumb" . }}'


{{ define "yakkity-simple-title" -}}
   
{{- with index .Alerts 0 -}}
       
{{- .Annotations.summary -}}
   
{{- end -}}
{{- end }}


{{ define "yakkity-simple-text" }}
{{- with index .Alerts 0 -}}
   
{{- .Annotations.description -}}
{{- end }}


:bar_chart: *<{{ .GeneratorURL }}|Graph>*


{{- if .Annotations.runbook }}   :notebook: *<{{ .Annotations.runbook }}|Runbook>*  {{- end }}
{{ $filteredLabels := "stack|environment|service|job|monitor|severity|hostname" }}
{{ range .Labels.SortedPairs }}{{if not (match $filteredLabels .Name)}}`{{ .Name }}={{ .Value }}` {{ end }}{{ end }}
{{ end }}


Any idea what can be wrong with this new setup?
Thanks in advance,
F.


Federico Buti

unread,
Jul 7, 2020, 5:57:18 AM7/7/20
to Prometheus Users
Hello.

 
Notably we reworked also the templates for the receiver but there is no error in the log at all, meaning the new templates are correctly loaded.


I was obviously wrong there. While the templates did load correctly, they did fail at runtime when a new alert spawned. There was a label accessed with the wrong index. Fixing the templates, fixed the issue for me. 
Thanks to anyone who took the time to look into this.

Bests,
F.
Reply all
Reply to author
Forward
0 new messages