Quantcast
Channel: THWACK: Popular Discussions - Orion SDK
Viewing all articles
Browse latest Browse all 3719

"Proper" way to export/import Alert Configurations via SDK?

$
0
0

Hello,

 

I've been trying the new feature of exporting and importing alerts via the SDK in Powershell, with partial success.

 

For example, the following bit works great:

#Export Alert with ID = 119

$ExportedAlert = Invoke-SwisVerb $swis Orion.AlertConfigurations Export 119

 

#Import Alert from memory, using variable $ExportedAlert

$AlertImportResult = Invoke-SwisVerb $swis Orion.AlertConfigurations Import $ExportedAlert

 

The above works great and imports the memory, but what happens if I want to export an alert to a file and then import it on another Orion? What is the best way to save the contents of $ExportedAlert, and then retrieve them on the other Orion in a formatted way that can be imported?

 

I have tried this:

$AlertImportResult = Invoke-SwisVerb $swis Orion.AlertConfigurations Import 'PathToAlertFileXml'

 

Which failes with error message: Alert import failed with error: Data at the root level is invalid. Line 1, position 1.

 

or

 

[xml]$TestImport = Get-Content 'PathToFile'

$AlertImportResult = Invoke-SwisVerb $swis Orion.AlertConfigurations Import $TestImport

 

Which failed with an actual powershell error.

 

Has anyone mastered the proper way to export and import Alerts from files?


Viewing all articles
Browse latest Browse all 3719

Trending Articles