aster.cloud aster.cloud
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
    • Learning
  • Tools
  • About
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
    • Learning
  • Tools
  • About
aster.cloud aster.cloud
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
    • Learning
  • Tools
  • About
  • Computing
  • Engineering
  • Technology

Efficient Dockerized Database Monitoring With Dockerized PMM

  • aster.cloud
  • August 4, 2023
  • 2 minute read

Are you tired of manually monitoring your local databases? Do you want an easy and quick solution to monitor your Dockerized databases? In this article, we will guide you through the process of setting up Percona Monitoring and Management (PMM) with Docker to monitor your local Dockerized databases.


First things first, we need to create a Docker network for monitoring:


Partner with aster.cloud
for your next big idea.
Let us know here.



From our partners:

CITI.IO :: Business. Institutions. Society. Global Political Economy.
CYBERPOGO.COM :: For the Arts, Sciences, and Technology.
DADAHACKS.COM :: Parenting For The Rest Of Us.
ZEDISTA.COM :: Entertainment. Sports. Culture. Escape.
TAKUMAKU.COM :: For The Hearth And Home.
ASTER.CLOUD :: From The Cloud And Beyond.
LIWAIWAI.COM :: Intelligence, Inside and Outside.
GLOBALCLOUDPLATFORMS.COM :: For The World's Computing Needs.
FIREGULAMAN.COM :: For The Fire In The Belly Of The Coder.
ASTERCASTER.COM :: Supra Astra. Beyond The Stars.
BARTDAY.COM :: Prosperity For Everyone.

docker network create monitorization_pmm_local

Next, we will define a minimal Docker Compose file to start the PMM service:

version: '3.7'

services:
    pmm-server:
        image: percona/pmm-server:2
        hostname: pmm-server
        container_name: pmm-server
        restart: always
        logging:
            driver: json-file
            options:
                max-size: "10m"
                max-file: "5"
        ports:
            - "443:443"

Start the PMM service with the following command:

docker-compose up -d

Once the PMM container is up and running, we can access the PMM web-admin interface by visiting https://localhost:443/graph. The initial credentials are admin/admin, and you will be prompted to change the password upon the first login. For this example, we will keep the password unchanged.

Connect the PMM container to the monitorization_pmm_local network:

docker network connect monitorization_pmm_local pmm-server

Now it’s time to set up monitoring for our Dockerized databases. Let’s try with MySQL:

version: "3.7"

services:
  mysql:
    container_name: mysql-playground
    image: mysql:latest
    command: --default-authentication-plugin=mysql_native_password
    ports:
      - 3306:3306
    environment:
      MYSQL_DATABASE: playground
      MYSQL_ROOT_USER: root
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: test
      MYSQL_PASSWORD: test

Connect the MySQL container to the monitorization_pmm_local network:

docker network connect monitorization_pmm_local mysql-playground

Identify the IP address of the MySQL container within the Docker network:

docker network inspect monitorization_pmm_local

In this example, we will assume that the IP address of the MySQL container is 192.168.240.3 and the IP address of the PMM container is 192.168.240.2.

Create a user for PMM to use to monitor the MySQL container:

docker exec -it mysql-playground mysql -uroot -proot
mysql> CREATE USER 'pmm'@'192.168.240.2' IDENTIFIED BY 'pmmpassword' WITH MAX_USER_CONNECTIONS 10;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'pmm'@'192.168.240.2' WITH GRANT OPTION;

Note that we are creating a user with the name pmm and granting it all privileges on all databases. You can check the user’s privileges with the following command:

mysql> show grants for 'pmm'@'192.168.240.2';
+-----------------------------------------------------------------------------------+
| Grants for [email protected]                                                      |
+-----------------------------------------------------------------------------------+
| GRANT SELECT, RELOAD, PROCESS, REPLICATION CLIENT ON *.* TO `pmm`@`192.168.240.2` |
| GRANT BACKUP_ADMIN ON *.* TO `pmm`@`192.168.240.2`                                |
+-----------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

