Skip to content

can I use the alertmanager templates? #70

Description

@mulderx

hello Thanks for prometheus_bot.

can I use the alertmanager templates for the telegram templates?

thank you~

Activity

  1. mulderx commented on Nov 4, 2021

    @mulderx
    Author

    I use the production_example.tmpl but

    Alert: <a href="{{ $val.GeneratorURL }}">{{ index $val.Annotations "name" }}</a>

    didn't show anything

    how can I fix it?

    out put

    ~~~ Alerting ~~~
    alertname = service_down
    
    Status: FIRING 🔥
    
    Active Alert List:
      Alert:  **<--- didn't show anything**
      Current value:Severity: critical
      Active from: 11/04/2021 16:30:20
      
      description: The service blackbox_http instance xxx is Down
      summary: instance xxx can't work!!!
    
  2. hryamzik commented on Nov 5, 2021

    @hryamzik
    Collaborator

    You can try to ask @AndreaGreco about that template. Generally you can always sniff traffic between the bot and alert manager and add also log messages in go code.

  3. mulderx commented on Nov 8, 2021

    @mulderx
    Author

    You can try to ask @AndreaGreco about that template. Generally you can always sniff traffic between the bot and alert manager and add also log messages in go code.

    ok! thank you

  4. AndreaGreco commented on Nov 8, 2021

    @AndreaGreco
    Contributor

    You can try to ask @AndreaGreco about that template. Generally you can always sniff traffic between the bot and alert manager and add also log messages in go code.

    ok! thank you

    Hi, pass too many years i don't remember for.
    Read source code in main.go, if found solution right.
    if problem persist write here again and i will try help you by reading source

  5. woloss commented on Mar 15, 2022

    @woloss

    Alert: <a href="{{ $val.GeneratorURL }}">{{ index $val.Annotations "name" }}</a>

    didn't show anything

    how can I fix it?

    Well, kinda late answer.
    Config with alerts, which configured on Prometheus side, contains annotations section. This is pure json (key/value).
    If you want to get value here - Alert: {{ index $val.Annotations "name" }} Current value - {{ $val.Annotations "value" }}
    You must add one more annotation, something like:

        annotations:
          title: '{{ $labels.instance }}'
          name: 'Instance Alert'
          value: 'Some Value'

    Also, you should exclude those keys from loop (based on production_example.tmpl)

      Active from: {{ $val.StartsAt | str_FormatDate }}
      {{ range $key, $value := $val.Annotations -}}
      {{ if and (and (ne $key "name") (ne $key "value")) (ne $key "measureUnit") }}  -<<<< There
      {{$key}}: {{$value}}
      {{- end -}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions