This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Deploy Orion Agents within Containers

Estimated Reading Time: 5 minutes

Here at SolarWinds we are constantly ensuring that our deployment capabilities allow you to meet your company's needs. This includes deploying Server & Application Monitor (SAM) to Azure through the marketplace, on a cloud instance (see: Deploy SolarWinds Orion Platform products to Microsoft Azure)  or as described in this document, deploying your Orion agents within containers.

Search for SolarWinds in the Azure Marketplace
pastedImage_3.png

Thanks to the tireless efforts of toby.burton, we are able to share some interesting steps to get you started deploying your Orion agents as containers and dynamically assigning them to an Orion Group that has a SAM application template applied.

Prerequisites

Ensure that you have Docker configured correctly on your Linux distribution of choice.

Ensure that your Orion main polling engine is up, running and upgraded to the latest 2019.4 release Server & Application Monitor (SAM) 2019.4 Is Now Generally Available

This may work for older versions, but the tested configuration for this workflow is SAM and Orion Platform 2019.4.

Ensure that you meet all requirements for using the Orion agent for polling

Download the Agent Package

In order to include the agent in the container, you'll need to download the agent package from Orion. While there are several ways to accomplish this, this approach creates a tarball that contains all required provisioning information.

The following 'create an agent package workflow can differ depending on your Linux distribution and Orion polling engine deployment.

1. Open your SAM web console and navigate to 'All Settings' -> 'Manage Agents'

pastedImage_14.png

2. On this page, you'll see a link to 'Download Agent Software' in the upper right hand corner.

pastedImage_15.png

3. Click through the wizard by selecting 'Unix/Linux'

pastedImage_16.png

4. and then 'Manually Install by Downloading Files via URL'

pastedImage_17.png

5. On the 'Settings & Files/URLS' page, you'll be able to download the necessary tarball.

image2019-11-26_13-32-33.png

6. After downloading this tarball, you'll want to ensure it's downloaded or copied to your Linux server.

Script a Helper Startup Script

On your Linux server, prepare a helper script. I like to use Solar-PuTTY for Windows – Free SSH Download | SolarWinds to manage multiple ssh sessions to my Linux server(s).

start.sh

if [ -d /opt/SolarWinds/Agent ];

then

    /etc/init.d/swiagentd start

else

    cd /tmp/swiagent

    /tmp/swiagent/install.sh

fi

Create the Dockerfile

If you have questions on how to write your Dockerfile, reference their best practices guide: Best practices for writing Dockerfiles | Docker Documentation

DockerFile

FROM ubuntu:18.04

COPY start.sh /tmp

COPY swiagent.tar.gz /tmp

RUN apt-get update && apt-get install -y python curl

RUN bash -c 'mkdir /tmp/swiagent; tar xvfz /tmp/swiagent.tar.gz -C /tmp/swiagent'

CMD /tmp/start.sh && /bin/bash

Build the Docker Image

Use the following command to build your Docker image

sudo docker build -t ubuntu:swiagent .

Start the Container(s)

Use the following commands to start 3 separate container instances

sudo docker run -i -t -d --name container1 --hostname container1 ubuntu:swiagent

sudo docker run -i -t -d --name container2 --hostname container2 ubuntu:swiagent

sudo docker run -i -t -d --name container3 --hostname container3 ubuntu:swiagent

Confirm Container(s) Status

Running sudo docker ps should give you the running status of the 3 containers you've started

user@localhost:~/dockerfiles$ sudo docker ps

CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS               NAMES

b32f7deba71b        ubuntu:swiagent     "/bin/sh -c '/tmp/st…"   About a minute ago   Up About a minute                       container1

3724717162ab        ubuntu:swiagent     "/bin/sh -c '/tmp/st…"   About a minute ago   Up About a minute                       container3

d1d83f9ac34b        ubuntu:swiagent     "/bin/sh -c '/tmp/st…"   9 minutes ago        Up 2 minutes                            container2

At this point if you have any issues, you should refer to Docker's troubleshooting guides to see what may have occurred on your Docker environment. I've included some links below to some troubleshooting guides that are available on Docker's website.

Create the Orion Group

Navigating back to your SAM web console, click 'All Settings' -> 'Manage Groups'

pastedImage_19.png

From here you'll create a dynamic group utilizing a dynamic query.

image2019-11-26_13-16-49.png

In this instance, the dynamic query is identifying the container by its hostname.

image2019-11-26_13-17-20.png

Your group is created and is ready to be assigned a SAM application template.

pastedImage_23.png

Assign / Create SAM Application Template(s)

SAM has hundreds of OOTB application templates (See: Welcome to the SAM Template Reference ) but even better, there is a robust community of systems administrators that have created and contributed templates right here in THWACK. Choose one of the OOTB, community written or your own custom application template to be assigned to the group. As a result, your template will be applied to all members within the group. In this example, this would be applied to all 3 agent containers.

image2019-11-26_15-38-8.png

You now have deployed Orion agents within a container, and started monitoring your applications, security cameras, or whatever you decide to monitor using SAM application templates.

Monitor Docker with SAM

What's next? Well, you have a docker environment, with Orion agents deployed as containers, why not monitor those with SAM too? Did you know that in SAM 6.7.1 we released container monitoring?

pastedImage_35.png

Happy monitoring, and let us know how you're making this workflow work for you. Are you using automation? How did you tailor this workflow for your environment? How can we improve? If there's something you'd like to see make sure you drop in and add a feature request for us here Server & Application Monitor Feature Requests