Portainer Templates logo

Portainer Templates

Logzio Metrics Collector Logzio Metrics Collector

Container

Tools

Docker Metrics Collector is a container that runs Metricbeat with the modules you enable at runtime.

Image details

Pulls: 695k
Architecture: amd64
Image size: 99 MB
Latest: 0.2.1
User: logzio
Created: Mar 25, 2019
Updated: 5 years ago
Status: active

Source details

Stars: 8
Forks: 8
Language: Python
License: Apache-2.0
Updated: 4 years ago
Status: archived

Configuration

Type
Container
Image
logzio/docker-collector-metrics
Privileged
Yes
Volumes
/var/run/docker.sock : /var/run/docker.sock/hostfs/sys/fs/cgroup : /sys/fs/cgroup/hostfs/proc : /proc/hostfs : /
Env vars
LOGZIO_TOKEN=REPLACE-LOGZIO-TOKEN-HERELOGZIO_MODULES=system,docker

Template by mediadepot

Standalone Install

Select an install method, to see config/commands for deploying Logzio Metrics Collector

Installation method

Install on Portainer

Import all app templates into your Portainer instance, for easy 1-click deploys

  1. Ensure both Docker and Portainer are installed, and up-to-date
  2. Log into your Portainer web UI
  3. Under Settings → App Templates, paste the below URL
  4. Head to Home → App Templates, and the list of apps will show up
  5. Select Logzio Metrics Collector, fill in any config options, and hit Deploy

Template Import URL

https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me demo

More install options in our documentation, or see logzio/docker-collector-metrics for app-specific guidance.

docker-collector-metrics

docker-collector-metrics is a Docker container that uses Metricbeat to collect metrics and forward those metrics to your Logz.io account.
To use this container, you'll set environment variables in your docker run command. docker-collector-metrics uses those environment variables to specify which Metricbeat modules you want to be collected. docker-collector-metrics mounts docker.sock to the container itself, allowing Metricbeat to collect the metrics and metadata.
docker-collector-metrics ships metrics only. If you want to ship logs to Logz.io, see docker-collector-logs.

docker-collector-metrics setup

  1. Pull the Docker image

Download the logzio/docker-collector-metrics image:
docker pull logzio/docker-collector-metrics

  1. Run the container

For a complete list of options, see the parameters below the code block.👇
docker run --name docker-collector-metrics \
--env LOGZIO_TOKEN="<ACCOUNT-TOKEN>" \
--env LOGZIO_URL="<LISTENER-URL>" \
--env LOGZIO_MODULES="<COLLECTED-MODULES>" \
logzio/docker-collector-metrics

Parameters

ParameterDescription
LOGZIOTOKENRequired. Your Logz.io account token. Replace <ACCOUNT-TOKEN> with the token of the account you want to ship to.
LOGZIOURLDefault: listener.logz.io
Logz.io listener URL to ship the metrics to. For more information on finding your account's region, see Account region.
LOGZIOTYPEDefault: docker-collector-metrics
Logz.io type you'll use with this Docker. This is shown in your logs under the type field in Kibana. Logz.io applies parsing based on type.
LOGZIOLOGLEVELDefault: "INFO"
The log level the scripts will use
LOGZIOMODULESRequired The Meatricbeat modules we will use for this container separated by ',' delimiter, formatted as "module1,module2,module3". Current we support these modules: system, docker
If you specify the docker module, you'll have to mounts docker.sock to the container itself by adding -v /var/run/docker.sock:/var/run/docker.sock:ro to the run command.
If you want to use your custom module configurations or use modules that we are yet to support, you need to mount the module files to /logzio/modules
LOGZIOADDITIONALFIELDSinclude additional fields with every message sent, formatted as "fieldName1=fieldValue1;fieldName2=fieldValue2". To use an environment variable, format as "fieldName1=fieldValue1;fieldName2=$ENVVARNAME". In that case, the environment variable should be the only value in the field. If the environment variable can’t be resolved, the field is omitted.

  1. Check Logz.io for your metrics

Run the docker. Give your metrics a few minutes to get from your system to ours, and then open Kibana.

Change log

- 0.0.4:
- Refactor the image to use default Metricbeat yamls.
- 0.0.3: BREAKING CHANGES:
- using beats7
- supporting multiple modules
- 0.0.2: added the ability to set the type to fetched metrics.

Check the logs first

