4 Replies Latest reply on Aug 25, 2017 9:09 AM by petersjd

    Deploy agents with Chef or Puppet

    LokiR

      Since SAM 6.3 supports installing SolarWinds Orion agents on Linux-based computers, you can use automation technologies like Chef or Puppet to mass deploy them.  The examples show two different scripting methods to deploy agents. These methods are independent of Chef or Puppet and either method can be used to automate your agent installations if it is supported by your automation software. And a special thank you to Toby.

       

      By the way, SolarWinds doesn't support these automation technologies, and the instructions are provided as reference only and assume that your automation software is installed and configured correctly.

       

      Here's what we've got:

       

       

      Deploy an agent with an expect script


      This method uses a Chef cookbook to create and deploy an expect script to target nodes. It contains two parts that must be performed in order.

      Here's the example recipe used in the instructions:

      # Install the swiagent package using the repository
          package 'swiagent'
      # Create a driver to configure the agent
          cookbook_file '/opt/SolarWinds/Agent/bin/driver.ini' do
          source 'driver.ini'
          owner 'swiagent'
          group 'swiagent'
          mode '0755'
          action :create
             end 
      # Start the agent and configure it
      # You only have to start and configure the agent once.
      # Assume that if the swiagent.cfg file exists, the agent is provisioned
          execute 'swiagent init' do
          command 'cat /opt/SolarWinds/Agent/bin/driver.ini | service swiagentd init'
          creates '/opt/SolarWinds/Agent/bin/swiagent.cfg'
        end

       

       

      1. Create a recipe.
        1. Configure the node to use the SolarWinds repository.
        2. Get the package from the repository.
           package 'swiagent'
        3. Create the driver.
          cookbook_file '/opt/SolarWinds/Agent/bin/driver.ini' do
              source 'driver.ini'
              owner 'swiagent'
              group 'swiagent'
              mode '0755'
              action :create
          end
        4. Start and configure the agent.
          execute 'swiagent init' do
              command 'cat /opt/SolarWinds/Agent/bin/driver.ini | service swiagentd init'
              creates '/opt/SolarWinds/Agent/bin/swiagent.cfg'
          end
        5. Save the recipe.
      2. Create a driver.ini file that configures the agent to connect to the poller and use a specific Orion credential.
        2
        IPaddress  

        admin 
        7

      You can apply the cookbook to any Chef registered node that you want to monitor with an Orion agent.

       

      Deploy an agent with a shell script


      This method uses a Puppet manifest to deploy a shell script to target nodes. It contains three parts that must be performed in order on the Puppet master node.

      1. Create a module with an swiagent class.
        class swiagent {
            file { 'swi-driver':
            path => '/tmp/driver.sh',
            ensure  => 'present',
            replace => 'no', # always include this resource declaration
            mode    => '0644',
            source => 'puppet:///modules/swiagent/driver.sh',
            } ->
            exec { 'provision_agent':
            command => 'sh /tmp/driver.sh',
            path    => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin',
            creates => '/opt/SolarWinds/Agent/bin/swiagent.cfg',
            }
        }
      2. Create a driver.sh file located in swiagent/files/.
        1. Click All Settings > Agent Settings > Download Agent Software.
        2. Click Linux, and Next.
        3. Click Manually Install by Downloading Files via URL, and click Next.
        4. Select your Distribution and Communication Mode
        5. Enter the Connection Settings.
        6. Click Generate Command.
        7. Copy this command to the driver.sh file.
          bash -c 'x(){ P=/Orion/AgentManagement/DownloadLinuxOnlineInstallScript.ashx? 
          requestId=eeaeac49-75c7-46bb-83b8-ee22c4924ef1;U=(
          http://host.local:8787/
          http://host:8787 http://[2001:10:110:6:c802:e60b:70ba:7495]:8787 
          http://192.168.10.143:8787);dt(){ D=(wget curl);A=(-O\ -\ --no-check-certificate\ 
          --tries=1\ --read-timeout=30 --insecure\ --retry\ 1); for((i=0;i<${#D[@]};i++));do 
          which ${D[$i]}&>/dev/null&&export DT="${D[$i]} ${A[$i]}"&&return;done;>&2 echo 
          "Cannot find download tool - please install some (${D[*]}) or use other 
          installation method";exit 1;};dt;echo export DT=\"$DT\";>&2 echo; >&2 
          echo -n "Downloading installation data from Orion Poller...";for u in ${U[*]};do 
          echo "export URL=\"$u\""; if ${DT} $u$P 2>/dev/null; then FOUND=1; break; fi; >&2 
          echo -n "."; done; >&2 echo ""; if [ "${FOUND}" != "1" ]; then >&2 echo "Unable to 
          connect to Orion Poller to download agent package. Please use an alternate deployment 
          method, such as Add Node wizard."; >&2 echo "See
          http://www.solarwinds.com/documentation
          /helpLoader.aspx?lang=en&topic=OrionAgentDeployAgentTop"; exit 1; fi; };X=$(x);bash -c "${X}"'
      3. Add to the following to the main manifest for each node you want to monitor with an Orion agent:
        node 'host.local' { 
          include swiagent
          }

      The next time the node pulls its configuration from the master, it evaluates the main manifest and apply the swiagent module.

       

       

      Agent configuration options


      These options may be different than the latest options built into the agent. Log on to the computer with the agent installed on it and type service swiagentd init to ensure that these options match the latest version of the software.

       

      1. Cancel and Exit without Saving
      2. Agent Mode (1 - Agent Initiated, 0 - Server Initiated)  [1]
      3. Orion Poller Hostname/IP  [10.110.6.154]
      4. Orion Poller Port        [17778]
      5. Orion Username            [admin]
      6. Orion Password            []
      7. Proxy Settings...        [mode=disabled]
      8. Save Changes and Exit