It’s very easy to install Percona Monitoring and Management (PMM) on DigitalOcean. If you’ve never used DigitalOcean before, you will find that it is user-friendly and not very expensive. For $5/month you can easily host your PMM on it, letting you monitor your simple infrastructure or try out PMM before implementing it to monitor your production environments.
Let’s prepare the DigitalOcean instance
Log in to DigitalOcean (DO) control panel and click “Create Droplet.”
Thanks to DO you can skip the boring OS setup and save time by using the Docker “One click app” in DO and the Docker image from PMM.
Note: After clicking on “Docker…” choose an instance size that accommodates your budget – PMM can run on as little as the 1GB 1vCPU instance!
Note: Scroll again!
Next step – select a nearby region
Since the next Percona Live Europe, 2018 will be in Frankfurt (https://www.percona.com/blog/2018/04/05/percona-live-europe-2018-save-the-date/ ) for me the location choice is obvious.
The final step in this section is ‘Set Hostname’
I recommend you add ‘pmm-server-‘ at the beginning so that you can easily find it in your control panel. The name in my case is ‘pmm-server-docker-s-1vcpu-1gb-fra1-01’ and I’ll use it later in this tutorial.
Click “Create” and wait a while.You can follow the process on the dashboard:
When the Droplet is created, you’ll get an email with your login details.
The next step is ‘Set up PMM into the Droplet’
SSH to the server, change the password, and let’s prepare to install the PMM server.
================== random@random-vb:~$ ssh root@X.X.X.X ... "ufw" has been enabled. All ports except 22 (SSH), 80 (http) and 443 (https) have been blocked by default. ... Changing password for root. (current) UNIX password: Enter new UNIX password: Retype new UNIX password: root@pmm-server-docker-s-1vcpu-1gb-fra1-01:~# ====================
Note the output for the first login. You are getting Ubuntu 16.04 with pre-installed Docker.
The instructions for installing PMM are very simple. You can read them at https://www.percona.com/doc/percona-monitoring-and-management/deploy/server/docker.html
1) Pull the latest version from Docker Hub:
docker pull percona/pmm-server:latest
Wait for some time (this depends on your internet connection)
2) Create a container for persistent PMM data
docker create -v /opt/prometheus/data -v /opt/consul-data -v /var/lib/mysql -v /var/lib/grafana --name pmm-data percona/pmm-server:latest /bin/true
3) Create and launch PMM Server in one command
docker run -d -p 80:80 --volumes-from pmm-data --name pmm-server --restart always percona/pmm-server:latest
Just to confirm that your containers are available, go ahead and run “docker ps.” You’ll see something like this:
root@pmm-server-docker-s-1vcpu-1gb-fra1-01:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 5513858041f7 percona/pmm-server:latest "/opt/entrypoint.sh" 2 minutes ago Up 2 minutes 0.0.0.0:80->80/tcp, 443/tcp pmm-server
That’s all! Congratulations! Your PMM server is running.
If you open the IP of your server in the browser, you’ll see something like this:
There you can see that PMM has already started monitoring itself.
Now you need to install PMM client on your database server and configure it, instructions for this are at https://www.percona.com/doc/percona-monitoring-and-management/deploy/client/index.html
Please note, if you also use DO for the database server by external IP, you’ll probably face “the firewall problem.” In this case, you need to open ports using the “ufw” tool. (See the welcome message from Digital Ocean). For testing purposes, you can use
ufw allow 42000:42999/tcp
To open only pmm-client related ports, follow https://www.percona.com/doc/percona-monitoring-and-management/glossary.terminology.html#term-ports To run ufw, you need to use the terminal, and you can find more information about ufw at https://www.digitalocean.com/community/tutorials/ufw-essentials-common-firewall-rules-and-commands Once you have opened up the ports, PMM should now work correctly for this setup.
Final recommendation: Depending on your load you may need to monitor your System Overview dashboard which you’ll find at http://X.X.X.X/graph/somesymbols/system-overview
If you are out of space, upgrade your DO Droplet.