Mongo metrics export via k8s Grafana agent operator

Hi, I want to export metrics from a MongoDB replica set running in Kubernetes, and I want to see the metrics in Grafana Cloud.

I have the Kubernetes Grafana Agent running using the Kubernetes operator. I can see Kubelet metrics, pod metrics, etc.

I went ahead and set up an Integration CRD for mongodb. This is what the CRD looks like:

kind: Integration
  creationTimestamp: "2023-05-11T00:01:26Z"
    agent: grafana-agent
  name: mongodb-exporter
  namespace: metrics
  resourceVersion: "2645330"
  uid: 0f022cf6-1d64-4a46-ac84-7b641dcc7dd1
    mongodb_uri: <VALID_MONGODB_URI>
  name: mongodb
    allNodes: true
    unique: true

The grafana-agent-0 and grafana-agent-integration* pods run properly, even after I restart these pods. Their logs show no errors.

But I cannot see any data in the MongoDB monitoring dashboards. Help please?

Other notes:

  • I know the MongoDB URI is valid because I tested using that URI from another pod.
  • As you can see in the CRD, I omitted relabel_configs, which the docs mark as necessary. Seems like the latest version of the agent does no longer accepts that config (including the value makes the grafana-agent pod error out).