Skip to content
Docker and Kubernetes assets for running SolarWinds Snap Agent
Branch: master
Clone or download
Pull request Compare This branch is 3 commits ahead, 1 commit behind appoptics:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
conf
Dockerfile Add solarwinds to root group, enable support for default statsd task … Mar 8, 2019
LICENSE License file Jun 2, 2018
Makefile Add solarwinds to root group, enable support for default statsd task … Mar 8, 2019
README.md
kubernetes-appoptics-dashboard.png
swisnap-agent-daemonset.yaml Add solarwinds to root group, enable support for default statsd task … Mar 8, 2019
swisnap-agent-deployment.yaml Add solarwinds to root group, enable support for default statsd task … Mar 8, 2019
swisnap-agent-serviceaccount.yaml Rebrand appoptics-agent-docker to swisnap-agent-docker (AO-11852) (#1) Feb 28, 2019

README.md

solarwinds-snap-agent-docker

Docker and Kubernetes assets for running SolarWinds Snap Agent

About

Use the containerized SolarWinds Snap Agent to monitor Docker or Kubernetes environments. Monitor Kubernetes cluster and application health. Aggregate metrics across clusters distributed across multiple data centers and cloud providers. Track pods, deployments, services and more with Kubernetes-integrated service discovery.

Kubernetes assets:

  • Deployment - A single pod to talk to the Kubernetes API to send Kubernetes specific metrics to AppOptics.
  • DaemonSet - A DaemonSet that runs a pod on every node in your cluster and publishes HostAgent and Docker metrics to AppOptics.

A typical cluster will utilize both the Deployment and DaemonSet assets.

Alternatively, you can deploy the containerized agent in a sidecar to run the other AppOptics Integrations and monitor your Kubernetes applications running in the same Pod.

Installation

Deployment

If you're using RBAC on your Kubernetes cluster you'll need to deploy the Service Account first so that the agent can talk to your Kubernetes API:

kubectl apply -f swisnap-agent-serviceaccount.yaml

To deploy the Deployment to Kubernetes, update the APPOPTICS_TOKEN environment variable in swisnap-agent-deployment.yaml and run:

kubectl apply -f swisnap-agent-deployment.yaml

Enable the Kubernetes plugin in the AppOptics UI and you should start seeing data trickle in.

DaemonSet

To deploy the DaemonSet to Kubernetes, update the APPOPTICS_TOKEN environment variable in swisnap-agent-daemonset.yaml and run:

kubectl apply -f swisnap-agent-daemonset.yaml

Enable the Docker plugin in the AppOptics UI and you should start seeing data trickle in.

Sidecar

Docker

If you wanted to run containerized SolarWinds Snap Agent with custom taskfiles, you can use following snippets:

docker run -d -e APPOPTICS_TOKEN=token \
           -v my_custom_statsd.yaml:/opt/SolarWinds/Snap/etc/plugins.d/statsd.yaml \
           --name swisnap-agent
           solarwinds/solarwinds-snap-agent-docker:1.1.0

or using docker-compose:

version: '3'
services:
  swisnap:
    image: solarwinds/solarwinds-snap-agent-docker:1.1.0
    hostname: swisnap-agent
    container_name: swisnap-agent
    volumes:
      - /path/to/my_custom_statsd.yaml:/opt/SolarWinds/Snap/etc/plugins.d/statsd.yaml
    environment:
      - APPOPTICS_TOKEN=token

Kubernetes

If you wanted to run this on Kubernetes as a sidecar for monitoring specific services, you can follow the instructions below which use Zookeeper as an example.

Add a second container to your deployment YAML underneath spec.template.spec.containers and the agent should now have access to your service over localhost:

- name: zookeeper-ao-sidecar
  image: 'solarwinds/solarwinds-snap-agent-docker:x.x.x'
  env:
    - name: APPOPTICS_TOKEN
      value: APPOPTICS_TOKEN
    - name: SWISNAP_ENABLE_ZOOKEEPER
      value: 'true'
    - name: SWISNAP_DISABLE_HOSTAGENT
      value: 'true'

Configuration

Custom plugins configuration and tasks manifests

Host Agent image is using default plugins configuration files and tasks manifests. In order to use your own configuration you would have to create Kubernetes configMap. In this example we'll set up two configMaps, one for plugins and second for tasks.

# create plugins configMap
kubectl create configmap plugin-configs --from-file=/path/to/my/plugins.d/ --namespace=kube-system

# create tasks configMap
kubectl create configmap task-manifests --from-file=/path/to/my/tasks.d/ --namespace=kube-system

# check if everything is fine
kubectl describe configmaps plugin-configs task-manifests

Now we are ready to inject these configMaps to either daemonset or deployment. Let's do this on swisnap-agent-deployment.yaml:

22a23,27
>           volumeMounts:
>             - name: plugins-vol
>               mountPath: /opt/SolarWinds/Snap/etc/plugins.d
>             - name: tasks-vol
>               mountPath: /opt/SolarWinds/Snap/etc/tasks.d
32,33c37,38
<             - name: SWISNAP_ENABLE_KUBERNETES
<               value: 'true'
---
>             - name: SWISNAP_ENABLE_KUBERNETES # turn off default plugin configuration
>               value: 'false'
52a58,70
>       volumes:
>         - name: plugins-vol
>           configMap:
>             name: plugin-configs
>             items:
>               - key: kubernetes.yaml
>                 path: kubernetes.yaml
>         - name: tasks-vol
>           configMap:
>             name: task-manifests
>             items:
>               - key: task-aokubernetes.yaml
>                 path: task-aokubernetes.yaml
58d75

Notice that we're not utilizing Environment Parameters to turn on Kubernetes plugin. After editing deployment manifest it's time to create it - follow the steps in Installation.

Environment Parameters

The following environment parameters are available:

Parameter Description
APPOPTICS_CUSTOM_TAGS Set this to a comma separated K=V list to enable custom tags eg. NAME=TEST,IS_PRODUCTION=false,VERSION=5
APPOPTICS_TOKEN Your AppOptics token. This parameter is required.
APPOPTICS_HOSTNAME This value overrides the hostname tagged for default host metrics. The DaemonSet uses this to override with Node name.
LOG_LEVEL Expected value: DEBUG, INFO, WARN, ERROR or FATAL. Default value is WARN.
SWISNAP_DISABLE_HOSTAGENT Set this to true to disable the Host Agent system metrics collection.
SWISNAP_ENABLE_DOCKER Set this to true to enable the Docker plugin.
SWISNAP_ENABLE_APACHE Set this to true to enable the Apache plugin.
SWISNAP_ENABLE_ELASTICSEARCH Set this to true to enable the Elasticsearch plugin.
SWISNAP_ENABLE_KUBERNETES Set this to true to enable the Kubernetes plugin. Enabling this option on the DaemonSet will cause replication of Kubernetes metrics where the replication count is the number of pods with Kubernetes collection enabled minus one. Typically Kubernetes collection is only enabled on the Deployment asset.
SWISNAP_ENABLE_MESOS Set this to true to enable the Mesos plugin.
SWISNAP_ENABLE_MONGODB Set this to true to enable the MongoDB plugin.
SWISNAP_ENABLE_RABBITMQ Set this to true to enable the RabbitMQ plugin.
SWISNAP_ENABLE_STATSD Set this to true to enable the Statsd plugin.
SWISNAP_ENABLE_ZOOKEEPER Set this to true to enable the Zookeeper plugin.
SWISNAP_ENABLE_MYSQL Set this to true to enable the MySQL plugin. If enabled the following ENV vars are required to be set as well: MYSQL_USER, MYSQL_PASS, MYSQL_HOST & MYSQL_PORT

If you use SWISNAP_ENABLE_<plugin_name> set to true, then keep in mind that AppOptics Host Agent will use default plugins configs and task manifests. For custom configuration see Custom plugins configuration and tasks manifests.

Dashboard

Successful deployments will report metrics in the AppOptics Kubernetes Dashboard.

Development

The included Kubernetes resources rely on a Docker image from Docker Hub, see the Dockerfile for more details. You can build and push this by updating the tag in the Makefile and running:

make build-and-release-docker
You can’t perform that action at this time.