collectd-python failure
Running collectd in a Docker container.
FROM alpine:latest
RUN apk update && \
apk add \
collectd \
collectd-network \
collectd-python \
python3 \
py-pip
RUN pip install requests argparse
COPY collectd.conf /etc/collectd/collectd.conf
VOLUME /var/lib/collectd
CMD collectd -f
Container fails to start and logs the following error:
[2021-02-04 09:54:44] dlopen("/usr/lib/collectd/python.so") failed: Error relocating /usr/lib/collectd/python.so: PyObject_CallFunction: symbol not found. The most common cause for this problem is missing dependencies. Use ldd(1) to check the dependencies of the plugin / shared object.
[2021-02-04 09:54:44] plugin_load: Load plugin "python" failed with status 2.
The same error has been reported in Ubuntu (https://bugs.launchpad.net/ubuntu/+source/collectd/+bug/1872281) and the suggested work-around allows the plugin to load:
CMD LD_PRELOAD=/usr/lib/libpython3.8.so.1.0 collectd -f
However when you add a python based plugin to the collectd config e.g. https://github.com/ematthews/ubnt_airos, a new error occurs
[2021-02-04 10:31:35] plugin_load: plugin "python" successfully loaded.
[2021-02-04 10:31:36] set_thread_name("python interpreter"): name too long
Exception ignored in: <function _after_at_fork_child_reinit_locks at 0x7f050a59a430>
Traceback (most recent call last):
File "/usr/lib/python3.8/logging/__init__.py", line 260, in _after_at_fork_child_reinit_locks
_releaseLock() # Acquired by os.register_at_fork(before=.
File "/usr/lib/python3.8/logging/__init__.py", line 228, in _releaseLock
_lock.release()
RuntimeError: cannot release un-acquired lock
The initial error is also reported in the ArchLinux bug tracker (https://bugs.archlinux.org/task/64533) and was fixed by upgrading to collectd-5.10