how can I add the mongodb exporter job to my prometheus running as a pod in kubernetes

29 Views Asked by At

Right now when I edit the Prometheus configmap and add the mongodb exporter job, it shows that its edited but not saved. I know this because when I try to edit the configmap again, the job I added will not be there. My prometheus is deployed using ArgoCD and has auto sync on.

I have thought if the auto sync is the issue and tried to create a new ArgoCD application manifest file add ing the mongodb exporter job. When the prometheus is deployed and I check the configmap for the prometheus, I dont see the mongodb exporter job.

This is my ArgoCD application manifest

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: prometheus
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  destination:
    namespace: monitoring
    server: https://kubernetes.default.svc
  project: default
  sources:
    - repoURL: https://github.com/Okeybukks/hostspace-internship-capstone-project.git
      targetRevision: HEAD
      ref: main
      path: monitoring
    - repoURL: https://prometheus-community.github.io/helm-charts/
      chart: prometheus
      targetRevision: 25.18.0
      helm:
        values: |
          scrape_configs:
            - job_name: 'mongodb'
              static_configs:
                - targets:
                  - mongodb-exporter-prometheus-mongodb-exporter:9216
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true

What am I doing wrong, the mongodb exporter job has refused to be added.

I have tried editing the prometheus configmap to add the job and also added the job directly to my helm values during deployment. But the job doesnt just get added to the scrape config of prometheus.

0

There are 0 best solutions below