influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.67k stars 5.59k forks source link

telegraf hangs when generating config in nspawn container #15575

Closed FlashSystems closed 4 months ago

FlashSystems commented 4 months ago

Relevant telegraf.conf

No telegraf.conf available, because create config should generate it.

Logs from Telegraf

The create config command does not output any logs.

System info

Telegraf 1.31 on Arch Linux

Docker

No response

Steps to reproduce

The problem can be reproduced by creating a minimal container, copying telegraf into it and running systemd-nspawn -D ~/teletest bin/telegraf config create.

Expected behavior

The create config command should output the config and not hang.

Actual behavior

I'm building the telegraf package for Arch Linux in a clean chroot using a systemd nspawn container. Version 1.31 hangs when telegraf config create is called from within a nspawn container. I think it's kind of a regression of bug #12403 because adding --capability=CAP_IPC_LOCK to the systemd-nspawn command line also resolves this issue. I bisected the problem, and it was introduced by commit f674099.

Additional info

No response

powersj commented 4 months ago

Hi,

adding --capability=CAP_IPC_LOCK to the systemd-nspawn command line also resolves this issue

This is the solution when running in a systemd nspawn container. Telegraf needs that capability to correctly run due to the secret store library used to securely store secrets. It seems that PR you identified added support to SNMP which imported the library earlier and made you run into this.

We are not removing the dependency on the library, so I'm not sure we can make any change here. Closing, but if I've missed something let me know.