Nine times out of ten the logs tell you exactly what went wrong.

  • In Portainer, go to Containers, click the container, then Logs. Or run docker logs logzio-metrics-collector
  • Exit codes help too: 137 means killed, usually out of memory. 126 or 127 means the command inside the image is broken.

Permission denied on volumes

If the logs show "permission denied", the app can't write to its data folder on the host.

  • Seeing "read-only file system"? /sys/fs/cgroup is mounted read-only on purpose, the app isn't meant to write there.

Can't reach the Docker socket

logzio-metrics-collector talks to Docker through /var/run/docker.sock. If the logs show "permission denied while trying to connect to the Docker daemon socket", the app's user can't access it.

  • Check the socket exists on the host: ls -l /var/run/docker.sock
  • Run the container as root, or add the docker group's id to the container with group_add.

Image won't pull

Test the pull directly on the host: docker pull logzio/docker-collector-metrics

  • "manifest unknown" means the tag no longer exists. This template uses latest, so try pinning a specific version instead.
  • "toomanyrequests" is the Docker Hub rate limit. Log in with docker login to raise it.
  • "no space left on device" means a full disk. Reclaim space with docker system prune

"exec format error"

This means the image was built for a different CPU architecture than your server.

  • This image supports: amd64
  • Check yours with uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.

Privileged mode

This template runs the container in privileged mode, giving it full access to your host.

  • Only deploy it if you trust the app.
  • If deployment is blocked, your Portainer security settings or hardened host may not allow privileged containers.

Upstream project is archived

The developers have archived logzio/docker-collector-metrics, so bugs and security issues won't be fixed.

  • It'll keep working for now, but consider the similar apps below for a maintained alternative.

Raise an issue

Found something which isn't working as it should? Here's how to report it.

A single container

Logzio Metrics Collector runs as one container, the simplest kind of app here. Just the one image to pull and nothing else wired up alongside it.

The app image

An image is the app packed up ready to go, everything Logzio Metrics Collector needs bundled into one download. This template pulls logzio/docker-collector-metrics, which Docker fetches once (about 99 MB) and then starts your own copy from.

Where the image comes from

Docker pulls its images from registries, public libraries of ready-built apps. Logzio Metrics Collector's comes from Docker Hub, published by logzio.

Version tags

The bit after the colon in the image name is the version tag. Here it's latest, which always points at the newest build, so a redeploy can bump you to a newer release without you asking. Newest right now is 0.2.1. Pin a specific tag if you would rather stay on one version.

Which machines it runs on

Every image is built for particular CPU types. This one ships for amd64, so it runs on regular x86 PCs and servers, though not ARM boards like a Raspberry Pi.

Volumes

A volume is where Logzio Metrics Collector keeps its files so they survive an update or a restart. Without one, anything it saves would sit inside the container and vanish the moment it's recreated. This template mounts:

  • /var/run/docker.sock from /var/run/docker.sock on the host, read-only (a socket it talks to, not storage)
  • /hostfs/sys/fs/cgroup from /sys/fs/cgroup on the host, read-only
  • /hostfs/proc from /proc on the host, read-only
  • /hostfs from / on the host, read-only

Environment variables

Environment variables are the settings you hand over when you deploy, things like a password or a timezone. Logzio Metrics Collector takes 2 of them, all with defaults you can leave alone or tweak:

  • LOGZIO_TOKEN, defaults to REPLACE-LOGZIO-TOKEN-HERE
  • LOGZIO_MODULES, defaults to system,docker

Networking

Nothing custom is set, so Logzio Metrics Collector sits on Docker's default bridge network: its own private space that reaches the outside world only through the ports it publishes.

Container name

Once it's deployed, Portainer names the container logzio-metrics-collector. That's what you'll spot in the containers list and use in commands like docker logs logzio-metrics-collector.

Privileged mode

This template runs Logzio Metrics Collector in privileged mode, which gives it nearly as much access to your server as the system itself. Some apps genuinely need it to reach hardware or manage the host, so it's one to run only if you trust the source.

Open source license

Logzio Metrics Collector is open source, released under the Apache-2.0 license. In plain terms the code is out in the open, so you're free to run it and change it to fit what you need.

Portainer app templates

Zooming out, this whole page comes from a Portainer app template: a short recipe telling Portainer how to set Logzio Metrics Collector up. Add the template list to Portainer once, then deploying Logzio Metrics Collector is a click rather than a wall of config.