@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/CAOnWYZVWZ7A6B3c6FxFfiqrEAQNoJyWess9ZbG1cYRy9JQgQVA%40mail.gmail.com.

Reply via email to