PHP Developer News

Percona Monitoring and Management (PMM) 2.0.0-alpha1 Is Now Available

We are pleased to announce the launch of PMM 2.0.0-alpha1, Percona’s first Alpha release of our long-awaited PMM 2 project! We focused exclusively on MySQL support in our first Alpha (because we wanted to show progress sooner rather than later), and you’ll find updated MySQL dashboards along with enhancements to Query Analytics. We’ve also added better visibility regarding which services are registered with PMM Server, the client-side addition of a new agent called pmm-agent, and finally PMM Server is now exposing an API!

Query Analytics

Support for large environments – default view all queries from all instances

Filtering – display only the results matching filters – MySQL schema name, MySQL server instance

Sorting and more columns – now sort by any visible column. Add a column for any field exposed by the data source, for example add rows_examined, lock_time to your Overview

Queries source – MySQL PERFORMANCE SCHEMA (slow log coming in our next alpha around May 1st, 2019)

Labels – Prometheus now supports auto-discovered and custom labels

Inventory Overview Dashboard – Displays the agents, services, and nodes which are registered with PMM Server

API – View versions and list hosts using the API

pmm-agent – Provides secure remote management of the exporter processes and data collectors on the client

PMM 2 is still a work in progress – expect to see bugs and other missing features! We are aware of a number of issues, but please report any and all that you find to Percona’s JIRA.

Query Analytics Dashboard
Query Analytics Dashboard now defaults to display all queries on each of the systems that are configured for MySQL PERFORMANCE_SCHEMA, Slow Log, and MongoDB Profiler (this release includes support for MySQL PERFORMANCE SCHEMA only), and includes comprehensive filtering capabilities.
Query Analytics Overview
You’ll recognize some of the common elements in PMM 2 Query Analytics such as the Load, Count, and Latency columns, however there are new elements such as the filter box and more arrows on the columns which will be described further down:

Query Detail
Query Analytics continues to deliver detailed information regarding individual query performance:

Filter and Search By
Filtering panel on the left, or use the search by bar to set filters using key:value syntax, for example, I’m interested in just the queries that are executed in MySQL schema db3, I could then type d_schema:db3:

Sort by any column
This is a much requested feature from PMM Query Analytics and we’re glad to announce that you can sort by any column! Just click the small arrow to the right of the column name and

Add extra columns
Now you can add a column for each additional field which is exposed by the data source. For example you can add Rows Examined by clicking the + sign and typing or selecting from the available list of fields:

An important concept we’re introducing in PMM 2 is that when a label is assigned it is persisted in both the Metrics (Prometheus) and Query Analytics (Clickhouse) databases.  So when you browse a target in Prometheus you’ll notice many more labels appear – particularly the auto-discovered (replication_set, environment, node_name, etc.) and (soon to be released) custom labels via custom_label.

Inventory Dashboard
We’ve introduced a new dashboard with several tabs so that users are better able to understand which nodes, agents, and services are registered against PMM Server.  We have an established hierarchy with Node at the top, then Service and Agents assigned to a Node.

Nodes – Where the service and agents will run. Assigned a node_id, associated with a machine_id (from /etc/machine-id)

Examples: bare metal, virtualized, container

Services – Individual service names and where they run, against which agents will be assigned. Each instance of a service gets a service_id value that is related to a node_id

Examples: MySQL, Amazon Aurora MySQL
You can also use this feature to support multiple mysqld instances on a single node, for example: mysql1-3306, mysql1-3307

Agents – Each binary (exporter, agent) running on a client will get an agent_id value

pmm-agent is the top of the tree, assigned to a node_id
node_exporter is assigned to pmm-agent agent_id
mysqld_exporter & QAN MySQL Perfschema are assigned to a service_id
Examples: pmm-agent, node_exporter, mysqld_exporter, QAN MySQL Perfschema

You can now see which services, agents, and nodes are registered with PMM Server.
In this example I have PMM Server (docker) running on the same virtualized compute instance as my Percona Server 5.7 instance, so PMM treats this as two different nodes.

