diff --git a/scom/opsgenie.ps1 b/scom/opsgenie.ps1 index 2221935..5783cf6 100644 --- a/scom/opsgenie.ps1 +++ b/scom/opsgenie.ps1 @@ -103,7 +103,7 @@ $params = @{ alertId = $AlertID alertName = if($alert.Name) {$alert.Name} else {"Not Present"} alertDescription = if($alert.Description) {$alert.Description} else {"Not Present"} - resolutionState = if($alert.ResolutionState -eq 0) {"New"} elseif($alert.ResolutionState -eq 255) {"Closed"} else {"Not Present"} + resolutionState = if($alert.ResolutionState -eq 0) {"New"} elseif($alert.ResolutionState -eq 255) {"Closed"} elseif($alert.ResolutionState) {$alert.ResolutionState.ToString()} else {"Not Present"} resolutionStateLastModified = if($alert.TimeResolutionStateLastModified) {$alert.TimeResolutionStateLastModified.ToString()} else {"Not Present"} priority = if($alert.Priority) {$alert.Priority.ToString()} else {"Not Present"} owner = if($alert.Owner) {$alert.Owner} else {"Not Present"} @@ -135,7 +135,7 @@ $params = @{ if ($params.resolutionstate -match "Not Present"){ - if ($enableLogging){Add-OpsgenieIntegrationLogEntry -logLevel "WARNING" -logMessage "The following SCOM alert $($alert.id) will not be sent to Opsgenie as it does not contain resolutionState `"New`" or `"Closed`"."} + if ($enableLogging){Add-OpsgenieIntegrationLogEntry -logLevel "WARNING" -logMessage "The following SCOM alert $($alert.id) will not be sent to Opsgenie as it does not contain a resolutionState."} } else { $json = ConvertTo-Json -InputObject $params @@ -150,4 +150,4 @@ else { if ($enableLogging){Add-OpsgenieIntegrationLogEntry -logLevel "ERROR" -logMessage "Opsgenie intergration script has failed to POST SCOM alert details to the Opsgenie API: Exception Type='$($_.Exception.GetType().FullName)',Exception Message='$($_.Exception.Message)'"} } } -write-output $IntegrationLogEntry | Out-File $logfile -Append \ No newline at end of file +write-output $IntegrationLogEntry | Out-File $logfile -Append