-
-
Save rfairburn/5de0b8ba5714d940a7d3 to your computer and use it in GitHub Desktop.
Pagerduty Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!jinja|yaml|gpg | |
pagerduty_config: | |
pagerduty.subdomain: c2fo | |
pagerduty.api_key: | | |
-----BEGIN PGP MESSAGE----- | |
<snip> | |
-----END PGP MESSAGE----- | |
pagerduty.service_key: | | |
-----BEGIN PGP MESSAGE----- | |
<snip> | |
-----END PGP MESSAGE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set notifications = salt['pillar.get']('pagerduty_notifications', {}) %} | |
{% set service_key = salt['pillar.get']('pagerduty_config:pagerduty.service_key', None) %} | |
{% if notifications and service_key %} | |
{% set details = 'Failed to apply the following states on ' ~ | |
notifications['name'] ~ '-> ' ~ | |
notifications['states']|join(', ') ~ | |
'. You can look up the full details by running the following on the salt-master "salt-run jobs.lookup_jid ' ~ | |
notifications['jid'] ~ '".' %} | |
pagerduty_alert: | |
pagerduty.create_event: | |
- name: Salt error on {{ notifications['name'] }} | |
- details: {{ details|json }} | |
- service_key: {{ service_key }} | |
- profile: pagerduty_config | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment