prometheus-pve / prometheus-pve-exporter

Exposes information gathered from Proxmox VE cluster for use by the Prometheus monitoring system
Apache License 2.0
840 stars 99 forks source link

500 Internal Server Error 'module' object has no attribute 'urllib3' #17

Closed webguylearn closed 4 years ago

webguylearn commented 6 years ago

doing some test I see this below ( I removed my real IP)

curl http://127.0.0.1:9221/pve?module=default&target=(internalproxmoxip) [1] 21218 [root@internalproxmoxip home]# <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

500 Internal Server Error

"

Internal Server Error

"

'module' object has no attribute 'urllib3'

to make sure I didn't have access issues I used root for testing

[root@secretservername home]# more pve.yml default: user: root password: mypassword verify_ssl: false

thanks any guidance

znerol commented 6 years ago

It looks like the exporter fails to find some of its dependencies. Did you follow a particular guide to install/run this project?

webguylearn commented 6 years ago

yes went step by step install the exporter on Prometheus using https://github.com/znerol/prometheus-pve-exporter

using centos07

sample

wget https://github.com/prometheus/prometheus/releases/download/v2.4.0/prometheus-2.4.0.linux-amd64.tar.gz 32 tar -xvzf prometheus-2.4.0.linux-amd64.tar.gz 33 mv prometheus-2.4.0.linux-amd64/ prometheus 34 useradd -m -s /bin/bash prometheus 35 mv prometheus /home/prometheus/ 36 cd /home/prometheus/ 37 chown -Rv prometheus. prometheus 38 cd /etc/systemd/system/ 39 vi prometheus.service 40 systemctl start prometheus 41 systemctl status prometheus 42 yum install python2-pip.noarch 43 pip install python-neutronclient 44 yum clean all 45 yum update 46 yum install gcc python-devel 47 pip install python-neutronclient 48 yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.4-1.x86_64.rpm 49 systemctl status firewalld 50 systemctl stop firewalld 51 systemctl status firewalld 52 systemctl start grafana-server 53 systemctl status grafana-server pip install prometheus-pve-exporter 56 cd /home 57 vi pve.yml 58 vi /home/prometheus/prometheus/prometheus.yml 59 history 60 systemctl restart prometheus 61 systemctl status prometheus 62 vi /home/prometheus/prometheus/prometheus.yml 63 pve_exporter 64 vi /home/prometheus/prometheus/prometheus.yml 65 systemctl status prometheus 66 systemctl restart prometheus

webguylearn commented 6 years ago

didnt know if this would give more info,

pip install prometheus-pve-exporter

Requirement already satisfied (use --upgrade to upgrade): prometheus-pve-exporter in /usr/lib/python2.7/site-packages Requirement already satisfied (use --upgrade to upgrade): prometheus-client>=0.0.11 in /usr/lib/python2.7/site-packages (from prometheus-pve-exporter) Requirement already satisfied (use --upgrade to upgrade): proxmoxer in /usr/lib/python2.7/site-packages (from prometheus-pve-exporter) Requirement already satisfied (use --upgrade to upgrade): Werkzeug in /usr/lib/python2.7/site-packages (from prometheus-pve-exporter) Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python2.7/site-packages (from prometheus-pve-exporter) Requirement already satisfied (use --upgrade to upgrade): pyyaml in /usr/lib64/python2.7/site-packages (from prometheus-pve-exporter) Requirement already satisfied (use --upgrade to upgrade): idna<2.8,>=2.5 in /usr/lib/python2.7/site-packages (from requests->prometheus-pve-exporter) Requirement already satisfied (use --upgrade to upgrade): chardet<3.1.0,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests->prometheus-pve-exporter) Requirement already satisfied (use --upgrade to upgrade): urllib3<1.25,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests->prometheus-pve-exporter) Requirement already satisfied (use --upgrade to upgrade): certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests->prometheus-pve-exporter)

znerol commented 6 years ago

Requirement already satisfied (use --upgrade to upgrade): urllib3<1.25,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests->prometheus-pve-exporter)

Looks like this is installed properly. How do you launch prometheus-pve-exporter?

webguylearn commented 6 years ago

2 ways sometimes I run pve_exporterter pve.yml to watch for the 500 error. Or I can use my service

systemctl start prometheus-pve-exporter.service

[Unit] Description=Prometheus exporter for Proxmox VE Documentation=https://github.com/znerol/prometheus-pve-exporter

[Service] Restart=always User=prometheus ExecStart=/usr/bin/pve_exporter /home/pve.yml

[Install] WantedBy=multi-user.target

znerol commented 6 years ago

Can you please post the contents of /usr/bin/pve_exporter

webguylearn commented 6 years ago

[root@alaldprometest ~]# more /usr/bin/pve_exporter

!/usr/bin/python2

-- coding: utf-8 --

import re import sys

from pve_exporter.cli import main

if name == 'main': sys.argv[0] = re.sub(r'(-script.pyw|.exe)?$', '', sys.argv[0]) sys.exit(main())

webguylearn commented 6 years ago

ls /usr/bin/python* /usr/bin/python /usr/bin/python2 /usr/bin/python2.7

znerol commented 6 years ago

Regrettably I'm out of ideas right now. It looks like everything is in place I have no idea why python fails to load that library.

webguylearn commented 6 years ago

ok at-least thats something , let me do more digging. Wasn't sure where the issue might be. Let you know if I find something. thanks mate !!

znerol commented 4 years ago

Closing this due to lack of activity.

martijncassels commented 4 years ago

doing some test I see this below ( I removed my real IP)

curl http://127.0.0.1:9221/pve?module=default&target=(internalproxmoxip) [1] 21218 [root@internalproxmoxip home]#

500 Internal Server Error " # Internal Server Error " 'module' object has no attribute 'urllib3' * job_name: 'pve' static_configs: * targets: * internalproxmoxip # Proxmox VE node with PVE exporter. metrics_path: /pve params: module: [default] relabel_configs: * source_labels: [**address**] target_label: __param_target * source_labels: [__param_target] target_label: instance * target_label: **address** replacement: 127.0.0.1:9221 # PVE exporter. to make sure I didn't have access issues I used root for testing [root@secretservername home]# more pve.yml default: user: root password: mypassword verify_ssl: false thanks any guidance

use the user like PVE uses it in the GUI. In my case it was: root@pam

znerol commented 4 years ago

Thanks @martijncassels for the details. Which python version are you using?

python --version

or if you run python3 (which is recommended anyway):

python3 --version
znerol commented 4 years ago

Closing this due to lack of activity.