-
Notifications
You must be signed in to change notification settings - Fork 444
Description
Describe the bug
i have a statefulset of mongodb with 3 replicas and they are in the same cluster. and i configured a headless service and init job to initiate this replicas (it works very well and the replicas are initiated). and when i configured a mongodb_exporter as a deployment and point to this url : - "--mongodb.uri=mongodb://monitorUser:new_password@headless-service:27017/admin?replicaSet=rs0"
not able to connect to all instance and scrape metrics from only one replicas !
To Reproduce
Steps to reproduce the behavior:
i create a deployment with this flag for the container
containers:
- name: mongodb-exporter-ahc
image: percona/mongodb_exporter:0.42.0
command:
- "--log.level=debug"
- "--mongodb.uri=mongodb://monitorUser:new_password@headless-service:27017/admin?replicaSet=rs0"
- "--collector.replicasetstatus"
- "--collector.dbstats"
- "--collector.diagnosticdata"
- "--collector.indexstats"
- "--collector.topmetrics"
- "--collect-all"
ports:
- name: metrics
containerPort: 9216
protocol: TCP
readinessProbe:
httpGet:
path: /metrics
port: 9216
initialDelaySeconds: 30
periodSeconds: 5
failureThreshold: 6
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "1Gi"
cpu: "500m"
Expected behavior
i expect that mongodb_exporter could find and connect to the replicas and gather metrics from all the replicas
Environment
- environment (docker, k8s)
- mongodb-community-server version 7
Additional context
Add any other context about the problem here.