Setting up PMM on Google Compute Engine in 15 minutes or less

Setting up PMM on Google Compute Engine in 15 minutes or less


In this blog post, I will show you how easy it is to set up a Percona Monitoring and Management server on Google Compute Engine from the command line.

First off you will need to have a Google account and install the Cloud SDK tool. You need to create a GCP (Google Cloud Platform) project and enable billing to proceed. This blog assumes you are able to authenticate and SSH into instances from the command line.

Here are the steps to install PMM server in Google Cloud Platform.

1) Create the Compute engine instance with the following command. The example creates an Ubuntu Xenial 16.04 LTS compute instance in the us-west1-b zone with a 100GB persistent disk. For production systems it would be best to use a 500GB disk instead (size=500GB). This should be enough for default data retention settings, although your needs may vary.

Notice that we’ve used --metadata-from-file  The file has the following contents:

This startup script will be executed right after the compute instance is created. The script will format the persistent disk and mount the file system; create a custom Docker unit file for the purpose of creating Docker’s root directory from /var/lib/docker to /mnt/disks/pdssd/docker; install the Docker package; and create the script.

2) Once the compute engine instance is created, SSH into the instance, check that Docker is running and the root directory pointing to the desired folder.

3) Add your user to the docker group as shown below and change script to executable.

4) Log off from the instance, and then log back in and then execute the script.

5) Finally, create a firewall rule to allow HTTP port 80 to access the PMM Server. For security reasons, we recommend that you secure your PMM server by adding a password, or limit access to it with a stricter firewall rule to specify which IP addresses can access port 80.

At this point you should have a PMM Server in GCP running on a Compute Engine instance.

The next steps is to install pmm-client on the database hosts and add services for monitoring.

Here I’ve launched a single standalone Percona Server 5.6 on another Compute Engine instance in the same project (thematic-acumen-204008).

Installed Percona Server 5.6 and pmm-client and then added services. Take note that since the PMM Server and the MySQL server is in the same project and same VPC network, we can connect directly through INTERNAL_IP, otherwise use the EXTERNAL_IP

Lastly, in case you need to delete the PMM Server instance. Just execute this delete command below to completely remove the instance and the attached disk. Be aware that you may remove the boot disk and retain the attached persistent disk if you prefer.

The other option is to install PMM on Google Container engine which was explained by Manjot Singh in his blog post.


Share this post

Comments (2)

  • Renan Benedicto Pereira Reply

    Hi Jericho.

    This configuration (n1-standard-4 + 500gb) is about collecting from how many instances ?
    I’ve made this steps above using exactly the same configurations and added 15 RDS instances.
    Then it started to use 100% of CPU after 4 days uptime, in an interval of 1 hour aproximattely.

    My pmm docker is running with the configuration bellow:

    docker run -d -p 80:80 –volumes-from pmm-data –name pmm-server –restart always -e METRICS_RESOLUTION=5s -e METRICS_RETENTION=360h -e QUERIES_RETENTION=360h percona/pmm-server:latest

    September 19, 2018 at 1:34 pm
  • Jeferson Reply

    Is there a way to monitor Google CloudSQL with PMM? I have used PMM(QAN <3) and it worked great, now I want to monitor some instances that I have on CloudSQL, is that possible? Can I monitor RDS also?

    October 16, 2018 at 1:02 pm

Leave a Reply