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 Couchbase DB 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
  • Engineering

Just make it scale: An Aurora DSQL story

  • May 29, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

Reliance on US tech providers is making IT leaders skittish

  • May 28, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

Examine the 4 types of edge computing, with examples

  • May 28, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

AI and private cloud: 2 lessons from Dell Tech World 2025

  • May 28, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

TD Synnex named as UK distributor for Cohesity

  • May 28, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

Broadcom’s ‘harsh’ VMware contracts are costing customers up to 1,500% more

  • May 28, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

Weigh these 6 enterprise advantages of storage as a service

  • May 28, 2025
View Post
  • Computing
  • Multi-Cloud
  • Technology

Pulsant targets partner diversity with new IaaS solution

  • May 23, 2025

Stay Connected!
LATEST
  • 1
    Just make it scale: An Aurora DSQL story
    • May 29, 2025
  • 2
    Reliance on US tech providers is making IT leaders skittish
    • May 28, 2025
  • Examine the 4 types of edge computing, with examples
    • May 28, 2025
  • AI and private cloud: 2 lessons from Dell Tech World 2025
    • May 28, 2025
  • 5
    TD Synnex named as UK distributor for Cohesity
    • May 28, 2025
  • Weigh these 6 enterprise advantages of storage as a service
    • May 28, 2025
  • 7
    Broadcom’s ‘harsh’ VMware contracts are costing customers up to 1,500% more
    • May 28, 2025
  • 8
    Pulsant targets partner diversity with new IaaS solution
    • May 23, 2025
  • 9
    Growing AI workloads are causing hybrid cloud headaches
    • May 23, 2025
  • Gemma 3n 10
    Announcing Gemma 3n preview: powerful, efficient, mobile-first AI
    • May 22, 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
  • Understand how Windows Server 2025 PAYG licensing works
    • May 20, 2025
  • By the numbers: How upskilling fills the IT skills gap
    • May 21, 2025
  • 3
    Cloud adoption isn’t all it’s cut out to be as enterprises report growing dissatisfaction
    • May 15, 2025
  • 4
    Hybrid cloud is complicated – Red Hat’s new AI assistant wants to solve that
    • May 20, 2025
  • 5
    Google is getting serious on cloud sovereignty
    • May 22, 2025
  • /
  • Technology
  • Tools
  • About
  • Contact Us

Input your search keywords and press Enter.