Reputation: 7925
I want to monitor my MongoDb with prometheus. I currently have my MongoDb deployed like this
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongodb-deployment
labels:
app: mongodb
spec:
replicas: 1
selector:
matchLabels:
app: mongodb
template:
metadata:
labels:
app: mongodb
spec:
containers:
- name: mongodb
image: mongo
ports:
- containerPort: 27017
env:
# These variables, used in conjunction, create a new user and set that user's password (From Mongo Docker Image)
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: mongodb-secret
key: mongo-root-username
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mongodb-secret
key: mongo-root-password
and this service
apiVersion: v1
kind: Service
metadata:
name: mongodb-service
spec:
selector:
app: mongodb
ports:
- protocol: TCP
port: 27017
targetPort: 27017
And I installed prometheus via helm
helm install stable/prometheus-operator
I know about this MongoDb Helm chart https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus-mongodb-exporter
. But to my understanding, this installs MongoDb and the MongoDb Exporter, so because I have MongoDb already setup, this is of no use for me, right?
What are the steps to install only the Mongo Exporter and connect it with my Mongo Database? All I know is, I need to create a ServiceMonitor
that has a label of release: prometheus-operator-1602753506
.
Sorry for this beginner question, I'm still very new to kubernetes and helm, so I'm quite confused at this point
Upvotes: 2
Views: 6323
Reputation: 207
The helm chart does not install mongodb, it requires some configurations to be able to connect to mongodb and pull metrics from it. Also it's stated that the helm chart comes with its own service monitor so you don't need to create a new one:
Upvotes: 2