This example has two MySQL services configured:

For a monitored Percona Server instance, you’ll see an agent for each of:

QAN Perfschema


Query Analytics Filters
Query Analytics now provides you with the opportunity to filter based on labels. We’ are beginning with labels that are sourced from MySQL Performance Schema, but eventually will include all fields from MySQL Slow Log, MongoDB Profiler, and PostgreSQL views.  We’ll also be offering the ability to set custom key:value pairs which you’ll use when setting up a new service or instance with pmm-admin during the add ... routine.
Available Filters
We’re exposing four new filters in this release, and we show where we source them from and what they mean:

Filter name

MySQL Slow Log
MySQL PERFORMANCE_SCHEMA doesn’t include client host, so this field will be empty

MySQL Slow Log
MySQL PERFORMANCE_SCHEMA doesn’t include username, so this field will be empty

MySQL Slow Log
MySQL Perfschema

MySQL Schema name

MySQL Slow Log
MySQL Perfschema

MySQL server instance

We are exposing an API for PMM Server! You can view versions, list hosts, and more!
The API is not guaranteed to work until we get to our GA release – so be prepared for breaking changes during our Alpha and Beta releases.
Browse the API using Swagger at /swagger

Installation and configuration
Install PMM Server with docker
The easiest way to install PMM Server is to deploy it with Docker. You can run a PMM 2 Docker container with PMM Server by using the following commands (note the version tag of 2.0.0-alpha1):
docker create -v /srv --name pmm-data-2-0-0-alpha1 perconalab/pmm-server:2.0.0-alpha1 /bin/true
docker run -d -p 80:80 -p 443:443 --volumes-from pmm-data-2-0-0-alpha1 --name pmm-server-2.0.0-alpha1 --restart always perconalab/pmm-server:2.0.0-alpha1

Install PMM Client
Since PMM 2 is still not GA, you’ll need to leverage our experimental release of the Percona repository. You’ll need to download and install the official percona-release package from Percona, and use it to enable the Percona experimental component of the original repository. Specific instructions for a Debian system are as follows:
sudo dpkg -i percona-release_latest.generic_all.deb
Now enable the correct repo:
sudo percona-release disable all
sudo percona-release enable original experimental
Now install the pmm2-client package:
apt-get update
apt-get install pmm2-client
See percona-release official documentation for details.
Please note that having experimental packages enabled may affect further packages installation with versions which are not ready for production. To avoid this, disable this component with the following commands:
sudo percona-release disable original experimental
sudo apt-get update

Configure PMM
Once PMM Client is installed, run the pmm-admin setup command with your PMM Server IP address to register your Node within the Server:
# pmm-agent setup --server-insecure-tls --server-address=<IP Address>:443
We will be moving this functionality back to pmm-admin config in a subsequent Alpha release.
You should see the following:
Checking local pmm-agent status...
pmm-agent is running.
Registering pmm-agent on PMM Server...
Configuration file /usr/local/percona/pmm-agent.yaml updated.
Reloading pmm-agent configuration...
Configuration reloaded.
You then add MySQL services (Metrics and Query Analytics) with the following command:
# pmm-admin add mysql --use-perfschema --username=pmm --password=pmm
where username and password are credentials for the monitored MySQL access, which will be used locally on the database host.
After this you can view MySQL metrics or examine the added node on the new PMM Inventory Dashboard:
You can then check your MySQL dashboards and Query Analytics in order to view your server’s performance information!
We hope you enjoy this release, and we welcome your comments on the blog!
About PMM
Percona Monitoring and Management (PMM) is a free and open-source platform for managing and monitoring MySQL®, MongoDB®, and PostgreSQL performance. You can run PMM in your own environment for maximum security and reliability. It provides thorough time-based analysis for MySQL®, MongoDB®, and PostgreSQL® servers to ensure that your data works as efficiently as possible.
Help us improve our software quality by reporting any Percona Monitoring and Management bugs you encounter using our bug tracking system.