How to Set up MongoDB Monitoring with PMM

Share This Post

How to Set Up MongoDB Monitoring with PMM

1. Prepare your environment. Before you get started setting up MongoDB to connect to PMM monitoring, you need to have a PMM Client and register it on the PMM Server. Let’s do it.  You may set up the PMM Client in different ways. It can be either running in a Docker container or installed by a package manager or from sources. In this article, we will use the easiest way — we will install it from the repository using a package manager. Make sure you have curl, gnupb, wget, and sudo installed on your server. First of all, you need to add the Percona repo to your repositories list.  For Debian-based OS a. Configure repositories:

dpkg -i percona-release_latest.generic_all.deb

 b. Install hpmm-client package:

apt update
apt install -y pmm2-client

c. Check if it was installed correctly:

pmm-admin --version

For RedHat-based OS 1. Configure repositories:

yum install -y

b. Install hpmm-client package:

yum install -y pmm2-client

c. Check if it was installed correctly:

pmm-admin --version

After you have installed the PMM Client, you should register it on your server. You need the HPMM server hostname or IP-address and credentials for your connection. You may find this information on your hostedpmm private cabinet.    To register the PMM client on the server, just type:

pmm-admin config --server-insecure-tls --server-url=https://admin:<password>@XXX.XXX.XXX.XXX:443 YYY.YYY.YYY.YYY generic mynode

  where XXX.XXX.XXX.XXX — IP address or hostname of PMM server, YYY.YYY.YYY.YYY — IP address or hostname of PMM client, generic — client type and mynode — mane of client. 2.  Configure MongoDB After MongoDB and the PMM client are installed, you need to have a user with proper privileges. You may add a user in the Mongo session:

    role: "explainRole",
    privileges: [{
        resource: {
            db: "",
            collection: ""
        actions: [

   user: "pmm_mongodb",
   pwd: "password",
   roles: [
      { role: "explainRole", db: "admin" },
      { role: "clusterMonitor", db: "admin" },
      { role: "read", db: "local" }

If you want to use PMM Query Analytics, you should turn on the profiling feature. To make this setting permanent, edit /etc/mongod.conf adding operationProfiling section:

  mode: all
  slowOpThresholdMs: 200
 rateLimit: 100 # (Only available with Percona Server for MongoDB.)

Restart mongod service

systemctl restart mongod

After that, you are ready to connect your MongoDB to PMM monitoring. To do that run: 

pmm-admin add mongodb \
--username=pmm_mongodb --password=password \
--query-source=profiler --cluster=mycluster

You may add –environment and -custom-label options to set tags for the service to help identify them.

After successful adding, you may find your service on the PMM Server in Configuration -> PMM Inventory -> Inventory list or check on the client using the command:

pmm-admin inventory list services --service-type=mongodb

And now you should see your MongoDB on your monitoring panel.

HostedPMM Services

Now that you have MongoDB monitoring with PMM set up, you are free to focus on other important issues with your business. HostedPMM offers hosted PMM servers for monitoring, automation, troubleshooting, and convenience for all your database needs. We provide servers for PMM to help your business. You can get your own PMM server, connect your instances, and focus on your project with HostedPMM.

Get started with HostedPMM for free and enjoy more organized, adaptable, optimized, and secure database solutions. We offer quick setup, tech support, backups, scalability, security updates, high availability, and no vendor restrictions.

If you have any questions or need assistance with HostedPMM, contact us at for support.

Related Posts:

How to set up open-source DB monitoring using PMM?

More To Explore

How to choose a database for backend

Each database management system has its pros and cons, they must be taken into account when choosing a particular database for your application. You need

How to set up alerts using PMM

Percona Monitoring and Management allows you to set different alerts related to your infrastructure.  Before we start setting up alerting, lets make sure this option

Get hosted PMM® server in a few clicks

We’ll take care of deployment, hosting, updates, backups, and support.
Start now and get 1 month free of charge.

database monitoring