Unable to get autodiscover to play nice with mongodb using a kubernetes provider

Metricbeat: 7.10.2

We have several mongodb instances across many clusters and would like to enhance the metrics output of all our mongo pods so we can start making some pretty graphs.

I've been trying, in vein, to get autodiscover to play along nicely with templating out a mongodb module using autodiscover. I'm completely stumped. I've poured over the docs and I am unable to get any metrics flowing into Kibana.

This is what I have:

        - type: kubernetes
          host: ${HOSTNAME}
            - condition.equals:
                kubernetes.labels.k8s-app: mongodb
                - module: mongodb
                  period: 30s
                  hosts: ["mongodb://${DB_USERNAME}:${MONGO_PASSWORD}@${data.kubernetes.pod.name}.${data.kubernetes.namespace}-headless.${data.kubernetes.namespace}.svc.cluster.local:27017/?authSource=admin&replicaSet=rs0"]
                  metricsets: ["dbstats", "status", "metrics"]

as a standard test, I can create a standard, manual configuration:

mongodb.yml: |-
    - module: mongodb
      period: 60s
        - 'mongodb://${DB_USERNAME}:${MONGO_PASSWORD}@mongo-dev-0.mongo-dev-headless.mongo-dev.svc.cluster.local:27017/?authSource=admin&replicaSet=rs0'
        - 'mongodb://${DB_USERNAME}:${MONGO_PASSWORD}@mongo-dev-1.mongo-dev-headless.mongo-dev.svc.cluster.local:27017/?authSource=admin&replicaSet=rs0'
        - 'mongodb://${DB_USERNAME}:${MONGO_PASSWORD}@mongo-dev-2.mongo-dev-headless.mongo-dev.svc.cluster.local:27017/?authSource=admin&replicaSet=rs0'
      enabled: true
        - dbstats
        - status
        - metrics

this of course, works just fine. As you can imagine, this is less than Ideal. We have far too many instances (and more popping up soon!) to have this done manually. I really like my automation and templating :slight_smile:

Since this is on kubernetes, I have used this on both daemonset configs and standard deployments to no avail.
Have I missed something here? Have I done something horribly wrong?

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