patrickjahns / ansible-role-libvirt-exporter

🔧 Ansible role for deploying libvirt-prometheus-exporter
MIT License
2 stars 2 forks source link

centos support #5

Closed DO1JLR closed 1 year ago

DO1JLR commented 4 years ago

Hey there

Thank you very much for this Ansible role. Actually, it's exactly what I'm looking for... But unfortunately, also for the centos world.

There your exporter unfortunately does not start but throws the following message:

 $ /usr/local/bin/libvirt_exporter
Traceback (most recent call last):
  File "site-packages/libvirt.py", line 24, in <module>
ModuleNotFoundError: No module named 'cygvirtmod'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "libvirt_exporter", line 3, in <module>
  File "/usr/local/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
  File "libvirt_exporter/cli.py", line 3, in <module>
  File "/usr/local/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
  File "libvirt_exporter/collector.py", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
  File "site-packages/libvirt.py", line 28, in <module>
  File "site-packages/libvirt.py", line 20, in <module>
ImportError: /lib64/libc.so.6: version `GLIBC_2.22' not found (required by /tmp/_MEIhNCZjl/libdevmapper.so.1.02.1)
[628732] Failed to execute script libvirt_exporter

Stay healthy

patrickjahns commented 4 years ago

@DO1JLR

Thanks for reporting this - have you tried installing https://github.com/patrickjahns/libvirt-prometheus-exporter directly in a local virtualenv? Was that working for you?

I fear it might be that building the "binary release" with PyInstaller on Debian based systems might make them not compatible for other systems. I will need to research this a bit and see what the root cause might be.

Could you share some more details on the centos version you are using?

DO1JLR commented 4 years ago

Hi @patrickjahns

Thanks for your answer.

I am using the current version of centos 7, because the community package servers of centos 8 do not yet have all the dependencies we have.

 $ cat /etc/redhat-release 
CentOS Linux release 7.8.2003 (Core)

Here you can find an asciinema sniped from my recent unsuccessful manual installation attempt.

asciicast

The problem seems to be with libvirt-python. Pip3 fails here:

Collecting libvirt-python==5.6.0 (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/c2/55/e714d88e05690f2dc05593d91619646dacafd9b9e4ba2e90d4208a1f868d/libvirt-python-5.6.0.tar.gz (201kB)
    100% |████████████████████████████████| 204kB 3.2MB/s 
Requirement already satisfied: prometheus-client==0.7.1 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 2))
Requirement already satisfied: ConfigArgParse==0.14.0 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 3))
Installing collected packages: libvirt-python
  Running setup.py install for libvirt-python ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-sv8d3ecw/libvirt-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-yt_p6j7p-record/install-record.txt --single-version-externally-managed --compile:
    Package libvirt was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libvirt.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libvirt' found
    Package libvirt was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libvirt.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libvirt' found
    running install
    running build
    /bin/pkg-config --print-errors --atleast-version=0.9.11 libvirt
    Package libvirt was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libvirt.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libvirt' found
    error: command '/bin/pkg-config' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-sv8d3ecw/libvirt-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-yt_p6j7p-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-sv8d3ecw/libvirt-python/

I also tried to install the "missing" libvirt package. But it is obvoously already installed:

$ sudo yum install libvirt libvirt-python
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.intergenia.de
 * epel: mirror.imt-systems.com
 * extras: mirror.imt-systems.com
 * updates: mirror.eu.oneandone.net
Package libvirt-4.5.0-33.el7_8.1.x86_64 already installed and latest version
Package libvirt-python-4.5.0-1.el7.x86_64 already installed and latest version
Nothing to do
$ pip3 install --user libvirt
Collecting libvirt
  Could not find a version that satisfies the requirement libvirt (from versions: )
No matching distribution found for libvirt
$ libvirtd --version
libvirtd (libvirt) 4.5.0

I'm not sure what's causing the problems here. It just shows me once again why you should use real operating systems and not centos. But unfortunately it is not even possible to move it to debian because there are too many productive services running.

Stay healthy!