Prometheus collector query defined once, applied everywhere

Hi,

I'm using Metricbeat 8.6.2 and I'm trying to collect Prometheus metrics using the official Prom snmp exporter. This particular exporter requires passing a URL query string to configure the snmp endpoint to collect the metrics from.

As an example, this exporter URL: http//snmpexporter:9116/snmp/?target=192.168.10.14&module=synology makes the snmp exporter return snmp metrics from IP 192.168.10.14 and the synology MIB module.

Here is a sample configuration which collects Prometheus metrics from 2 different exporters:

  • the SNMP exporter (see above for details) with 192.168.10.14 configured as the snmp target
  • the embedded Canonical MaaS exporter running on host 192.168.10.4
metricbeat:
  modules:
  - module: prometheus
    period: 30s
    metricsets: ["collector"]
    hosts: ["snmpexporter:9116"]
    metrics_path: /snmp
    query:
      target: 192.168.10.14
      module: synology
  - module: prometheus
    period: 30s
    metricsets: ["collector"]
    hosts: ["192.168.10.4:5240"]
    use_types: true
    rate_counters: false
    metrics_path: /MAAS/metrics

The issue is that the query parameter which is defined only in the first Prometheus module configuration (snmp), is also applied transparently to the second Prometheus configuration (MaaS). See:

Defining an empty query parameter for the second Prometheus configuration does not help much (and would not be a scalable solution when using autodiscover and hints autodiscover)

Any idea what's wrong with my configuration?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.