9 Replies Latest reply on Jul 16, 2014 7:33 AM by juniordev

    Rediscovery via SWIS

    juniordev

      Hi all,

      I wonder how to rediscovery nodes via SWIS. I tried that below code but I got error.

       

                      var swis = new InfoServiceProxy(address, binding, credentials);

                      XmlDocument xdoc = new XmlDocument();

                      XmlElement[] elem = new System.Xml.XmlElement[1];

                      XmlElement xel = xdoc.CreateElement("NetObjectID");

                      xel.InnerText = "N:" + nodeID.ToString();

                      elem[0] = xel;


                      swis.Invoke("Orion.Nodes", "Rediscovery", elem);


      Error: "Verb Orion.Nodes.Rediscovery: Not found"


      Can you help me about this?

        • Re: Rediscovery via SWIS
          Jan Pelousek

          Hello,

          the verb isn't implemented yet. Case refference is 336951 for checking in future. For now the workaround could be to set the NextRediscovery property to some time short after now.

          1 of 1 people found this helpful
            • Re: Rediscovery via SWIS
              juniordev

              Could you please give me any example about this like below code?

               

                              DateTime dt = DateTime.Now.AddSeconds(30);

                              string _nextDiscovery = dt.Year.ToString() + "-" + dt.Month.ToString() + "-" + dt.Day.ToString() + " " + dt.Hour.ToString() + ":" + dt.Minute.ToString() + ":" + dt.Second.ToString() + ".000";

               

                              DictProp.Add("NextRediscovery", _nextDiscovery); //Node Property Dictionary

               

              If I use that code, I got that error. I think because of datetime conversion.

               

              ERROR Create - Error executing create operation: Inverse transforms not implemented.

            • Re: Rediscovery via SWIS
              juniordev

              Have you any idea to change next rediscovery time for any node via SWIS?

                • Re: Re: Rediscovery via SWIS
                  madhavan

                  Hi,

                   

                  You can use client.Update method to update any property. Provided an example below for updating next rediscovery for Orion.Nodes.

                   

                  var properties = new dictionary();
                  properties.Add(new item
                  {
                  key = "NextDiscovery",
                  type = "System.DateTime",
                  value = DateTime.Now.Add(new TimeSpan(1, 1, 0, 0))
                  });

                   

                  client.Update("swis://dev-che-mjag-01./Orion/Orion.Nodes/NodeID=1", properties);

                   

                  Also to know the list of verbs available for an entity, use the below mentioned query in swql studio.

                   

                  SELECT Name, MethodName, CanInvoke, EntityName

                  FROM Metadata.Verb

                  where entityname = 'Orion.Nodes'

                  1 of 1 people found this helpful
                    • Re: Rediscovery via SWIS
                      juniordev

                      Thanks madhavan. I changed succesfully next rediscovery time but that node did not discovery and next rediscovery time was calculate referenced by old discovery time.

                       

                      For example;

                       

                      Now : 10:18 AM

                      First Next Rediscovery : 10:20 AM

                      Normal Next Rediscovery : 10:50 AM

                      Updated Next Rediscovery : 10:22 AM

                      After Update Should Be Rediscovery Time : 10:52 AM

                       

                      But the next rediscovery time after update by SWIS, again, is 10:50 AM. So, I changed next red. time but rediscovery polling interval and time not change. Do you have any idea about that?

                       

                      There is my code.

                       

                       

                       

                                      var properties = new dictionary();

                                      if (timeType.ToUpper() == "DAY")

                                      {

                                          properties.Add(new item

                                          {

                                              key = "NextRediscovery",

                                              type = "System.DateTime",

                                              value = DateTime.Now.Add(new TimeSpan(timeValue, 0, 0, 0))

                                          });

                                      }

                                      else if (timeType.ToUpper() == "HH" || timeType.ToUpper() == "H" || timeType.ToUpper() == "HOUR")

                                      {

                                        ...

                       

                                      client.Update("swis://./Orion/Orion.Nodes/NodeID=" + nodeID.ToString(), properties);

                        • Re: Rediscovery via SWIS
                          madhavan

                          There is a property RediscoveryInterval which you can provide an integer value (Minutes).

                           

                          Say if the current RediscoveryInterval is 30 minutes, if you change it to 40, Rediscovery will happen every 40 minutes.

                            • Re: Rediscovery via SWIS
                              juniordev

                              OK, I know that interval value. But I want to be calculate next rediscovery time by updated next rediscovery time. In my example, interval time is just 30 minutes, after/before update like 10:22->10:52. Rediscovery process works related to "old" next red. time.

                                • Re: Rediscovery via SWIS
                                  madhavan

                                  The next rediscovery is changed based on the rediscovery interval and will be modified only after the next rediscovery happens.

                                   

                                  Example :

                                   

                                  Now :: 4:10 PM

                                  Rediscovery interval Now : 30 mins

                                  Next rediscovery : 4:15 PM

                                   

                                  After Updating Rediscovery interval to 45 mins

                                   

                                  Rediscovery interval : 45 mins

                                  Next rediscovery : 4:15 PM

                                   

                                  After rediscovery at 4:15 PM

                                   

                                  Rediscovery interval : 45 mins

                                  Next rediscovery : 5:00 PM

                                  ------------------------------------------------------------------------

                                  Also Next rediscovery is read only. It displays the time when next rediscovery will take place and modifying it will not affect the underlying scheduler. (SDK allows to edit next rediscovery but the rediscover process will not take place at that time and next rediscovery will not be calculated from that time)