- Table of Contents
- Description
- Global parameter
- Functions:
- Add-OpsGenieAlertAttachment
- Add-OpsGenieAlertDetails
- Add-OpsGenieAlertNote
- Add-OpsGenieAlertResponder
- Add-OpsGenieAlertTag
- Add-OpsGenieAlertTeam
- Close-OpsGenieAlert
- Get-OpsGenieAlert
- Get-OpsGenieAlertAttachment
- Get-OpsGenieAlertNote
- Get-OpsGenieGuidType
- Invoke-OpsGenieAlertAction
- New-OpsGenieAlert
- Remove-OpsGenieAlert
- Remove-OpsGenieAlertAttachment
- Remove-OpsGenieAlertTag
- Set-OpsGenieAlertEscalation
- Set-OpsGenieAlertPriority
- Prerequisites
- Examples
This powershell module will interact with the OpsGenie API v2
more infos about the OpsGenie API is available at https://docs.opsgenie.com/docs
this parameters are accepted in all functions:
| parameter | mandatory | type | description |
|---|---|---|---|
| APIKey | true | string | the APIKey |
| EU | false | switch | use this switch parameter, if you need to connect to the EU-instance of OpsGenie |
| Proxy | false | string | the URI of the proxy server, only if needed |
| ProxyCredential | false | PSCredential | Credentials for the proxy server, only if needed |
to interact with the OpsGenie API, you need an OpsGenie Team and an API Key for the Team-integration
to create the API Key, open OpsGenie and follow this steps:
- click on Teams on the main menu
- select your Team, for which the alerts should be used
- click Integrations
- click Add integration
- select the API integration and click Add
- you will see the API Key in this form
- make adjustments to the permissions and click to Safe Integration.
Note: you can create multiple API-integrations with different API-Keys and different permissions.
you can start with this simple examples. other examples are under each function description.
you can define a HashTable with the connection parameters
$OpsGenieConnection = @{
APIKey = 'only-an-example-key-8e57c630b7ef'
EU = $true
Proxy = 'http://proxy.server.com:8080'
ProxyCredential = $PSCredentialObject
}to create a new alert, use this command
# create an alias to identify the alert later
$alias = ( New-Guid ).Guid
# create the alert
New-OpsGenieAlert @OpsGenieConnection -Message 'this is a Test-Alert' -alias $alias -priority P5you can add additional parameters if needed
Invoke-OpsGenieAlertAction @OpsGenieConnection -alias $alias -action 'acknowledge'Close-OpsGenieAlert @OpsGenieConnection -alias $alias