How to monitor MongoDB replica set using Prometheu

Source: Internet
Author: User
Tags install mongodb mongodb install node grafana


How to monitor MongoDB replica set using Prometheus



There are many ways to monitor MongoDB replica set:


    • Using Zabbix template to view MongoDB data (Zabbix+grafana)
    • MongoDB official own but now charge for
    • Prometheus collects data through Mongodb-exporter and then uses Grafana to display data (Prometheus+grafana)
    • etc...
Install Prometheus
    • See detail from official:https://prometheus.io/docs/introduction/first_steps/
    • How to install Prometheus on Docker on ubuntu14.04:https://www.digitalocean.com/community/tutorials/ how-to-install-prometheus-using-docker-on-ubuntu-14-04
    • Pull Docker Images From:https://store.docker.com/community/images/prom/prometheus
Simple Configure file
?  prometheus-2.3.1.linux-amd64 cat prometheus.yml|awk ‘{if($0 !~ /^$/ && $0 !~ /^#/) {print $0}}‘
global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: ‘prometheus‘
    # metrics_path defaults to ‘/metrics‘
    # scheme defaults to ‘http‘.
    static_configs:
    - targets: [‘localhost:9090‘]
  - job_name: ‘node-exporter‘
    static_configs:
    - targets: [‘localhost:9100‘]
  - job_name: ‘mongodb-exporter‘
    static_configs:
    - targets: [‘localhost:9001‘]
Install Node-exporter
    • Exporters and intergrations:https://prometheus.io/docs/instrumenting/exporters/
Install Mongodb-exporter
    • Exporters and intergrations:https://prometheus.io/docs/instrumenting/exporters/
    • Mongodb-exporter:https://github.com/dcu/mongodb_exporter
    • Download Mongodb-exporter release:https://github.com/dcu/mongodb_exporter/releases/download/v1.0.0/mongodb_ Exporter-linux-amd64
Run Mongodb-exporter
?  prometheus ./mongodb_exporter -mongodb.uri mongodb://192.168.152.128:27017,192.168.152.128:27018,192.168.152.128:27019
Listening on :9001 (scheme=HTTP, secured=no, clientValidation=no)


You also can run the multi mongodb-exporter process to get the metrics of the simple MongoDB instance. If so. You should add multi job_name in Prometheus.yml. You can monitor every simple MongoDB instance details in Grafana by setting dashboard variables.


Insatll Grafana
    • See Official docs:http://docs.grafana.org/installation/debian/
Configure DashBoard
    • Download Grafana Dashboard template json file:https://grafana.com/api/dashboards/2583/revisions/2/download


How to monitor MongoDB replica set using Prometheu


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.