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  Seven Zero Trust Rules For Kubernetes

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
Getting things done makes her feel amazing
View Post
  • Computing
  • Data
  • Featured
  • Learning
  • Tech
  • Technology

Nurturing Minds in the Digital Revolution

  • April 25, 2025
View Post
  • People
  • Technology

AI is automating our jobs – but values need to change if we are to be liberated by it

  • April 17, 2025
View Post
  • Software
  • Technology

Canonical Releases Ubuntu 25.04 Plucky Puffin

  • April 17, 2025
View Post
  • Computing
  • Public Cloud
  • Technology

United States Army Enterprise Cloud Management Agency Expands its Oracle Defense Cloud Services

  • April 15, 2025
View Post
  • Technology

Tokyo Electron and IBM Renew Collaboration for Advanced Semiconductor Technology

  • April 2, 2025
View Post
  • Software
  • Technology

IBM Accelerates Momentum in the as a Service Space with Growing Portfolio of Tools Simplifying Infrastructure Management

  • March 27, 2025
View Post
  • Technology

IBM contributes key open-source projects to Linux Foundation to advance AI community participation

  • March 22, 2025
View Post
  • Technology

Co-op mode: New partners driving the future of gaming with AI

  • March 22, 2025

Stay Connected!
LATEST
  • college-of-cardinals-2025 1
    The Definitive Who’s Who of the 2025 Papal Conclave
    • May 7, 2025
  • conclave-poster-black-smoke 2
    The World Is Revalidating Itself
    • May 6, 2025
  • 3
    Conclave: How A New Pope Is Chosen
    • April 25, 2025
  • Getting things done makes her feel amazing 4
    Nurturing Minds in the Digital Revolution
    • April 25, 2025
  • 5
    AI is automating our jobs – but values need to change if we are to be liberated by it
    • April 17, 2025
  • 6
    Canonical Releases Ubuntu 25.04 Plucky Puffin
    • April 17, 2025
  • 7
    United States Army Enterprise Cloud Management Agency Expands its Oracle Defense Cloud Services
    • April 15, 2025
  • 8
    Tokyo Electron and IBM Renew Collaboration for Advanced Semiconductor Technology
    • April 2, 2025
  • 9
    IBM Accelerates Momentum in the as a Service Space with Growing Portfolio of Tools Simplifying Infrastructure Management
    • March 27, 2025
  • 10
    Tariffs, Trump, and Other Things That Start With T – They’re Not The Problem, It’s How We Use Them
    • March 25, 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
    IBM contributes key open-source projects to Linux Foundation to advance AI community participation
    • March 22, 2025
  • 2
    Co-op mode: New partners driving the future of gaming with AI
    • March 22, 2025
  • 3
    Mitsubishi Motors Canada Launches AI-Powered “Intelligent Companion” to Transform the 2025 Outlander Buying Experience
    • March 10, 2025
  • PiPiPi 4
    The Unexpected Pi-Fect Deals This March 14
    • March 13, 2025
  • Nintendo Switch Deals on Amazon 5
    10 Physical Nintendo Switch Game Deals on MAR10 Day!
    • March 9, 2025
  • /
  • Technology
  • Tools
  • About
  • Contact Us

Input your search keywords and press Enter.