kapacitor

Estimated reading time: 7 minutes

Kapacitor is an open source framework for processing, monitoring, and alerting on time series data.

GitHub repo: https://github.com/influxdata/influxdata-docker

Library reference

This content is imported from the official Docker Library docs, and is provided by the original uploader. You can view the Docker Store page for this image at https://store.docker.com/images/kapacitor

Supported tags and respective Dockerfile links

Quick reference

Kapacitor

Kapacitor is an open source data processing engine written in Go. It can process both stream and batch data.

Kapacitor Official Documentation

logo

Using this image

Using the default configuration

Start the Kapacitor container with default options:

$ docker run -p 9092:9092 kapacitor

Start the Kapacitor container sharing the data directory with the host:

$ docker run -p 9092:9092 \
      -v $PWD:/var/lib/kapacitor \
      kapacitor

Modify $PWD to the directory where you want to store data associated with the Kapacitor container.

You can also have Docker control the volume mountpoint by using a named volume.

$ docker run -p 9092:9092 \
      -v kapacitor:/var/lib/kapacitor \
      kapacitor

Configuration

Kapacitor can be either configured from a config file or using environment variables. To mount a configuration file and use it with the server, you can use this command:

Generate the default configuration file:

$ docker run --rm kapacitor kapacitord config > kapacitor.conf

Modify the default configuration, which will now be available under $PWD. Then start the Kapacitor container.

$ docker run -p 9092:9092 \
      -v $PWD/kapacitor.conf:/etc/kapacitor/kapacitor.conf:ro \
      kapacitor

Modify $PWD to the directory where you want to store the configuration file.

For environment variables, the format is KAPACITOR_$SECTION_$NAME. All dashes (-) are replaced with underscores (_). If the variable isn’t in a section, then omit that part. If the config section is an array, use a number to set the nth value in the configuration file.

Examples:

KAPACITOR_HOSTNAME=kapacitor
KAPACITOR_LOGGING_LEVEL=INFO
KAPACITOR_REPORTING_ENABLED=false
KAPACITOR_INFLUXDB_0_URLS_0=http://influxdb:8086

Find more about configuring Kapacitor here

Exposed Ports

  • 9092 TCP – HTTP API endpoint

Subscriptions

Subscriptions allow InfluxDB to push data to Kapacitor for faster alerting instead of requiring Kapacitor to pull data from InfluxDB.

These examples assume you are using a custom configuration file that takes advantage of Docker’s built-in service discovery capability. In order to do so, we’ll first create a new network:

$ docker network create influxdb

Next, we’ll start our InfluxDB container named influxdb:

$ docker run -d --name=influxdb \
      --net=influxdb \
      influxdb

Start the Kapacitor container with the container hostname matching the container name so Kapacitor can automatically create subscriptions correctly and with the KAPACITOR_INFLUXDB_0_URLS_0 value set to point at InfluxDB.

$ docker run -p 9092:9092 \
    --name=kapacitor \
    -h kapacitor \
    --net=influxdb \
    -e KAPACITOR_INFLUXDB_0_URLS_0=http://influxdb:8086 \
    kapacitor

You can also start Kapacitor sharing the same network interface of the InfluxDB container. If you do this, Docker will act as if both processes were being run on the same machine.

$ docker run -p 9092:9092 \
      --name=kapacitor \
      --net=container:influxdb \
      kapacitor

When run like this, InfluxDB can be communicated with over localhost.

CLI / SHELL

Start the container:

$ docker run --name=kapacitor -d -p 9092:9092 kapacitor

Run another container linked to the kapacitor container for using the client. Set the env KAPACITOR_URL so the client knows how to connect to Kapacitor. Mount in your current directory for accessing TICKscript files.

$ docker run --rm --net=container:kapacitor \
      -v $PWD:/root -w=/root -it \
      kapacitor bash -l

Then, from within the container, you can use the kapacitor command to interact with the daemon.

See this for a more detailed getting started guide with Kapacitor.

Image Variants

The kapacitor images come in many flavors, each designed for a specific use case.

kapacitor:<version>

This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.

kapacitor:alpine

This image is based on the popular Alpine Linux project, available in the alpine official image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.

This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn’t have an issue with this, so this variant is usually a very safe choice. See this Hacker News comment thread for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.

To minimize image size, it’s uncommon for additional related tools (such as git or bash) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the alpine image description for examples of how to install packages if you are unfamiliar).

License

View license information for the software contained in this image.

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

Some additional license information which was able to be auto-detected might be found in the repo-info repository’s kapacitor/ directory.

As for any pre-built image usage, it is the image user’s responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

library, sample, kapacitor