leroy-merlin-br / logstash-exporter

Prometheus exporter for Logstash metrics
MIT License
36 stars 6 forks source link

Support multiple logstash instances from a single exporter #6

Open sparkblaze opened 3 years ago

sparkblaze commented 3 years ago

Currently, we are deploying 5 separate containers for 5 separate instances of Logstash, this seems unnecessary as other exporters (Blackbox, SNMP... etc) can generally support multiple targets per config/exporter instance.

It would be nice if we could do something similar with the logstash-exporter - I've been meaning to have a go myself, but I'm pretty terrible at Go.

scrape_configs:
  - job_name: 'logstash-exporter'
    metrics_path: /metrics
    static_configs:
      - targets:
        - http://logstash-server1.local.domain:9600
        - http://logstash-server2.local.domain:9600
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9115  # The blackbox exporter's real hostname:port.
brunopadz commented 3 years ago

It sounds interesting. I'll take a look how it was implemented on Blackbox exporter and give it a try.

In the meantime, feel free to contribute. :)