-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat: add support for monospace in pushoverConfig #8018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for monospace in pushoverConfig #8018
Conversation
8dab075 to
e54836d
Compare
slashpai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
probably can wait till Alertmanager v0.29 release
1b46a23 to
f6b74e3
Compare
hi @slashpai I think this can be merged now. thanks |
slashpai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a couple of nits after checking again
| // monospace optional HTML/monospace formatting for the message, see https://pushover.net/api#html | ||
| // html and monospace formatting are mutually exclusive. | ||
| // +optional | ||
| Monospace bool `json:"monospace,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since optional make this as *bool?
I see for HTML as well its bool may be we should update that
cc: @simonpasquier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed both to pointers as suggested.
f6b74e3 to
54b4693
Compare
Signed-off-by: Hélia Barroso <[email protected]>
Signed-off-by: Hélia Barroso <[email protected]>
570e9d5 to
a6f0f7c
Compare
simonpasquier
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! We need to drop invalid AlertmanagerConfigs (e.g. with both monospace and html being true) before we sanitize. It should happen in checkPushoverConfigs().
Signed-off-by: Hélia Barroso <[email protected]>
thanks I added that and also noticed that I've missed the checks in validations, added those as well. |
Signed-off-by: Hélia Barroso <[email protected]>
| HTML bool `json:"html,omitempty"` | ||
| HTML *bool `json:"html,omitempty"` | ||
| // monospace optional HTML/monospace formatting for the message, see https://pushover.net/api#html | ||
| // html and monospace formatting are mutually exclusive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
html and monospace formatting are mutually exclusive.
Should this message be added to the HTML description as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've merged to have the PR in the next release but the comment is valid and we can address in a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, will open as follow up
|
@heliapb This PR broke HTML rendering for me. I upgraded to 0.87.0 and changed none of my configs, now HTML will not render in my notifications. apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
creationTimestamp: "2025-11-01T17:05:04Z"
generation: 3
labels:
kustomize.toolkit.fluxcd.io/name: kube-prometheus-stack
kustomize.toolkit.fluxcd.io/namespace: observability
name: alertmanager
namespace: observability
resourceVersion: "37268901"
uid: 430cb801-8300-466f-addc-b844c14fbfd2
spec:
inhibitRules:
- equal:
- alertname
- namespace
sourceMatch:
- matchType: =
name: severity
value: critical
targetMatch:
- matchType: =
name: severity
value: warning
receivers:
- name: blackhole
- name: buddy-heartbeat
webhookConfigs:
- httpConfig:
bearerTokenSecret:
key: BUDDY_HEARTBEAT_TOKEN
name: alertmanager-secret
urlSecret:
key: BUDDY_HEARTBEAT_URL
name: alertmanager-secret
- name: pushover
pushoverConfigs:
- html: true
message: |-
{{- range .Alerts }}
{{- if ne .Annotations.description "" }}
{{ .Annotations.description }}
{{- else if ne .Annotations.summary "" }}
{{ .Annotations.summary }}
{{- else if ne .Annotations.message "" }}
{{ .Annotations.message }}
{{- else }}
Alert description not available
{{- end }}
{{- if gt (len .Labels.SortedPairs) 0 }}
<small>
{{- range .Labels.SortedPairs }}
<b>{{ .Name }}:</b> {{ .Value }}
{{- end }}
</small>
{{- end }}
{{- end }}
monospace: false
priority: '{{ if eq .Status "firing" }}1{{ else }}0{{ end }}'
sendResolved: true
sound: gamelan
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing
| len }}{{ end }}] {{ .CommonLabels.alertname }}'
token:
key: ALERTMANAGER_PUSHOVER_TOKEN
name: alertmanager-secret
ttl: 86400s
urlTitle: View in Alertmanager
userKey:
key: PUSHOVER_USER_KEY
name: alertmanager-secret
route:
groupBy:
- alertname
- cluster
- job
groupInterval: 5m
groupWait: 1m
receiver: pushover
repeatInterval: 12h
routes:
- matchers:
- matchType: =
name: alertname
value: InfoInhibitor
receiver: blackhole
- groupInterval: 2m
groupWait: 0s
matchers:
- matchType: =
name: alertname
value: Watchdog
receiver: buddy-heartbeat
repeatInterval: 2m30s
- matchers:
- matchType: =
name: severity
value: critical
receiver: pushover |
|
Opened issue #8152 for further discussion |
| URL: in.URL, | ||
| URLTitle: in.URLTitle, | ||
| Priority: in.Priority, | ||
| HTML: in.HTML, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
@onedr0p sorry my bad, I guess I deleted by mistake instead of adding monospace, seen that @simonpasquier already opened a pr with the fix 🙏 |

Description
Add support for monospace in pushoverConfig in alertmanager config, from version 0.29.0 onwards prometheus/alertmanager#4362
Type of change
What type of changes does your code introduce to the Prometheus operator? Put an
xin the box that apply.CHANGE(fix or feature that would cause existing functionality to not work as expected)FEATURE(non-breaking change which adds functionality)BUGFIX(non-breaking change which fixes an issue)ENHANCEMENT(non-breaking change which improves existing functionality)NONE(if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)Verification
Please check the Prometheus-Operator testing guidelines for recommendations about automated tests.
Changelog entry
Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.