Finally, register the MySQL container with PMM using the following command:

docker exec -i pmm-server pmm-admin add mysql --username=pmm --password=pmmpassword --query-source=perfschema --server-url=https://admin:[email protected]:443 --server-insecure-tls --host 192.168.240.3 --port 3306 --service-name mysql-playground-pmm

And that’s it! You can now monitor your Dockerized MySQL container using PMM, and adapt this process for any other Dockerized databases you want to monitor like PostgreSQL or MongoDB.

Read More  eero Introduces Its Fastest Mesh Wifi Systems—eero Pro 6E And eero 6+

In conclusion, with just a few commands, we were able to set up PMM with Docker to monitor our local databases.

This is a quick and easy solution for anyone who wants to monitor their Dockerized databases.

By: David E.
Originally published at Hackernoon

Source: cyberpogo.com


For enquiries, product placements, sponsorships, and collaborations, connect with us at [email protected]. We'd love to hear from you!

Our humans need coffee too! Your support is highly appreciated, thank you!

aster.cloud

Related Topics
  • Containerization
  • Data Science
  • Database
  • Docker
  • MySQL
  • Percona Monitoring and Management
You May Also Like
View Post
  • Computing
  • Multi-Cloud
  • Technology

Pure Accelerate 2025: All the news and updates live from Las Vegas

  • June 18, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

‘This was a very purposeful strategy’: Pure Storage unveils Enterprise Data Cloud in bid to unify data storage, management

  • June 18, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

What is cloud bursting?

  • June 18, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

There’s a ‘cloud reset’ underway, and VMware Cloud Foundation 9.0 is a chance for Broadcom to pounce on it

  • June 17, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

What is confidential computing?

  • June 17, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

Oracle adds xAI Grok models to OCI

  • June 17, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

Fine-tune your storage-as-a-service approach

  • June 16, 2025
View Post
  • Technology

Advanced audio dialog and generation with Gemini 2.5

  • June 15, 2025

Stay Connected!
LATEST
  • 1
    Pure Accelerate 2025: All the news and updates live from Las Vegas
    • June 18, 2025
  • 2
    ‘This was a very purposeful strategy’: Pure Storage unveils Enterprise Data Cloud in bid to unify data storage, management
    • June 18, 2025
  • What is cloud bursting?
    • June 18, 2025
  • 4
    There’s a ‘cloud reset’ underway, and VMware Cloud Foundation 9.0 is a chance for Broadcom to pounce on it
    • June 17, 2025
  • What is confidential computing?
    • June 17, 2025
  • Oracle adds xAI Grok models to OCI
    • June 17, 2025
  • Fine-tune your storage-as-a-service approach
    • June 16, 2025
  • 8
    Advanced audio dialog and generation with Gemini 2.5
    • June 15, 2025
  • 9
    A Father’s Day Gift for Every Pop and Papa
    • June 13, 2025
  • 10
    Global cloud spending might be booming, but AWS is trailing Microsoft and Google
    • June 13, 2025
about
Hello World!

We are aster.cloud. We’re created by programmers for programmers.

Our site aims to provide guides, programming tips, reviews, and interesting materials for tech people and those who want to learn in general.

We would like to hear from you.

If you have any feedback, enquiries, or sponsorship request, kindly reach out to us at:

[email protected]
Most Popular
  • Google Cloud, Cloudflare struck by widespread outages
    • June 12, 2025
  • What is PC as a service (PCaaS)?
    • June 12, 2025
  • 3
    Crayon targets mid-market gains with expanded Google Cloud partnership
    • June 10, 2025
  • By the numbers: Use AI to fill the IT skills gap
    • June 11, 2025
  • 5
    Apple services deliver powerful features and intelligent updates to users this autumn
    • June 11, 2025
  • /
  • Technology
  • Tools
  • About
  • Contact Us

Input your search keywords and press Enter.