rverchere / vmware_exporter

VMWare VCenter Exporter for Prometheus
BSD 3-Clause "New" or "Revised" License
50 stars 31 forks source link

support for multiple vcenter/esxi endpoints #5

Closed wtip closed 7 years ago

wtip commented 7 years ago

It would be great if this exporter could support polling multiple vcenter/esxi endpoints in the same way that the official snmp exporter works by passing the host device as a http get request.

I'm still investigating how to best handle this.

Here's an older snmp exporter that was still python based https://github.com/prometheus/snmp_exporter/blob/30cb5cc264d1a3c2329ed40e740f57f3670fe1ee/snmp_exporter/http.py

Here's another one https://github.com/dhtech/snmpexporter/blob/master/snmpexporterd.py

Please let me know if you have any suggestions.

rverchere commented 7 years ago

Hi,

I'm thinking about it, thanks for the inputs, I'll read them carefully. My main concern is about login/passwords used to connect to each esxi/vcenter.

wtip commented 7 years ago

for my particular use case all of the endpoints I would want to monitor with a single exporter use the same username and password so I would be fine with leaving that part in a static config file.

ipsecguy commented 7 years ago

Hi,

I agree with wtip, would be a cool addition.

Regarding the passwords I think they should be placed in the config file, basically replicating the section format that is used in the current implementation for multiple endpoints. The metrics collection would then reference one of the multiple configurations by name, leaving the credentials hidden in the exporter's config.

Andreas

is4it-lab commented 7 years ago

Hi,

this would be a great extention. Another thing in this context: It would be great to have more information for filtering in the counters. for example the ESX host to the VM or the cluster to the host

for example VM fom now: {instance="localhost:9272",job="vmware",vm_name="vcenter-psc01"} to {instance="localhost:9272",job="vmware",host="esx1",vm_name="vcenter-psc01"}

or host {host_name="esx1",instance="localhost:9272",job="vmware"} to {host_name="esx1",instance="localhost:9272",job="vmware",cluster="Lab-Cluster",datacenter="MUC"}

Robert

ipsecguy commented 7 years ago

Just tested the multi_endpoint branch, seems to work. I will put in test.

Now a parameter "target" (similar to SNMP) could be used to reference a section in the config file, even though it is quite clumsy in the prometheus config. Should be similar to:

- job_name: 'vmware'
    scrape_interval:     60s
    target_groups:
      - targets:
        - lab-cluster # reference section in vmware_exporter.yml
        - test-esxi-host # references another section
    relabel_configs:
      - source_labels: [__address__]
        regex: (.*?)(:80)?
        target_label: __param_target
        replacement: ${1}
      - source_labels: [__param_target]
        regex: (.*?)(:80)?
        target_label: instance
        replacement: ${1}
      - source_labels: []
        regex: .*
        target_label: __address__
        replacement: 127.0.0.1:9272  # vmware exporter.
rverchere commented 7 years ago

@ipsecguy, I have just started finding doc on how to manage multi endpoints, it is not implemented so far in the multi_endpoint branch;) The only difference now is that it makes a connect/disconnect for each request.

ipsecguy commented 7 years ago

Yes, I know, I read the code. It was more to see whether there are any side effects with connect/disconnect at each scrape. But I just saw your update, I will test later this evening.

rverchere commented 7 years ago

This is mostly done, waiting for your feedbacks before closing it.

is4it-lab commented 7 years ago

Hi,

I don't understand the part with file_sd_configs can you show an example of /etc/prometheus/esx.yml ?

Robert

rverchere commented 7 years ago

@is4it-lab, it's a different way to list targets ( see file_sd_config ):

- targets:
  - 'esx1.company.com'
  - 'esx2.company.com'
ipsecguy commented 7 years ago

Hi,

I am now able to scrape multiple ESXi host. I am not using a "default" section (all my hosts are configured explicitly). Deleting the default section seems to stop it working, putting dummy account data seems breaks things, the metrics URL is then empty.

rverchere commented 7 years ago

@ipsecguy, for now you must have a default section.

wtip commented 7 years ago

@rverchere Thank you for implementing this. I just got around to trying this out today. I've got it scraping 4 hosts at the moment.

rverchere commented 7 years ago

Works for me for weeks now, I can close the issue.