1 Reply Latest reply on Dec 6, 2013 5:29 PM by broeben

    Determine how Solarwinds could be manipulated for automation

    a1dhingra

       

      Please assist. I will appreciate.

       

      How we could manipulate Solarwinds that would be useful for an automated deploy. This could be a command line interface or an API or anything else that would let us disabled and re-enable Solarwinds monitors without human intervention. More detail will be added as becomes known.

      Please provide a PowerShell/API script or some kind to automate and work in my deploy during production

       

        • Re: Determine how Solarwinds could be manipulated for automation
          broeben

          I don't know about deploys, but I have setup a Powershell script for Windows server patching.   It makes use of the SolarWinds Orion SDK, which is free to download.   I use the below Powershell functions to Unmanage and Manage servers.

           

          #Unmanages remote server in Orion
          Function Unmanage-Servers {
          [cmdletbinding()]
          Param ($computername)

          #Load Orion SWIS Snapin
          Add-PSSnapin SWISSnapin

          #Initialize variables
          $username = '********' #Replace with an Orion SQL username with manage rights
          $password = '********' #Replace with the password of the Orion SQL username
          $hostname = 'orion.domain.com' #Replace with the URL of the Orion server
          $hours = 24

          #Connect to Orion Server
          $swis = Connect-Swis -Username $username -Password $password -Hostname $hostname

          #Change computer name to IP if local computer
          If ($computername -eq $env:computername){
            $computername = (Get-WmiObject -class win32_NetworkAdapterConfiguration -Filter 'ipenabled = "true"').ipaddress[0]
          }

          #Get Node Info
          $nodeid = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE SysName like '$computername' or IP_Address like '$computername'"

          #Unmanage Node
          $now = [DateTime]::UtcNow
          $later = $now.AddHours($hours)
          Invoke-SwisVerb $swis Orion.Nodes Unmanage @("N:$nodeid",$now,$later,"false")
          }

           

          #Manages remote server in Orion
          Function Manage-Servers {
          [cmdletbinding()]
          Param ($computername)

          #Load Orion SWIS Snapin
          Add-PSSnapin SWISSnapin

          #Initialize variables
          $username = '********' #Replace with an Orion SQL username with manage rights
          $password = '********' #Replace with the password of the Orion SQL username
          $hostname = 'orion.domain.com' #Replace with the URL of the Orion server

          #Connect to Orion Server
          $swis = Connect-Swis -Username $username -Password $password -Hostname $hostname

          #Change computer name to IP if local computer
          If ($computername -eq $env:computername){
            $computername = (Get-WmiObject -class win32_NetworkAdapterConfiguration -Filter 'ipenabled = "true"').ipaddress[0]
          }

          #Get Node Info
          $nodeid = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE SysName like '$computername' or IP_Address like '$computername'"

          #Remanage Node
          Invoke-SwisVerb $swis Orion.Nodes Remanage @("N:$nodeid")
          }