- PowerShell 5.0 or later
- .NET 3.5 or later
- Windows 8 or later
Get Opsgenie alerts with PowerShell script using REST API. With the build in config file, the script has flexibility to get whatever you need. Chose automatic refresh period, write custom query, sound alarm, alerts limit, etc.
Here are the key features of the script. It’s a simple and elegant solution to have a full featured monitoring dashboard.
- Trigger sound alarm for new alerts with specific priorities.
- Sort entries by specific column. ALT + <first letter from column name>
- Press F1 to get the full manual.
To run the script without modifying the execution policy, simply execute batch file ‘Get-OpsgenieAlerts.bat‘. It will prompt to run the script as administrator.
Following values in config ‘Config.ini’ file must be changed prior to execution.
Address = mycompany.eu.opsgenie.com Api = api.opsgenie.com GenieKey = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Replace ‘mycompany‘ with the actual business name.
Get a valid ‘GenieKey‘ from your administrator or supervisor.
If the company is located in Europe, then the format of Opsgenie address and REST API is:
Address = mycompany.app.eu.opsgenie.com Api = api.eu.opsgenie.com
Play notification alarm for new alert with priority P1 and P2:
Alarm = P1, P2
Refresh the dashboard on every 3 minutes The value is expressed in seconds:
Refresh = 180
Get up to 200 alerts in the dashboard. It’s mandatory to set a limit to avoid API overload.
Limit = 200
Timeout in milliseconds between queries if there are over 100+ alerts. Required to avoid rejections from application server.
Timeout = 1000
Specify query filter. Example how to fetch alerts in status opened, not acknowledged, priority P1 and P2.
Query = status:open AND acknowledged:false AND priority>P3
To filter alerts for team ‘my-support’, add in the query ‘responders:my-support’.
For alerts in New Relic only, add in the query ‘integration.type:NewRelicV2’.
Query = status:open AND acknowledged:false AND integration.type:NewRelicV2 AND responders:my-support AND priority>P3