Compiling a Percona Monitoring and Management v2 Client in ARM Architecture

Percona Monitoring and Management ARMIn this blog, we are going to see how to compile a Percona Monitoring and Management 2 (PMM v2) client in ARM. For this, we are going to use an AWS EC2 ARM instance with Amazon Linux 2.

Installing Dependencies

First, let’s get some basic packages out of the way, which probably are installed in your environment already:

And some needed for compiling:

Then, let’s download the necessary GitHub projects to our Go source path:

We will focus on getting some basic functionality in this round, so we’ll only install the OS metrics exporter. If needed, you can download and compile other exporters like MySQL, MongoDB, or PostgreSQL (which are listed on the GitHub PMM projects page).

Now let’s go ahead and install Go from their tar.gz distribution, since we will need the latest available versions, and package managers generally fall behind. I tried using package manager versions at first, but was getting errors due to outdated libraries due to it. If you want to try, go ahead, but know that if you get any errors it is very possible to be due to that.

If you need to set your Go path to something else than default (~/go/) you can read more about it in the How to Write Go Code (with GOPATH) documentation section. Note that PMM doesn’t support the use of Go Modules yet.

Compiling

Ok, we are ready to begin our first compilation! We’ll begin with the pmm-admin tool:

This process should be straightforward and proceed without errors. Then we can compile pmm-agent. In this case, we encounter the first caveat. The error we would get is linked to the pg_query_go module, and is fully documented in its own GitHub issue:

https://github.com/lfittl/pg_query_go/issues/27 

We will use that workaround until there is better support for ARM in the future (note how we added a step in the middle, that involves getting a file with wget). We are now tracking this under Jira ticket PMM-6384.

After this, the last step is to build the node_exporter:

Finally, let’s move the generated binaries under the correct paths:

And since we are on it, let’s create the following directories to avoid unnecessary errors (and logs being flooded) down the line:

Starting the PMM Client

We are now all set, and ready to set up the PMM client! The following steps will need root privileges, so we log in as root as the first step. Additionally, you will need to tune the ADDR variables according to your own environment. Note that I’m assuming you have a PMM server node already set up and reachable, since this is out of scope for this blog (if needed, check the references section below).

Finally, we can really start the PMM client agent process:

This will leave the process running in the foreground, but for the initial testing it will suffice. If you want, you can also create your own systemctl service for it, create your own script to run it in the background, or manually redirect logs to a file and run in the background with:

Check if things are running ok with the following command:

If you see node_exporter -> Running, it worked! We can now enjoy our OS-related graphs from our ARM server in PMM:

ARM server in PMM

References:

  • How to install PMM server using Docker
  • For ease of use, all commands mentioned above are detailed in a public gist.
  • Lastly, the binaries can be found in this github project. They may not work in your node in particular, and you may need to do the manual compilation steps yourself, but I’ve published the resulting binaries here in case they help 🙂 Also note that they are for version 2.9.0, which is current latest at the time of writing, and that this project will not necessarily be kept up to date in the future. We are always glad to help, though, so feel free to create a new issue or forum question if needed.

Share this post

Leave a Reply