8 Replies Latest reply on Feb 12, 2013 11:22 AM by alexander937

    SDK to acknowledge alert


      Hello Everyone,


      We are trying to integrate SW with Service-Now and we are trying to use the SDK to acknowledge the alert.  I have a couple of questions for all of you really smart individuals:



      1. Has anyone done this successfully?


      2. Are there any logs on the SW server that would tell us where the interaction is failing?


      3. Has anyone received any assistance from SW regarding the SDK?


      We are paying for a consultant to assist with this and I have no idea where to look on the SW side for help. 





        • Re: SDK to acknowledge alert

          This is the right place to look for SDK assistance.


          I don't have experience with Service-Now specifically, but I can help you with programmatically acknowledging alerts.


          The relevant log file on the SolarWinds side is C:\ProgramData\Solarwinds\InformationService\v3.0\Orion.InformationService.log (or v2.0 if you are connecting to the older endpoint).


          Could you tell us a bit more about your system? What language/runtime are you using for this scripting? Do you have a working script for acknowledging an alert outside of Service-Now (i.e., from the command line) or is that not working yet?

            • Re: SDK to acknowledge alert

              Service Now is using Javascript, which I believe is compiled into Java code to run server side.


              We have written a test script in C# 4.0 as well.  In either case, we've gotten to where we are able to run an SWQL query to collect information on an alert, but when we attempt to acknowledge it, we receive this return, and the alert remains unacknowledged:


              <Return xmlns="http://schemas.datacontract.org/2004/07/SolarWinds.InformationService.Contract">false</Return>


              Basically, we're not sure how to make that "false" say "true", nor where to look to find out what's making it return "false".  The logs at that path contain no relevant info, unfortunately (we just attempted another test, but the last log entry remains one from 9:03 this morning).

                • Re: SDK to acknowledge alert

                  The LogAdjuster program on the Orion server can help you get more details into your logs. I usually set it to DEBUG.




                  If you can share the C# code you are using, I might be able to spot the issue.

                    • Re: SDK to acknowledge alert

                      We tried turning debug logging on, and now there's a lot more log entries... but we still aren't really seeing anything relevant.  Might just not be looking for the right stuff, but we tried searching the log for the source IP, parts of the service name (OrionBasic), etc etc.


                      Here's the relevant parts of the C# code. Pretty much just followed the SDK's example VB code and ported it to C#, but perhaps a mistake was made in that process. If it helps, the "arguments" XmlArgument array near the end ends up (as of now) containing one element, which consists of the following XML:


                      <DefinitionId xmlns="http://schemas.solarwinds.com/2008/Orion">91d3c52c-724e-45db-b7a8-ad3b0f876f97</DefinitionId><ObjectType xmlns="http://schemas.solarwinds.com/2008/Orion">IP SLA QoS</ObjectType><ObjectId xmlns="http://schemas.solarwinds.com/2008/Orion">211</ObjectId>


                      Thanks for your continued assistance.


                      public void sw()


                      InformationServiceClient client = new InformationServiceClient("BasicHttpBinding_InformationService");


                      client.ClientCredentials.UserName.UserName = "***";

                      client.ClientCredentials.UserName.Password = "***";



                      var result = client.QueryXml("SELECT TOP 1 AlertDefID, ActiveObject, ObjectType FROM Orion.AlertStatus WHERE Acknowledged=0 ORDER BY TriggerTimeStamp DESC", null);


                      var element = result.GetElementsByTagName("AlertStatus")[0];


                      var alert = new AlertInfo


                      DefinitionId = element.ChildNodes[0].InnerText,

                      ObjectType = element.ChildNodes[2].InnerText,

                      ObjectId = element.ChildNodes[1].InnerText



                      var dcs = new DataContractSerializer(alert.GetType());

                      var doc = new XmlDocument();

                      using (var writer = doc.CreateNavigator().AppendChild())


                      dcs.WriteObject(writer, alert);



                      XmlElement[] arguments = { doc.DocumentElement };


                      var result2 = client.Invoke("Orion.AlertStatus", "Acknowledge", arguments);


                      Response.Write(result2.OuterXml.Replace("<", "&lt;"));


                      //Response.Write(element.OuterXml.Replace("<", "&lt;"));






                      [DataContract (Name = "AlertInfo", Namespace = "http://schemas.solarwinds.com/2008/Orion")]

                      public class AlertInfo {

                      [DataMember (Order = 1)]

                      public string DefinitionId;


                      [DataMember (Order = 2)]

                      public string ObjectType;


                      [DataMember(Order = 3)]

                      public string ObjectId;


                        • Re: SDK to acknowledge alert

                          The Acknowledge verb expects an array of AlertInfo structs. This is a simple modification to your existing code:


                                      var alerts = new[] {alert};


                                      var dcs = new DataContractSerializer(alerts.GetType());

                                      var doc = new XmlDocument();

                                      using (var writer = doc.CreateNavigator().AppendChild())


                                          dcs.WriteObject(writer, alerts);


                          • Re: SDK to acknowledge alert

                            We're just starting down this road of SW to SN integration.  Would you be willing to share your code (cleansed of any confidential data of course!) with us?  We'd like to leverage the SOAP puts and have been told it is "easy", though that seems like a very relative term.


                            Thanks -- any tidbits would help,