Add multi-target support#11
Conversation
By calling `target=myswitch.local,myotherswitch.local` multiple switches can be queried at once. Alternatively, `target=all` can be used to query a list of targets specified in the config file. All metrics will get an additional `target` label to distinguish values from different switches. This functionality is particularly useful when calling the exporter via an exporter-exporter proxy.
The `show ip bgp summary` and `show ipv6 bgp summary` commands only return sessions from the main vrf. Adding `vrf all` makes the commands return sessions from all vrfs.
|
Thank you, this looks great! Do you already run this version? I went through the code and don't have any comments or suggestions, other than I would probably go about it the other way around - i.e. iterate over switches and do everything on one switch, then move to the next one. That way it would be easier to parallelize if we ever come to a point where it takes too long to fetch the metrics, because the main bottleneck I've seen so far is waiting for the switch to respond to That being said, i've never run into this issue so I'm okay with merging this as is unless someone objects. |
|
Hi @zloo, I currently have this code running on a lab server against our production switches. I intend to move it to a permanent home shortly. I did not consider the parallelization case, as our environment only consists of a handful devices. With that scraping still only takes a few seconds, even with all modules enabled. For larger deployments (100+ devices) some more work is probably needed, like persistent connections. |
By calling
target=myswitch.local,myotherswitch.localmultiple switches can be queried at once.Alternatively,
target=allcan be used to query a list of targets specified in the config file.All metrics get an additional
targetlabel to distinguish values from different switches.This functionality is particularly useful when calling the exporter via an exporter-exporter proxy.