I am used to split a few strings in my ansible playbooks, so I thought it would be helpfull in prometheus as well...
- 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.'