Deploying PMM Server with Docker Compose and Configuring MySQL Monitoring

Prerequisites

Ensure Docker and Docker Compose are properly instaled and configured on your host machine before proceeding.

1. Configuring PMM Server via Docker Compose

Create a docker-compose.yaml file to define the PMM server service. The configuration below sets up persistent storage, necessary privileges, and exposes the required ports for web access, metrics, and database connectivity.

version: '3.8'

services:
  pmm_core:
    image: percona/pmm-server:2
    container_name: pmm_server_instance
    cap_add:
      - SYS_PTRACE
    security_opt:
      - seccomp:unconfined
    ulimits:
      memlock: 67108864
    ports:
      - "80:80"
      - "443:443"
      - "2345:2345"
      - "15432:5432"
      - "9090:9090"
      - "11000:9000"
      - "11123:8123"
    volumes:
      - ./pmm_storage:/srv
    networks:
      - monitor_net
    restart: always

networks:
  monitor_net:
    external: true

2. Launching and Verifying the Server

Start the PMM server container in detached mode:

docker compose up -d

Confirm that the container is running correctly:

docker compose ps

3. Accessing the Web Interface

Navigate to the PMM dashboard using your browser:

URL: https://your_server_ip/
Default Credentials: admin / admin

4. Installing the PMM Client

On the database server you wish to monitor, download and install the PMM client package. For example, on an RHEL-based system, you can install it locally:

dnf localinstall pmm2-client-2.41.0-6.el9.x86_64.rpm -y

5. Registering the Client with the Server

Configure the local PMM agent to communicate with the PMM server using TLS:

pmm-admin config --server-insecure-tls --server-url=https://admin:admin@your_server_ip/

A successful registration will output:

Checking local pmm-agent status...
pmm-agent is running.
Registering pmm-agent on PMM Server...
Registered.
Configuration file /usr/local/percona/pmm2/config/pmm-agent.yaml updated.
Reloading pmm-agent configuration...
Configuration reloaded.

6. Preparing the MySQL Monitoring User

Log into your MySQL instance and create a dedicated user for metrics collection with the appropriate permissions:

CREATE USER 'pmm_monitor'@'localhost' IDENTIFIED BY 'secure_pass_123';
GRANT SELECT, PROCESS, SUPER, REPLICATION CLIENT, RELOAD ON *.* TO 'pmm_monitor'@'localhost';

7. Adding the MySQL Instance to PMM

Link the MySQL database to the monitoring system using the newly created credentials:

pmm-admin add mysql --username pmm_monitor --password 'secure_pass_123' production_db localhost:3306

You should receive confirmation that the service was added:

MySQL Service added.
Service ID  : /service_id/abc123-456-def
Service name: production_db

8. Verifying Monitored Services

Check the status of all registered services and agents on the client machine:

pmm-admin list

This command displays the service names, addresses, and agent statuses (such as node_exporter, mysqld_exporter, and vmagent), confirming that metrics are being actively pushed to the PMM server.

Tags: PMM docker Docker Compose Percona MySQL

Posted on Sat, 03 Oct 2026 16:12:03 +0000 by mark_kccs