Created
August 26, 2014 23:51
-
-
Save julianeon/cc6bb568102e6db614a7 to your computer and use it in GitHub Desktop.
A script that creates an incident using the PagerDuty API.
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 | |
subdomain="CHANGE_THIS" | |
api_key="CHANGE_THIS" | |
incident_key="SORIA82E" | |
endpoint="https://events.pagerduty.com/generic/2010-04-15/create_event.json" | |
service_access_key="a9c73c38e9cf4fa197802c7f2eb25b78" | |
subject="This is a check_cron alert. This service is not running." | |
def curl_command_trigger(token_string,json,endpoint) | |
curl_command='curl -H "Content-type: application/json" -X POST -d '+json+' "'+endpoint+'"' | |
end | |
trigger_json= '\'{ | |
"service_key": "'+service_access_key+'", | |
"event_type": "trigger", | |
"description": "'+subject+'" | |
}\'' | |
curl_string = curl_command_trigger(api_key,trigger_json,endpoint) | |
system(curl_string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment