Skip to content

Monitor database with Percona Monitoring and Management (PMM)

In this section you will learn how to monitor Percona Server for MySQL cluster with Percona Monitoring and Management (PMM) .

Note

Only PMM 2.x versions are supported by the Operator.

PMM is a client/server application. It includes the PMM Server and the number of PMM Clients running on each node with the database you wish to monitor.

A PMM Client collects needed metrics and sends gathered data to the PMM Server. As a user, you connect to the PMM Server to see database metrics on a number of dashboards.

PMM Server and PMM Client are installed separately.

Install PMM Server

You must have PMM Server up and running. You can run PMM Server as a Docker image, a virtual appliance, or on an AWS instance. Please refer to the official PMM documentation for the installation instructions.

Install PMM Client

The following steps are needed for the PMM Client installation as a side-car container in your Kubernetes-based environment:

  1. Authorize PMM Client within PMM Server.

    1. Acquire the API Key from your PMM Server . Specify the Admin role when getting the API Key.

      Warning: The API key is not rotated automatically.

    2. Set pmmserverkey in the users Secrets object to this obtained API Key value. For example, setting the PMM Server API Key to new_key in the cluster1-secrets object can be done with the following command:

      $ kubectl patch secret/cluster1-secrets -p '{"data":{"pmmserverkey": '$(echo -n new_key | base64 --wrap=0)'}}'
      
      $ kubectl patch secret/cluster1-secrets -p '{"data":{"pmmserverkey": '$(echo -n new_key | base64)'}}'
      
  2. Update the pmm section in the deploy/cr.yaml file:

    • Set pmm.enabled=true.
    • Specify your PMM Server hostname or an IP address for the pmm.serverHost option. The PMM Server IP address should be resolvable and reachable from within your cluster.

    pmm:
      enabled: true
      image: percona/pmm-client:{{pmm2recommended}}
      serverHost: monitoring-service
    
    3. Apply the changes:

    $ kubectl apply -f deploy/cr.yaml -n <namespace>
    
  3. Check that corresponding Pods are not in a cycle of stopping and restarting. This cycle occurs if there are errors on the previous steps:

    $ kubectl get pods -n <namespace>
    $ kubectl logs  <cluster-name>-mysql-0 -c pmm-client -n <namespace>
    

Check the metrics

Let’s see how the collected data is visualized in PMM.

Now you can access PMM via https in a web browser, with the login/password authentication, and the browser is configured to show Percona Server for MySQL metrics.

Get expert help

If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services. Join K8S Squad to benefit from early access to features and “ask me anything” sessions with the Experts.


Last update: 2024-10-29