Python client and url params

577 views
Skip to first unread message

Rémi Verchère

unread,
Jun 30, 2017, 8:17:12 AM6/30/17
to Prometheus Developers
Hi,

I'm using the python client with a custom collector to export some data.
I use the basic start_http_server to run the exporter.
Does it support url params (i.e http://localhost:8000?target=10.0.0.1 to collect data from 10.0.0.1)? How can I handle it?
If not, do I have to use a specific handler to manage it?



Thanks for your help!

Rémi

Brian Brazil

unread,
Jun 30, 2017, 8:26:04 AM6/30/17
to Rémi Verchère, Prometheus Developers
Can you explain more about what you're trying to do?

Usually an exporter only talks to one instance, so there's no need to pass a target.

--

Rémi Verchère

unread,
Jun 30, 2017, 8:32:53 AM6/30/17
to Brian Brazil, Prometheus Developers

Can you explain more about what you're trying to do?

Usually an exporter only talks to one instance, so there's no need to pass a target.

I'm writing a vmware_exporter to get VMs metrics, and I'd like to use url params to choose the hypervisor or vcenter the exporter has to connect to (see https://github.com/rverchere/vmware_exporter/issues/5), having the same behavior as the snmp_exporter / blackbox exporter
The exporter use very basically the python prometheus_client.

Thanks,

Rémi

Brian Brazil

unread,
Jun 30, 2017, 8:45:12 AM6/30/17
to Rémi Verchère, Prometheus Developers
That's a non-standard use case, so it's more difficult to do. You'll want to code up your own HTTP handler and use a custom registry. I'd suggest looking at the snmp_exporter back when it was in Python: https://github.com/prometheus/snmp_exporter/tree/0a189cb62438081e3dc7b78a436b620ca668116c/snmp_exporter 

--
Reply all
Reply to author
Forward
0 new messages