Created
November 4, 2014 18:38
-
-
Save jmherbst/b63fae1d9cb23d638591 to your computer and use it in GitHub Desktop.
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
{ | |
"handlers": { | |
"pagerduty": { | |
"type": "pipe", | |
"mutator": "preserve_pagerduty_alert", | |
"severities": [ | |
"critical", | |
"ok" | |
], | |
} | |
} | |
} |
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
{ | |
"mutators": { | |
"preserve_pagerduty_alert": { | |
"command": "/etc/sensu/mutators/preserve_pagerduty_alert.rb" | |
} | |
} | |
} |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'json' | |
# Read event data | |
event = JSON.parse(STDIN.read) | |
# Modify event action so that certain check alerts do not get resolved automatically via API | |
if event['action'] == 'resolve' && event['check']['no_auto_resolve'] == true | |
event['action'] = 'do_not_resolve' | |
event.merge!('mutated' => true, 'why_mutated' => "Do not resolve alerts!!") | |
end | |
# Output mutated event data to STDOUT for handler to play with | |
puts event.to_json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment