This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

importing xml alerts - where can I get AlertRefID?

So there is <AlertRefID>74913425-d003-4b48-bcb0-96a049f31ca6</AlertRefID> at the top of exported xml. I fixed some parameters and want to import it as new alert. If I use the same AlertRefID, I got error. Also I got error if I leave this Ref blank. How can I generate a valid AlertRefId to import several alerts? I have ~50 alerts to import.

  • https://thwack.solarwinds.com/t5/Orion-SDK-Documents/Full-Orion-alert-rule-export-using-Powershell-and-OrionSDK/tac-p/601341#M275 If you get it working please post your solution. I am also trying to export/import alerts from an old system to a new one. Thanks in advance.
  • Unfortunately there is no answer yet.

  • I tried to import it with SDK and got the same error:

    Alert import failed with error: Object reference not set to an instance of an object

  • Have you tried creating a new GUID value type for each alert?

  • Hi, Tony

    What do you mean by GUID value type? Where I can find it and how to generate?
    There is no GUID or something like that in XML. If you mean AlertRefID, - yes I try to generate* new ID, nothing changes.

    * I generate it with random, because couldn't find any info about how to generate it right. 

  • You need not generate a unique AlertRefID. It'll create one for you when you import it, no matter what's in the XML you're importing. Are you getting an error that prompted this question?

  • Hi, Steven. Yes, I'm getting There was an error while importing alert from 1029_455.xml. Please check OrionWeb.log for more details error message. So OrionWeb.log contain this message: 2020-08-17 13:42:59,985 [516] (1462) ERROR NewAlertingService - (null) Failed to import alert from 1029_455.xml! Migration message: Alert import failed with error: Object reference not set to an instance of an object.

  • I have had some time to look at this further, as   correctly states there is no need to generate any new GUIDs. I have been able to export an alert definition and import to a separate target platform by doing the following

    • Copying the returned XML from the EXPORT verb using False for stripSensitiveData and leaving protectionPassword blank.
    • Removing the <Return xmlns="http://schemas.datacontract.org/2004/07/SolarWinds.InformationService.Contract">and closing </Return> tags.
    • Invoke the import verb providing the resultant XML, False for stripSensitiveData and leaving protectionPassword blank.

    XML Used

    <AlertDefinition xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Alerting.Models"><AlertID>189</AlertID><AlertMessage>${N=Alerting;M=AlertName} was triggered.</AlertMessage><AlertRefID>31edf5b0-37d7-49b9-a7c3-7ac30b6149fd</AlertRefID><Canned>false</Canned><Category /><CreatedBy>Admin</CreatedBy><CustomProperties xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><d2p1:KeyValueOfstringanyType><d2p1:Key>ResponsibleTeam</d2p1:Key><d2p1:Value xmlns:d4p1="http://schemas.datacontract.org/2004/07/System" i:type="d4p1:DBNull" /></d2p1:KeyValueOfstringanyType></CustomProperties><Description /><Enabled>true</Enabled><ExecutionTimePeriods xmlns:d2p1="http://schemas.solarwinds.com/2008/Core" /><Frequency>PT1M</Frequency><LastEdit>2020-08-17T15:05:18.9566667Z</LastEdit><Name>TestExportImport</Name><NotificationEnabled>true</NotificationEnabled><NotificationSettings xmlns:d2p1="http://schemas.solarwinds.com/2008/Core"><d2p1:Enabled>true</d2p1:Enabled><d2p1:NetObjectType>Node</d2p1:NetObjectType><d2p1:Severity>Critical</d2p1:Severity><d2p1:Subject>TestExportImport</d2p1:Subject><d2p1:_properties xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><d3p1:KeyValueOfstringAlertNotificationProperty9sQWCBBt><d3p1:Key>IP Address</d3p1:Key><d3p1:Value><d2p1:Name>IP Address</d2p1:Name><d2p1:Value>${IP_Address}</d2p1:Value></d3p1:Value></d3p1:KeyValueOfstringAlertNotificationProperty9sQWCBBt><d3p1:KeyValueOfstringAlertNotificationProperty9sQWCBBt><d3p1:Key>Object Sub Type</d3p1:Key><d3p1:Value><d2p1:Name>Object Sub Type</d2p1:Name><d2p1:Value>${ObjectSubType}</d2p1:Value></d3p1:Value></d3p1:KeyValueOfstringAlertNotificationProperty9sQWCBBt><d3p1:KeyValueOfstringAlertNotificationProperty9sQWCBBt><d3p1:Key>Status Description</d3p1:Key><d3p1:Value><d2p1:Name>Status Description</d2p1:Name><d2p1:Value>${StatusDescription}</d2p1:Value></d3p1:Value></d3p1:KeyValueOfstringAlertNotificationProperty9sQWCBBt><d3p1:KeyValueOfstringAlertNotificationProperty9sQWCBBt><d3p1:Key>Node Name</d3p1:Key><d3p1:Value><d2p1:Name>Node Name</d2p1:Name><d2p1:Value>${SysName}</d2p1:Value></d3p1:Value></d3p1:KeyValueOfstringAlertNotificationProperty9sQWCBBt><d3p1:KeyValueOfstringAlertNotificationProperty9sQWCBBt><d3p1:Key>Vendor</d3p1:Key><d3p1:Value><d2p1:Name>Vendor</d2p1:Name><d2p1:Value>${Vendor}</d2p1:Value></d3p1:Value></d3p1:KeyValueOfstringAlertNotificationProperty9sQWCBBt></d2p1:_properties></NotificationSettings><ObjectType>Node</ObjectType><Reset><Conditions><ConditionChainItem><AndThenTimeInterval i:nil="true" /><ChainType>ResetInverseToTrigger</ChainType><Condition xmlns:d5p1="http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Alerting" i:nil="true" /><ConjunctionOperator>None</ConjunctionOperator><IsInvertedMinCountThreshold>false</IsInvertedMinCountThreshold><NetObjectsMinCountThreshold i:nil="true" /><ObjectType i:nil="true" /><SustainTime i:nil="true" /><Type i:nil="true" /></ConditionChainItem></Conditions></Reset><ResetActions xmlns:d2p1="http://schemas.solarwinds.com/2008/Orion" /><Severity>Critical</Severity><Trigger><Conditions><ConditionChainItem><AndThenTimeInterval i:nil="true" /><ChainType>Trigger</ChainType><Condition xmlns:d5p1="http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Alerting" xmlns:d5p2="http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Alerting.Plugins.Conditions.Dynamic" i:type="d5p2:AlertConditionDynamic"><d5p2:ExprTree><d5p1:Child><d5p1:Expr><d5p1:Child><d5p1:Expr><d5p1:Child i:nil="true" /><d5p1:NodeType>Field</d5p1:NodeType><d5p1:Value>Orion.Nodes|Category</d5p1:Value></d5p1:Expr><d5p1:Expr><d5p1:Child i:nil="true" /><d5p1:NodeType>Constant</d5p1:NodeType><d5p1:Value>0</d5p1:Value></d5p1:Expr></d5p1:Child><d5p1:NodeType>Operator</d5p1:NodeType><d5p1:Value>=</d5p1:Value></d5p1:Expr></d5p1:Child><d5p1:NodeType>Operator</d5p1:NodeType><d5p1:Value>AND</d5p1:Value></d5p2:ExprTree><d5p2:Scope i:nil="true" /><d5p2:TimeWindow i:nil="true" /></Condition><ConjunctionOperator>None</ConjunctionOperator><IsInvertedMinCountThreshold>false</IsInvertedMinCountThreshold><NetObjectsMinCountThreshold i:nil="true" /><ObjectType>Node</ObjectType><SustainTime i:nil="true" /><Type xmlns:d5p1="http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Alerting.Plugins.Conditions.Dynamic" i:type="d5p1:ConditionTypeDynamic" /></ConditionChainItem></Conditions></Trigger><TriggerActions xmlns:d2p1="http://schemas.solarwinds.com/2008/Orion" /><Uri>swis://AUS-VSR-PMG-081./Orion/Orion.AlertConfigurations/AlertID=189</Uri></AlertDefinition>
  • Hi, Tony. We had a webex session with Steven and concluded this is not an API issue.
    If I try export/import this alert alert with Orion Web, I get the same error and If I import an alert with simple conditions, it successfully imported.

    I will do some additional tests with trigger and reset conditions and let you know.