Skip to content
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(alerting): custom - replace placeholders in header contents #789

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stendler
Copy link
Contributor

@stendler stendler commented Jun 3, 2024

Summary

This PR allows customizing headers with placeholder contents, e.g., based on ALERT_TRIGGERED_OR_RESOLVED.
Also, implemented ReplacePlaceholder to avoid repeating replace in body, url, and in a loop for the headers.

Example use case customizing ntfy:

alerting:
  custom:
    url: "https://ntfy.sh/mytopic"
    method: POST
    body: |
      Alert for [ENDPOINT_URL] with description:
      [ALERT_DESCRIPTION]
    headers:
      Firebase: "no"
      Title: "[ENDPOINT_GROUP] - [ENDPOINT_NAME]"
      Tags: "[ALERT_TRIGGERED_OR_RESOLVED]"
      Priority: 4
    placeholders:
      ALERT_TRIGGERED_OR_RESOLVED:
        TRIGGERED: "rotating_light"
        RESOLVED: "white_check_mark"
    default-alert:
      failure-threshold: 2
      success-threshold: 3
      send-on-resolved: true

Checklist

  • Tested and/or added tests to validate that the changes work as intended, if applicable.
  • Updated documentation in README.md, if applicable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant