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  How To Install And Configure PostgreSQL In Ubuntu

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

How to create an AWS free tier account

  • July 10, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

How to configure multiple AWS CLI authentication credentials

  • July 10, 2025
View Post
  • Technology

Formula E accelerates its work with Google Cloud Storage and Google Workspace

  • July 9, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

What is database as a service (DBaaS)?

  • July 7, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

The cloud’s role in PQC migration

  • July 7, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

Hybrid cloud has hit the mainstream – but firms are still confused about costs

  • July 7, 2025
View Post
  • Technology

Building secure, scalable AI in the cloud with Microsoft Azure

  • July 5, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

Turns out OpenAI is the customer behind Oracle’s mysterious $30 billion cloud deal

  • July 3, 2025

Stay Connected!
LATEST
  • How to create an AWS free tier account
    • July 10, 2025
  • How to configure multiple AWS CLI authentication credentials
    • July 10, 2025
  • 3
    Formula E accelerates its work with Google Cloud Storage and Google Workspace
    • July 9, 2025
  • What is database as a service (DBaaS)?
    • July 7, 2025
  • The cloud’s role in PQC migration
    • July 7, 2025
  • 6
    Hybrid cloud has hit the mainstream – but firms are still confused about costs
    • July 7, 2025
  • 7
    Building secure, scalable AI in the cloud with Microsoft Azure
    • July 5, 2025
  • 8
    Turns out OpenAI is the customer behind Oracle’s mysterious $30 billion cloud deal
    • July 3, 2025
  • aster-cloud-erp-bill_of_materials_2 9
    What is an SBOM (software bill of materials)?
    • July 2, 2025
  • aster-cloud-sms-pexels-tim-samuel-6697306 10
    Send SMS texts with Amazon’s SNS simple notification service
    • July 1, 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
  • 1
    A looming hyperscaler exodus? UK IT leaders are thinking of ditching US cloud providers – here’s why
    • June 26, 2025
  • Genome 2
    AlphaGenome: AI for better understanding the genome
    • June 25, 2025
  • aster-cloud-website-pexels-goumbik-574069 3
    Host a static website on AWS with Amazon S3 and Route 53
    • June 27, 2025
  • Camping 4
    The Summer Adventures : Camping Essentials
    • June 27, 2025
  • 6 edge monitoring best practices in the cloud
    • June 25, 2025
  • /
  • Technology
  • Tools
  • About
  • Contact Us

Input your search keywords and press Enter.