Hi Dennis We have multiple teams and they enter information needed slack and other notification services through a webapp and I do not want to write that info to alertmanager yml as it is space sensitive as one mistake can stop alerts for all teams. So we thought this is better option as we don’t have to touch that yml file. I wil be having different api_url and channel combinations for each team. Yes, I will use some slack template once this basic config issue is resolved.
On Saturday, January 9, 2021, <dennis.murti...@googlemail.com> wrote: > Hi Kiran, > > Why you are not trying to create different routes based on the > 'slack_channel' variable? For title and text you can create templates. If > they are to many slack channels to write it down manually, I would > recommend to use a template language. > > Am 08.01.2021 um 23:32 schrieb kiran <kiran...@gmail.com>: > > > @Stuart Clark <stuart.cl...@jahingo.com> > > Here is what I tried. I am also attaching the version(*with slack > variables*) which is not working. > Any help resolving this is appreciated. > > *TEST#1* Using {{ .GroupLabels.slack_url }} for api_url without any > quotes: > > - name: slack_client > slack_configs: > - api_url: {{ .GroupLabels.slack_url }} > channel: '{{ .GroupLabels.slack_channel }}' > send_resolved: true > title: "{{ range .Alerts }}{{ .Annotations.summary }}\n{{ end }}" > text: "{{ range .Alerts }}{{ .Annotations.description }}\n{{ end > }}" > > > Checking 'alertmanager.yml' FAILED: yaml: unmarshal errors: > line 67: cannot unmarshal !!map into string > > amtool: error: failed to validate 1 file(s) > > *TEST#2* Using {{ .GroupLabels.slack_url }} for api_url with single > quotes: > > Checking 'alertmanager.yml' FAILED: unsupported scheme "" for URL > > amtool: error: failed to validate 1 file(s) > > > *TEST#3* Using {{ .GroupLabels.slack_url }} for api_url with single > quotes: > > Checking 'alertmanager.yml' FAILED: unsupported scheme "" for URL > > amtool: error: failed to validate 1 file(s) > > > *TEST#4* It is working when using a *single* slack incoming web hook url > and channel instead of variables, but I want to dynamically do it using > labels. I confirm that the slack labels exist in the data correctly. > > > On Fri, Jan 8, 2021 at 11:03 AM Stuart Clark <stuart.cl...@jahingo.com> > wrote: > >> Could you show the configuration you tried with the double quotes in >> place, as well as the error returned? >> >> On 8 January 2021 13:57:40 GMT, kiran <kiran...@gmail.com> wrote: >>> >>> Yes I did both single and double it’s complaining about quotes in url >>> >>> On Friday, January 8, 2021, Stuart Clark <stuart.cl...@jahingo.com> >>> wrote: >>> >>>> On 08/01/2021 06:22, kiran wrote: >>>> >>>> All >>>> >>>> I am trying to validate my alertmanager config yml file using *amtool*. >>>> amtool is throwing an error message 'cannot unmarshall !!map' with the >>>> following, but when I replace *api_url* with a slack_url(e.g >>>> https://hooks.slack.com/services/XXXXXXXX/XXXXXXXX/ >>>> <https://hooks.slack.com/services/T014T4325N0/B01HQ7GUE8M/IQ2JkHOXPmr48ZCqUPvwxG5>XXXXXXXX) >>>> and re-run amtool, it shows success. >>>> Can someone guide me what I am doing wrong here? >>>> >>>> - name: slack_client >>>> >>>> slack_configs: >>>> >>>> - api_url: {{ .GroupLabels.slack_url }} >>>> >>>> channel: '{{ .GroupLabels.slack_channel }}' >>>> >>>> send_resolved: true >>>> >>>> title: "{{ range .Alerts }}{{ .Annotations.summary }}\n{{ end >>>> }}" >>>> >>>> text: "{{ range .Alerts }}{{ .Annotations.description }}\n{{ >>>> end }}" >>>> >>>> Have you tried wrapping that in quotes? >>>> >>> >> -- >> Sent from my Android device with K-9 Mail. Please excuse my brevity. >> > -- > You received this message because you are subscribed to the Google Groups > "Prometheus Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to prometheus-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/prometheus-users/CAOnWYZVWZ7A6B3c6FxFfiqrEAQNoJ > yWess9ZbG1cYRy9JQgQVA%40mail.gmail.com > <https://groups.google.com/d/msgid/prometheus-users/CAOnWYZVWZ7A6B3c6FxFfiqrEAQNoJyWess9ZbG1cYRy9JQgQVA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAOnWYZXemdiGdCVQp7xDsUL_pfJ8KYfdQCxLMvdkL6dP%2Bf2Vqw%40mail.gmail.com.