Split string in alertmanager.

51 views
Skip to first unread message

Jhanssen Fávaro

unread,
Oct 21, 2020, 2:55:45 PM10/21/20
to Prometheus Users
Hi folks,
I am used to split a few strings in my ansible playbooks, so I thought it would be helpfull in prometheus as well...

Anybody knows how to execute that ?

Sample:
    - alert: Under_Replicated_Partition_Count
      expr: sum(kafka_server_replicamanager_underreplicatedpartitions) by(env,instance) > 0
      for: 1m
      labels:
        severity: critical
        oid: "1.3.6.1.4.1.50495.15.1.2.3.1"
        instance: "{{ $labels.instance|split(':')[0] }}"
      annotations:
        summary: 'Kafka {{ $labels.service_name }}: {{ $value }} under replicated partitons'
        description: 'Under-replicated partitions means that one or more replicas are not available. This is usually because a broker is down.  Restart the broker, and check for errors in the logs.'


Best regards
Jhanssen

Brian Brazil

unread,
Oct 21, 2020, 3:49:33 PM10/21/20
to Jhanssen Fávaro, Prometheus Users
On Wed, 21 Oct 2020 at 19:55, Jhanssen Fávaro <jhansse...@gmail.com> wrote:
Hi folks,
I am used to split a few strings in my ansible playbooks, so I thought it would be helpfull in prometheus as well...

Anybody knows how to execute that ?

You can use reReplaceAll for that.

Brian
 

Sample:
    - alert: Under_Replicated_Partition_Count
      expr: sum(kafka_server_replicamanager_underreplicatedpartitions) by(env,instance) > 0
      for: 1m
      labels:
        severity: critical
        oid: "1.3.6.1.4.1.50495.15.1.2.3.1"
        instance: "{{ $labels.instance|split(':')[0] }}"
      annotations:
        summary: 'Kafka {{ $labels.service_name }}: {{ $value }} under replicated partitons'
        description: 'Under-replicated partitions means that one or more replicas are not available. This is usually because a broker is down.  Restart the broker, and check for errors in the logs.'


Best regards
Jhanssen

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/53e93a3b-9549-4f6d-8e18-a949b657bcd5n%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages