Created
July 2, 2014 20:47
-
-
Save eurica/c20afc0898d3f7be9182 to your computer and use it in GitHub Desktop.
Trigger PagerDuty event
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
Param ( | |
[String]$servicekey, | |
[String]$EventType, | |
[String]$AlertID, | |
[String]$AlertDesc = "No Description provided", | |
[String]$WebLink = "http://www.pagerduty.com/", | |
[String]$AlertName = "No Name provided", | |
[String]$AlertSourceName = "No Source provided" | |
) | |
$details = @{AlertName=$AlertName;AlertSource=$AlertSourceName} | |
$props = @{ | |
service_key=$servicekey; | |
event_type=$EventType; | |
incident_key=$AlertID; | |
description=$AlertDesc; | |
client="OperationsManager"; | |
client_url=$WebLink; | |
details=$details | |
} | |
$json = ConvertTo-Json -InputObject $props | |
Invoke-RestMethod -Method Post -ContentType "application/json" -Body $json -Uri "https://events.pagerduty.com/generic/2010-04-15/create_event.json" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment