I am trying to define a template to use without having to create a full ConfigMap within the values.yaml for alert manager since it is such a small template. I saw in a few examples people using template or “text:” as definitions and then define the structure, but I cannot seem to make it work, and I am so fed up. I know it is possible, yet I feel like going in circles. where am I going wrong?
Here are the definitions I have used :
alertmanager:
config:
route:
group_by: ['alertname']
group_wait: 30s
group_interval: 5m
repeat_interval: 12h
receiver: 'test-webhook'
# Default route to capture all alerts
routes:
- receiver: 'test-webhook'
receivers:
- name: 'service-now'
webhook_configs:
- url: 'https://192.168.1.1'
send_resolved: true
http_config:
basic_auth:
username: 'username'
password: 'password'
template: |
<TestMessage>{{ .CommonLabels.message | default "Default Message" }}</TestMessage>
The first one above was utilized after I tested my initial XML template below. I thought the structure of the template was wrong, so I used a basic definition above.
alertmanager:
config:
route:
group_by: ['alertname']
group_wait: 30s
group_interval: 5m
repeat_interval: 12h
receiver: 'test-webhook'
# Default route to capture all alerts
routes:
- receiver: 'test-webhook'
receivers:
- name: 'service-now'
webhook_configs:
- url: 'https://192.168.1.1'
send_resolved: true
http_config:
basic_auth:
username: 'username'
password: 'password'
template: |
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<execute xmlns="http://192.168.1.1/Alert">
<NotificationType>{{ .CommonLabels.notification_type | default "PROBLEM" }}</NotificationType>
</execute>
</Body>
</Envelope>
Each time, prometheus operator complains in the logs of the templating structure, but I see this in other configs: https://prometheus.io/docs/alerting/latest/configuration/#webhook_config