pryorda / vmware_exporter

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

does anyone tried to test vmware_exporter on a vcenter v8.xx? #395

Open ARVENMOLINILLA opened 5 months ago

ARVENMOLINILLA commented 5 months ago

does anyone tried to test vmware_exporter on a vcenter v8.xx? we are just new to this exporter thing

I am getting this while testing

[root@bin]# ./vmware_exporter -c /usr/monitoring/config.yml 2024-06-05 04:55:15,695 INFO:Starting web server on port :9272 2024-06-05 04:59:20,688 ERROR:Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/vmware_exporter-0.18.4-py3.6.egg/vmware_exporter/vmware_exporter.py", line 1937, in _async_render_GET yield self.generate_latest_metrics(request) AttributeError: 'NoneType' object has no attribute 'get'

2024-06-05 04:59:20,688 ERROR:Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/vmware_exporter-0.18.4-py3.6.egg/vmware_exporter/vmware_exporter.py", line 1937, in _async_render_GET yield self.generate_latest_metrics(request) AttributeError: 'NoneType' object has no attribute 'get'

seowjin1060 commented 5 months ago

Hello! I'm running this exporter on vcenter 8 with resolved some problem.

  1. It seems your error has popped up before collecting metrics with pyvomi, because no logs with collecting functions and none type error occurred during initial configuration. Check if yaml file exist and vsphere variables blew defined in your conf file properly under default attribute . or It will return Nonetype error

    if self.config[section].get('vsphere_host') and self.config[section].get('vsphere_host') != "None": vsphere_host = self.config[section].get('vsphere_host') elif request.args.get(b'target', [None])[0]: vsphere_host = request.args.get(b'target', [None])[0].decode('utf-8') elif request.args.get(b'vsphere_host', [None])[0]: vsphere_host = request.args.get(b'vsphere_host')[0].decode('utf-8')

    section = request.args.get(b'section', [b'default'])[0].decode('utf-8')
    if section not in self.config.keys():
        logging.info("{} is not a valid section, using default".format(section))
        section = 'default'
  2. Check if any sphere host in your vCenter, collect functions will return nonetype if you don't add any host on your vcenter. Because this exporter code not checking error / empty json.

Also, can you share your config.yml file?