Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
robinlem opened this issue May 2, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@robinlem
Copy link

robinlem commented May 2, 2023

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
Copy link
Author

robinlem commented May 2, 2023

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
Copy link

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

@huangyonghome
Copy link

huangyonghome commented May 4, 2023

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
Copy link
Author

robinlem commented May 9, 2023

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
Copy link
Owner

pryorda commented Jun 1, 2023

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.

@pryorda pryorda added the bug Something isn't working label Jun 1, 2023
@robinlem
Copy link
Author

robinlem commented Jun 2, 2023

Right ! error with login / password

@robinlem robinlem changed the title AttributeError: 'NoneType' object has no attribute 'RetrieveContent' when running vmware_exporter [solved] AttributeError: 'NoneType' object has no attribute 'RetrieveContent' when running vmware_exporter Jun 2, 2023
@robinlem robinlem closed this as completed Jun 2, 2023
@robinlem
Copy link
Author

robinlem commented Jun 2, 2023

error with login / password

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants