2 Replies Latest reply on Apr 18, 2013 4:12 AM by juniordev

    Create container / subcontainer via SWIS

    juniordev

      Hello,

      I am developing an application to create container and subcontainer at .Net/C#. There is no problem creating container (group) and subcontainer (subgroup) via SolarWinds web interface as you see attached file "correct_container_structure.jpg" and "correct_container_structure_SQL.jpg". But if I want to add/create container/subcontainer, there is weird situation as you see attached file "wrong_container_structure.jpg" and "wrong_container_structure_SQL.jpg".

       

      I want to create just only one main container and two container related that one. That is container uri code block I used to create main and sub container.

       

      Main: "filter:/Orion.Groups[(Name ='" + cont.name + "_LAN' OR Name ='" + cont.name + "_WAN')]";

      Sub 1 : "filter:/Orion.Nodes[IP_Address='" + LanIP + "' AND ObjectSubType='ICMP']";

      Sub 2 : "filter:/Orion.Nodes[IP_Address='" + LanIP + "' AND ObjectSubType='SNMP']";

       

      If I understand corrcetly, the problem is Definition section at ContainerMemberDefinitions when using SWIS. Can you any suggest that what I do for obtaining "correct container structure"?

       

      (PS: There is code sample I using on this application. : http://thwack.solarwinds.com/thread/54138 )

        • Re: Create container / subcontainer via SWIS
          derhally

          Can you clarify what is wrong?

           

          In the container structure it shows you have Container ID 330 with two sub containers 328 and 329.  

           

          Can you post your code?

            • Re: Create container / subcontainer via SWIS
              juniordev

              I found the solution. I just want to create subcontainer. I was creating via dynamic query. I found the static Container ID method. There is difference at MemberDefinitionInfo property section:

               

              // cont : Container Object.

               

                          if (type == 1 || type == 2)

                          {

                              memberDefinition = new MemberDefinitionInfo

                              {

                                 Definition = cont.uri, // Dynamic Query

                                  Name = cont.displayName,

                              };

                          }

                          else

                          {

                              memberDefinition_LAN = new MemberDefinitionInfo

                              {

                                  Definition = "swis://./Orion/Orion.Groups/ContainerID=" + contID[0],

                                  Name = cont.displayName,

                              };

               

               

                              memberDefinition_WAN = new MemberDefinitionInfo

                              {

                                  Definition = "swis://./Orion/Orion.Groups/ContainerID=" + contID[1],

                                  Name = cont.displayName,

                              };

               

               

                          }