Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

CW automate and Ops genie integration -- script failing

admin@1313
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 22, 2019

Hi Guys,

I have integrated Opsgenie with Automate (labtech) via API Key. i have followed the same step those were told in documentation and imported the script It was working before 4 days. but now script giving error . I don't why  

this is the error when script runs on server . server is exchange server.

Invoke-RestMethod : The request was aborted: Could not create SSL/TLS secure 
channel.
At C:\Windows\system32\config\systemprofile\AppData\Local\9e1cd5b9f46d4e17b9179
fbe197f1909.ps1:36 char:11
+ $result = Invoke-RestMethod -Method "Post" -Uri $uri -Headers $headers -Body
$bo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:Htt
pWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe
ll.Commands.InvokeRestMethodCommand

 

here is the script :-

 

param (
[string]$eu = "False",
[string]$apiKey = "apiKey",
[string]$status = "status",
[string]$clientname = "client",
[string]$computername = "computer",
[string]$locationname = "location",
[string]$fieldname = "field",
[string]$result = "result",
[string]$when = "when",
[string]$contactName = "contact",
[string]$monitorName = "monitor"
)

if($eu -eq "True") {
$uri = "https://api.eu.opsgenie.com/v1/json/integrations/webhooks/connectwiseautomate?apiKey=" + $apiKey;
}
else {
$uri = "https://api.opsgenie.com/v1/json/integrations/webhooks/connectwiseautomate?apiKey=" + $apiKey;
}

$body = ConvertTo-Json @{
status = $status
clientName = $clientname
computerName = $computername
locationName = $locationname
fieldName = $fieldname
result = $result
when = $when
contactName = $contactName
monitorName = $monitorName
}
$headers = [Hashtable] @{
Type = 'application/json'
};
$result = Invoke-RestMethod -Method "Post" -Uri $uri -Headers $headers -Body $body -ContentType 'application/json'
Write-Output $result

 

I have also tried to integrated the CW email integration . email are failing from CW automate to send to ops genie email.

 

Any idea why script is failing ?

Thanks you

1 answer

0 votes
Deleted user August 2, 2019

For anyone still having this issue try adding the following:

[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events