pryorda / vmware_exporter

VMWare vCenter Exporter for Prometheus
BSD 3-Clause "New" or "Revised" License
527 stars 200 forks source link

[solved] AttributeError: 'NoneType' object has no attribute 'RetrieveContent' when running vmware_exporter #369

Closed robinlem closed 1 year ago

robinlem commented 1 year ago

Hi,

I'm trying to use the pryorda/vmware_exporter for VMware, but I'm encountering an issue when executing it with the following command:

podman run -it --rm -p 9272:9272 --name vmware_exporter --env-file config.env pryorda/vmware_exporter

The error message I receive is:

AttributeError: 'NoneType' object has no attribute 'RetrieveContent'

I have checked my config.env file, and all the environment variables seem to be correctly defined, including the authentication information and the vCenter server URL. I have also made sure that the container can access the vCenter server, and that the user has sufficient permissions to access the server's information.

I am using the latest version of the pryorda/vmware_exporter. If you have any suggestions on how to resolve this issue, I would greatly appreciate it. Thanks in advance for your assistance.

Best regards,

robinlem commented 1 year ago

To be more accurate, this is what I get as error (I try to connect to vSphere 7.x vcenter)

2023-05-02 06:49:06,380 INFO:Starting web server on port :9272 2023-05-02 06:49:49,062 INFO:Start collecting metrics from xxxxxx 2023-05-02 06:49:49,062 INFO:Starting vm metrics collection 2023-05-02 06:49:49,062 INFO:Fetching vim.VirtualMachine inventory 2023-05-02 06:49:49,063 INFO:Retrieving service instance content 2023-05-02 06:49:49,066 INFO:START: _vmware_get_vm_perf_manager_metrics 2023-05-02 06:49:49,067 INFO:Fetching vim.Datastore inventory 2023-05-02 06:49:49,067 INFO:Starting host metrics collection 2023-05-02 06:49:49,067 INFO:Fetching vim.HostSystem inventory 2023-05-02 06:49:49,067 INFO:START: _vmware_get_host_perf_manager_metrics 2023-05-02 06:49:52,206 ERROR:Caught vmodl fault: Cannot complete login due to an incorrect user name or password. 2023-05-02 06:49:52,209 ERROR:Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/vmware_exporter/vmware_exporter.py", line 1937, in _async_render_GET yield self.generate_latest_metrics(request) twisted.internet.defer.FirstError: FirstError[#0, [Failure instance: Traceback: <class 'twisted.internet.defer.FirstError'>: FirstError[#1, [Failure instance: Traceback: <class 'twisted.internet.defer.FirstError'>: FirstError[#0, [Failure instance: Traceback: <class 'AttributeError'>: 'NoneType' object has no attribute 'RetrieveContent' /usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:734:errback /usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:797:_startRunCallbacks /usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:892:_runCallbacks /usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:1791:gotResult --- --- /usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:1693:_inlineCallbacks /usr/local/lib/python3.7/site-packages/twisted/python/failure.py:518:throwExceptionIntoGenerator /usr/local/lib/python3.7/site-packages/vmware_exporter/vmware_exporter.py:778:vm_inventory /usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:1693:_inlineCallbacks /usr/local/lib/python3.7/site-packages/twisted/python/failure.py:518:throwExceptionIntoGenerator /usr/local/lib/python3.7/site-packages/vmware_exporter/vmware_exporter.py:602:batch_fetch_properties /usr/local/lib/python3.7/site-packages/twisted/internet/defer.py:1696:_inlineCallbacks /usr/local/lib/python3.7/site-packages/vmware_exporter/vmware_exporter.py:594:content ]] --- --- /usr/local/lib/python3.7/site-packages/vmware_exporter/vmware_exporter.py:1084:vm_labels /usr/local/lib/python3.7/site-packages/vmware_exporter/defer.py:100:parallelize ]] --- --- /usr/local/lib/python3.7/site-packages/vmware_exporter/vmware_exporter.py:1507:_vmware_get_vms /usr/local/lib/python3.7/site-packages/vmware_exporter/defer.py:100:parallelize ]]

huangyonghome commented 1 year ago

I have the same problems in Esxi 6.0 and Esxi 5.5.But it works in Esxi 6.8 and 7.0

huangyonghome commented 1 year ago

I resolved this issue. There is $ specific symbol in my Vcenter password . I guess it is about parsing error.

I used single quotes insted of double quotes on the variables VSPHERE_PASSWORD :

VSPHERE_PASSWORD='$$$$dsfaafsd'

But I found it still counldn't work in docker-compose.So I run the exporter with docker run cli .It works!

robinlem commented 1 year ago

glad that it works for you, Unfortunately I still have the same problem. I don't have any '$' in the password I'll try the python version

pryorda commented 1 year ago

ITs def an issue with the password and login

2023-05-02 06:49:52,206 ERROR:Caught vmodl fault: Cannot complete login due to an incorrect user name or password.

robinlem commented 1 year ago

Right ! error with login / password

robinlem commented 1 year ago

error with login / password