You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Can someone provide an example of the OEC json configuration and the powershell method to capture the globalargs passed?
Here are some instructions on how to handle OEC payload in Powershell:
The environment this was tested in is Windows 2012 and above… Powershell 3 and above.
Starting at linerps 1 of your PowerShell script you should define the parameters that PowerShell is expected to receive from OEC, these are payload, apiKey, opsgenieUrl, and logLevel.
param([string]$payload,
[string]$apiKey,
[string]$opsgenieUrl,
[string]$logLevel)
Once the parameters have been defined you need to convert the payload from JSON to a Powershell object.
$payloadPsObj = $payload | ConvertFrom-Json
Now you can call your data like this, to get the payload data you can use $payloadPsObj.<Namespace or array index>, for example, the below will get you the alertId from the payload:
$alertDetails = $payloadPsObj.alert
$alertId = $alertDetails.alertId
echo $alertId
The full final script should look like this:
param([string]$payload,
[string]$apiKey,
[string]$opsgenieUrl,
[string]$logLevel)
$payloadPsObj = $payload | ConvertFrom-Json
$alertDetails = $payloadPsObj.alert
$alertId = $alertDetails.alertId
echo $alertId
Thanks,
Connor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.