In this follow-up blog to Compiling a Percona Monitoring and Management v2 Client in ARM Architecture, we will show what changes are needed to get the latest versions of PMM working on ARM architecture. In this case, we will do it using a Raspberry Pi 3, instead of the AWS EC2 ARM node. With these two blogs, we are covering a good deal of ground in respect to ways of deploying PMM in ARM. Let us know if you use any other device, though, and we’ll be happy to try if we can get ahold of one!
The latest versions will need the vmagent for supporting the newly added VictoriaMetrics functionality. In this case, the binaries are precompiled by the VM team, so we just need to download them and copy them to the appropriate directories. These steps are exactly the same for AWS, but you should use the ARM64 packages instead.
For ease of use, we have again included binaries in the following project (note that versions kept there may not be current latest at any point): https://github.com/guriandoro/pmm_arm, and a gist with the commands used.
Installing Dependencies
As always, let’s get some basic packages needed out of the way:
1 2 3 4 5 6 | sudo apt-get install git curl -LO https://golang.org/dl/go1.15.2.linux-armv6l.tar.gz tar xzf go1.15.2.linux-armv6l.tar.gz sudo mv go /usr/local/go echo "export PATH=\$PATH:/usr/local/go/bin" >> .bashrc source .bashrc |
1 2 | shell> go version go version go1.15.2 linux/arm |
After we install these tools, we will clone all needed projects to our Go source directory:
1 2 3 4 5 | mkdir -p ~/go/src/github.com/percona/ cd ~/go/src/github.com/percona/ git clone https://github.com/percona/pmm-admin.git git clone https://github.com/percona/pmm-agent.git git clone https://github.com/percona/node_exporter.git |
1 2 3 4 5 | mkdir -p ~/go/src/github.com/percona/ cd ~/go/src/github.com/percona/ git clone https://github.com/percona/pmm-admin.git git clone https://github.com/percona/pmm-agent.git git clone https://github.com/percona/node_exporter.git |
And get the VictioraMetrics vmagent binary ready, too:
1 2 3 | cd /tmp/ curl -LO https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v1.59.0/vmutils-arm-v1.59.0.tar.gz tar xzf vmutils-arm-v1.59.0.tar.gz |
Compiling
As with the previous blog, pmm-admin compilation is straightforward:
1 2 | cd ~/go/src/github.com/percona/pmm-admin make release |
For node_exporter, we will need the changes for PR 1196:
1 2 3 | cd ~/go/src/github.com/percona/node_exporter/ curl -LO https://raw.githubusercontent.com/pgier/node_exporter/1fc4d14c6613766483a8b9117ffa9cc50c1a976d/Makefile.common make build |
Lastly, for pmm-agent, we will also need an additional step. However, before we can introduce the changes, we need to compile and let it fail once:
1 2 3 4 5 6 7 8 | cd ~/go/src/github.com/percona/pmm-agent make release ... /home/pi/go/pkg/mod/github.com/!percona-!lab/pg_query_go@v1.0.1-0.20190723081422-3fc3af54a6f7/parser/include/port/atomics.h:68:10: fatal error: port/atomics/arch-arm.h: No such file or directory #include "port/atomics/arch-arm.h" ^~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make: *** [Makefile:27: release] Error 2 |
We will then need to download the arch-arm.h file to that directory:
1 2 3 | cd ~/go/pkg/mod/github.com/\!percona-\!lab/pg_query_go@v1.0.1-0.20190723081422-3fc3af54a6f7/parser/include/port/atomics/ sudo curl -LO https://raw.githubusercontent.com/postgres/postgres/master/src/include/port/atomics/arch-arm.h sudo chown pi:pi arch-arm.h |
And then we are ready to compile pmm-agent successfully:
1 2 | cd ~/go/src/github.com/percona/pmm-agent make release |
Moving the Files to Their Final Destination
As the last step, let’s create the needed directories and move the files where they belong.
1 2 3 4 5 6 7 | sudo mkdir -p /usr/local/percona/pmm2/ cd /usr/local/percona/pmm2/ sudo mkdir exporters/ sudo mkdir config/ sudo mkdir -p collectors/textfile-collector/high-resolution sudo mkdir -p collectors/textfile-collector/medium-resolution sudo mkdir -p collectors/textfile-collector/low-resolution |
1 2 3 | cd ~/go/src/github.com/percona/ sudo cp pmm-admin/bin/pmm-admin /usr/local/bin/ sudo cp pmm-agent/bin/pmm-agent /usr/local/bin/ |
1 2 | sudo cp node_exporter/node_exporter /usr/local/percona/pmm2/exporters/ sudo cp /tmp/vmagent-prod /usr/local/percona/pmm2/exporters/vmagent |
Starting the PMM Client
At last, we can configure and start the client!
1 2 3 4 5 | sudo pmm-agent setup \ --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml \ --server-address=192.168.1.121:443 --server-insecure-tls \ --server-username=admin --server-password=admin \ 192.168.1.247 generic raspberrypi |
1 | sudo pmm-agent --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml |
Check if things are working:
1 2 3 4 5 6 7 | shell> pmm-admin list Service type Service name Address and port Service ID Agent type Status Metrics Mode Agent ID Service ID pmm_agent Connected /agent_id/2e2ed51d-f573-4510-8f4f-8b7899ef4f67 node_exporter Running push /agent_id/6f34eb76-429f-47fb-a178-a1bbf4ddadcb vmagent Running push /agent_id/80a9e104-aab6-48ef-a709-475330385e32 |
OS and Disk Usage
Some information about the OS and kernel used:
1 2 3 4 5 6 7 8 9 | shell> uname -a Linux raspberrypi 5.4.83-v7+ #1379 SMP Mon Dec 14 13:08:57 GMT 2020 armv7l GNU/Linux shell> lsb_release -a No LSB modules are available. Distributor ID: Raspbian Description: Raspbian GNU/Linux 10 (buster) Release: 10 Codename: buster |
As for disk usage, the four compiled binaries will take up 72Mb of space.
Extra Tools
We can also download pt-summary, to get the reports in the Node Summary dashboards:
1 2 3 | cd /usr/local/percona/pmm2/tools/ curl -LO percona.com/get/pt-summary chmod +x pt-summary |
We Come in Peace… We Mean you no Harm
Resource usage is in the expected (very low) overhead ranges, as we can see in the following before (completely idle) and after (only PMM client binaries running) top samples.
Before:
1 2 3 4 5 6 7 8 9 10 11 | top - 05:27:42 up 28 min, 4 users, load average: 0.00, 0.00, 0.00 Tasks: 135 total, 1 running, 134 sleeping, 0 stopped, 0 zombie %Cpu(s): 4.9 us, 1.2 sy, 0.0 ni, 93.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 924.8 total, 543.4 free, 104.3 used, 277.1 buff/cache MiB Swap: 100.0 total, 100.0 free, 0.0 used. 753.9 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1082 root 20 0 10432 2864 2480 R 11.1 0.3 0:00.05 top 1 root 20 0 33784 8072 6392 S 0.0 0.9 0:05.36 systemd ... |
After:
1 2 3 4 5 6 7 8 9 10 11 12 | top - 05:46:09 up 47 min, 5 users, load average: 0.08, 0.10, 0.09 Tasks: 144 total, 1 running, 143 sleeping, 0 stopped, 0 zombie %Cpu(s): 2.0 us, 0.7 sy, 0.0 ni, 97.4 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 s MiB Mem : 924.8 total, 495.2 free, 151.9 used, 277.8 buff/cache MiB Swap: 100.0 total, 100.0 free, 0.0 used. 713.5 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1136 root 20 0 805056 18368 8136 S 7.9 1.9 0:44.10 node_exporter 1141 root 20 0 804132 33396 7244 S 1.3 3.5 0:20.27 vmagent 1214 pi 20 0 10404 3084 2564 R 0.7 0.3 0:00.13 top ... |
Conclusion
With this and the blog post linked at the beginning, you should have all the data you need to compile and run Percona Monitoring and Management (PMM) client in either a Raspberry Pi 3 or an AWS EC2 ARM node.
Hey, thanks for writing such a nice blog. The cURL error 28 is a common WordPress REST API issue that can affect your
website’s performance and may cause it to behave unpredictably.