Docker

Setup your collectors!

Netsil collectors can be run in both containerized as well as non-containerized environments. Only one collector is needed per host (VM or bare metal OS). Please follow the environment specific installation instructions below.

Installation

(Consult Supported Versions and Collector Requirements before installing.)

Run the command below.

docker run -td \
       --name=netsil_collectors \
       --net=host \
       -v /var/run/docker.sock:/var/run/docker.sock:ro \
       -v /proc/:/host/proc/:ro \
       -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
       --cap-add=NET_RAW \
       --cap-add=NET_ADMIN \
       --ulimit core=0 \
       -e DEPLOY_ENV="docker" \
       -e SD_BACKEND="docker" \
       -e SAMPLINGRATE="100" \
       -e NETSIL_SP_HOST=${your_netsil_ip} \
       -e NETSIL_ORGANIZATION_ID=${organizationId} \
       netsil/collectors:latest

or on Amazon Linux:

docker run -td \
       --name=netsil_collectors \
       --net=host \
       -v /var/run/docker.sock:/var/run/docker.sock:ro \
       -v /proc/:/host/proc/:ro \
       -v /cgroup/:/host/sys/fs/cgroup:ro \
       --cap-add=NET_RAW \
       --cap-add=NET_ADMIN \
       --ulimit core=0 \
       -e DEPLOY_ENV="docker" \
       -e SD_BACKEND="docker" \
       -e SAMPLINGRATE="100" \
       -e NETSIL_SP_HOST=${your_netsil_ip} \
       -e NETSIL_ORGANIZATION_ID=${organizationId} \
       netsil/collectors:latest

If you are using the overlayfs storage driver, please install the collectors with the --tmpfs flag as follows:

docker run -td \
       --name=netsil_collectors \
       --net=host \
       --tmpfs /opt/netsil/collectors/run \
       -v /var/run/docker.sock:/var/run/docker.sock:ro \
       -v /proc/:/host/proc/:ro \
       -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
       --cap-add=NET_RAW \
       --cap-add=NET_ADMIN \
       -e DEPLOY_ENV="docker" \
       -e SD_BACKEND="docker" \
       -e SAMPLINGRATE="100" \
       -e NETSIL_NICE_VALUE=15 \
       -e NETSIL_SP_HOST=${your_netsil_ip} \
       -e NETSIL_ORGANIZATION_ID=${organizationId} \
       netsil/collectors:latest

Installing Integrations

Creating and Persisting the Config File

Below, we list some methods of creating the config file such that it will be persisted across container restarts.

If the service you are integrating with is running as a container, its integration likely supports autoconf. Thus, your integrations config file should reside in the /etc/netsil-dd-agent/conf.d/auto_conf directory of your collectors. Also, you should use%%host%% and %%port%% in place of any hardcoded host and port parameters in the config file.

Remember to use the Configuration section from the instructions page for your integration as reference for the name and contents of the config file.

Custom Images

Create a custom container image that derives from the base collector image provided by Netsil. The following is a template Dockerfile:

  # Collectors follow the same versioning scheme as the AOC, replace x.x.x with your AOC version
  FROM netsil/collectors:stable-x.x.x

  # Copy the ".yaml" file(s) at collector build time
  COPY *.yaml /etc/netsil-dd-agent/conf.d/auto_conf

Volume-mounting

Volume-mount the configuration directory from the host, such that the yaml configuration fields can be provided directly on the host file system. You will need to provide the following parameter to the container's run command:

  -v /etc/netsil-dd-agent/conf.d/:/etc/netsil-dd-agent/conf.d/:ro

Running the Integration

After you have persisted the config file, the integration should start automatically when the collector image itself is run.

Checking Configuration

Check to make sure that all yaml files are valid with the following command:

docker exec netsil_collectors /etc/init.d/netsil-collectors configcheck

Checking Runtime

Check to make sure that the integration is running correctly with the following command:

docker exec netsil_collectors /etc/init.d/netsil-collectors info

The output of the info command should contain a section similar to the following:

    Checks
    ======
      [...]
      <name-of-integration>
      ----------
          - instance #0 [OK]
          - Collected 8 metrics & 0 events

Reporting Troubleshooting Information

If you are having issues with your collectors, you can run an inspect command which will gather troubleshooting information about the collectors, as well as any necessary logs. Follow the steps below to do so.

First, run

docker exec netsil_collectors /etc/init.d/netsil-collectors inspect

This will generate a tarball in the /tmp directory whose filename begins with netsil-collectors-inspection. You can obtain this tarball with the following commands

# To get the exact name
docker exec netsil_collectors ls /tmp

# To obtain the tarball
docker cp netsil_collectors:/tmp/<filename-of-inspect-tarball> .

Please send this tarball to us, via email or slack.

Uninstallation

docker rm -f netsil_collectors