Hi friends,
we are switching our mongodb deployment from using bitnami charts/bitnami/mongodb at main · bitnami/charts · GitHub to use the percona operator .
In our bitnami solution we have setup the metric server via (charts/values.yaml at main · bitnami/charts · GitHub )
We have an existing prometheus/grafana setup via kube-prometheus-stack helm-charts/charts/kube-prometheus-stack at main · prometheus-community/helm-charts · GitHub
We are wondering if its possible to install a metric server that allows us to ship metrics so we can view the state of our mongodb instance in our existing grafana solution.
Im aware of something called PMM Percona Monitoring and Management but we are unsure if we are able to use this with our existing setup or what im assuming this is an alternative to our kube-prometheus-stack setup.
–
Just reading furtheri nto the documentation i noticed its possible to have a sidecar, would the solution here to have a sidecar running mognodb-exporter. Is there an example of this somewhere?
sidecars:
- image: percona/mongodb_exporter:0.36
env:
- name: EXPORTER_USER
valueFrom:
secretKeyRef:
name: psmdb-db-secrets
key: MONGODB_CLUSTER_MONITOR_USER
- name: EXPORTER_PASS
valueFrom:
secretKeyRef:
name: psmdb-db-secrets
key: MONGODB_CLUSTER_MONITOR_PASSWORD
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: MONGODB_URI
value: "mongodb://$(EXPORTER_USER):$(EXPORTER_PASS)@$(POD_IP):27017"
args: ["--discovering-mode", "--compatible-mode", "--log.level=debug", "--mongodb.uri=$(MONGODB_URI)"]
name: rs-sidecar-1
I installed the mongod_exporter as a sidecar, but the metrics is not being picked up by prometheus ( can’t see it in the service discovery )
What am i doing wrong here?
Okay i managed to get this working I think . I’ll leave the solution here incase anyone needs it.
Need to setup mongodb exporter as a sidecar. And then you must setup a service and a service monitor so prometheus can begin to scrape the data.
honestly wish creating of the service & service monitor was integrated into this helm, if i was not such a noob at helm i would make a PR myself.
psmdb-db.values.yaml
sidecars:
- image: percona/mongodb_exporter:0.36
env:
- name: EXPORTER_USER
valueFrom:
secretKeyRef:
name: psmdb-db-secrets
key: MONGODB_CLUSTER_MONITOR_USER
- name: EXPORTER_PASS
valueFrom:
secretKeyRef:
name: psmdb-db-secrets
key: MONGODB_CLUSTER_MONITOR_PASSWORD
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: MONGODB_URI
value: "mongodb://$(EXPORTER_USER):$(EXPORTER_PASS)@$(POD_IP):27017"
args: ["--discovering-mode", "--compatible-mode", "--collect-all", "--log.level=debug", "--mongodb.uri=$(MONGODB_URI)"]
name: metrics
metrics-service.yaml
apiVersion: v1
kind: Service
metadata:
name: psmdb-metrics
namespace: mongodb
labels:
app: psmdb-metrics
app.kubernetes.io/instance: psmdb-db
app.kubernetes.io/component: metrics
annotations:
prometheus.io/path: /metrics
prometheus.io/port: '9216'
prometheus.io/scrape: 'true'
spec:
ports:
- name: http-metrics
port: 9216
targetPort: 9216
protocol: TCP
selector:
app.kubernetes.io/instance: psmdb-db
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: psmdb-metrics-servicemonitor
namespace: monitoring
labels:
app.kubernetes.io/instance: psmdb-db
app.kubernetes.io/component: metrics
spec:
namespaceSelector:
matchNames:
- mongodb
selector:
matchLabels:
app.kubernetes.io/instance: psmdb-db
app.kubernetes.io/component: metrics
endpoints:
- port: http-metrics
interval: 15s
1 Like
Hi @Kay_Khan , we have integration with PMM. You can deploy the PMM server and enable pmm client via CR very easily. Try to use our product and provide feedback for us. Thanks.
Slava_Sarzhan:
PMM
I understand.
I think you misunderstood my requirements, i wanted the ability to collect metrics and ship them to an existing prometheus/grafana setup.
If im not mistaken PMM would be an entirely new deployment, an alternative to our existing kube-prometheus-stack setup.