exporter_type: standalone
app_name_short: MongoDB
app_name: {{app_name_short}}
app_site_name: {{app_name_short}}
app_site_url: https://www.mongodb.com/
exporter_name: {{app_name_short}}
exporter_pkg_name: mongodb_exporter
exporter_repo_url: https://github.com/percona/mongodb_exporter
dashboard_available: true
minimum_exporter_version: "0.20"
multiple_dashboards: false
dashboard_display_name: {{app_name_short}} Prometheus Overview
standalone_config: |
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: mongodb-exporter
    labels:
      app.kubernetes.io/name: mongodb-exporter
  spec:
    replicas: 1
    selector:
      matchLabels:
        app.kubernetes.io/name: mongodb-exporter
    template:
      metadata:
        labels:
          app.kubernetes.io/name: mongodb-exporter
      spec:
        containers:
        - name: exporter
          image: percona/mongodb_exporter:0.39
          args:
          - --mongodb.uri=mongodb://user:password@mongodb-service-name:27017
          - --collect-all
          ports:
          - name: prometheus
            containerPort: 9216
            protocol: TCP
additional_install_info: |
  The {{app_name_short}} exporter is configurable with
  [flags]({{exporter_repo_url}}#configuration){:class="external"},
  which can be set as container args. You can adjust your exporter's configuration
  to suit your {{app_name_short}} configuration.
  Update the `--mongodb.uri` flag to match your environment's username, password,
  and clusterIP service name.
  The flag `--collect-all` is specified in the example and there are [other flags 
  available](https://github.com/percona/mongodb_exporter/blob/main/REFERENCE.md#flags) to tune metric collection.

podmonitoring_config: |
  apiVersion: monitoring.googleapis.com/v1
  kind: PodMonitoring
  metadata:
    name: mongodb
    labels:
      app.kubernetes.io/name: mongodb
      app.kubernetes.io/part-of: google-cloud-managed-prometheus
  spec:
    endpoints:
    - port: prometheus
      scheme: http
      interval: 30s
      path: /metrics
    selector:
      matchLabels:
        app.kubernetes.io/name: mongodb-exporter
sample_promql_query: up{job="mongodb", cluster="{{cluster_name}}", namespace="{{namespace_name}}"}
alerts_config: |
  apiVersion: monitoring.googleapis.com/v1
  kind: Rules
  metadata:
    name: mongodb-rules
    labels:
      app.kubernetes.io/component: rules
      app.kubernetes.io/name: mongodb-rules
      app.kubernetes.io/part-of: google-cloud-managed-prometheus
  spec:
    groups:
    - name: mongodb
      interval: 30s
      rules:
      - alert: MongoDBConnectionUtilizationNearMax
        annotations:
          description: |-
            MongoDB connection utilization near max
              VALUE = {{ $value }}
              LABELS: {{ $labels }}
          summary: MongoDB connection utilization near max (instance {{ $labels.instance }})
        expr: mongodb_sys_netstat_Tcp_CurrEstab >= 50000
        for: 5m
        labels:
          severity: warning
      - alert: MongoDBDown
        annotations:
          description: |-
            MongoDB is down
              VALUE = {{ $value }}
              LABELS: {{ $labels }}
          summary: MongoDB is down (instance {{ $labels.instance }})
        expr: mongodb_up < 1
        for: 5m
        labels:
          severity: critical
additional_alert_info: You can adjust the alert thresholds to suit your application.
