Comment 3 for bug 1872281

Revision history for this message
Alberto Alcolea (albertoalcolea) wrote :

I don't know if it will help, but I've been able to compile collectd with the Python plugin.

If I'm not wrong, collectd uses a custom interpreter (a kind of wrapper over the cpython interpreter) to avoid to initialize a new interpreter each time we need to execute Python scripts.
That interpreter seems to be compiled into a shared library that is placed in /usr/lib/collectd/python.so after install the package from the Ubuntu repos.

If we execute ldd over the shared library installed with apt from the official repository, we can see that it is not linked with libpython.so, the real interpreter, so it is not able to run it.

I've been able to compile the version 5.11.0 of collectd enabling Python support installing `python-dev-is-python3` before to compile it.

That package installs a shell script that is able to detect which version of Python is installed (and other details like libs and paths). That script is used by the configure script of collectd to determine if Python is supported or not.

I've been tried to compile the same version that is present in the repository (5.9.2) with no luck, probably I'm missing some header, however I've been able to use the python.so compiled for 5.11.0 with Python support with collectd 5.9.2.
The only changes to the Python plugin between these two versions are just a few format changes (indentation changes) and the replacement of snprintf by snnprintf in some functions (the older one uses snprintf and the newer one snnprintf).

As you can see my knowledge on this topic is limited but I hope this can be useful to you.