5 Replies Latest reply on Nov 9, 2017 2:48 PM by bbowie

    Managing dev nodes

    nclemons

      So I currently have Chef code (Windows and Linux) that installs the SolarWinds agent and registers the nodes with the Orion server. Right now I've been testing this in the dev environment, but that has a lot of churn. I'm not sure the best way to delete the node from Orion when the VM is being shut down (adding an API delete step?), or if I should be looking at moving to a different model like node discovery... would that properly handle marking nodes as down and then reconfiguring the name/configuration if the IP gets recycled?

       

      This is less of an issue for prod as we don't cycle servers very often there, and it's at predictable times so we can easily add a step to decommission them from Orion as part of the procedure. But dev does have a lot of churn, and we want to be able to test out our monitoring configurations there before prod... without being unnecessarily spammed about nodes going offline because the VMs were terminated. And the devs don't have access to remove nodes from Orion, either, so I can't ask them to clean things up as part of their process.

        • Re: Managing dev nodes
          nclemons

          Any thoughts on this?

            • Re: Managing dev nodes
              mlandman

              Feel free to modify this to suit. It originally had SQL to find multiple nodes with the same name and find the DOWN ones, hence the double sub selects. It is a workable SWIS agent deletion routine...

               

              $nodesToDelete = Get-SwisData $swis 'SELECT Agent.Uri AS AgentUri, Agent.Node.Uri AS NodeUri, Agent.Node.Caption as Name, Agent.node.NodeID as NodeID FROM Orion.AgentManagement.Agent where Agent.Node.NodeID IN 
              (SELECT nodeid FROM Orion.nodes where caption in (SELECT caption FROM Orion.nodes where PUT CONDITIONS HERE) )';
              
              # Are there any?
              if ($nodesToDelete)
              {
                  $msg+= ("{0} INFO: Deleting ATM {1} `n" -f `
                  ((get-date -Format s).Replace("T", " ")), (($nodesToDelete.name | Out-String).Replace("`n", " ")) );
                  write-host $msg
              
              # Remove the Agent listing    
                  for ($i=0; $i -lt $nodesToDelete.Length; $i++)
                  {
                      # Delete the Agent
                      Remove-SwisObject $swis $nodesToDelete[$i].AgentUri
                  }
                  Start-Sleep -Seconds 5;
              
              # Delete the Node object
                  for ($i=0; $i -lt $nodesToDelete.Length; $i++)
                  {
                      # Delete the Node
                      Remove-SwisObject $swis -Uri $nodesToDelete[$i].NodeUri
                  }
              }
              else 
              {
                  $msg+= ("{0} INFO: Can't find any duplicate and DOWN ATMs `n" -f `
                  (((get-date -Format s).Replace("T", " "))) )
              }
              
              
              
              
              
              1 of 1 people found this helpful
            • Re: Managing dev nodes
              bbowie

              nclemons - You can do this via the OrionSDK in a script or as you suggested in an API call.. and that's the route I would take utilizing their REST fuctions. Link here:  REST · solarwinds/OrionSDK Wiki · GitHub