Table of Contents

Telegraf

Problems

Insufficient lockable memory

If you updated your containered Telegraf instance lately, you may get a warning to increase the lockable memory limit.

2024-08-02T17:08:46Z W! Insufficient lockable memory 64kb when 348kb is required. Please increase the limit for Telegraf in your Operating System!
2024-08-02T17:08:46Z W! Insufficient lockable memory 64kb when 84kb is required. Please increase the limit for Telegraf in your Operating System!
2024-08-02T17:08:46Z W! Insufficient lockable memory 64kb when 228kb is required. Please increase the limit for Telegraf in your Operating System!

:!: This solution doesn't apply to Kubernetes installations because ulimit support is missing.

If you work with a docker compose file, edit your service accordingly. The memlock ulimit has to be set to at least the required size in bytes.

docker-compose.yml
services:
  telegraf:
    image: telegraf:1.31-alpine
    restart: on-failure
    volumes:
      - ./conf/telegraf.conf:/etc/telegraf/telegraf.conf
    env:
      - "INFLUX_TOKEN=d2lraS5kZWZlY3QuY2ggaXMgYXdlc29tZQ=="
    ulimits:
      memlock: 524288

The same configuration for a docker run command.

shell
docker run --restart on-failure -v ./conf/telegraf.conf:/etc/telegraf/telegraf.conf:ro --env INFLUX_TOKEN=d2lraS5kZWZlY3QuY2ggaXMgYXdlc29tZQ== --ulimit memlock=524288 telegraf:1.31-alpine

How to select the correct value? Multiply the required kb size with 1024.

FIXME :!: this could be wrong information. According to the limits.conf(5) man page the expected value is in KB units. ⇒ I have to test this. Maybe my limits are set too high at the moment.

RequiredCalculationmemlock
84kb84*102486016
228kb228*1024233472
348kb348*1024356352
512kb512*1024524288