I was running a Zabbix server in a VM with 4G of RAM and 4 CPUs. One day I was looking at resources being utilized and realized the VM was way overkill. This was on my mind for a while and one day I was wanting to migrate several VMs off of one physical server to another and one of those happened to be the Zabbix server and I thought it would be nice to put that on it’s own dedicated machine and not on the same hardware it was being used to monitor. Plus, I’m always on the lookout for new projects involving Raspberry Pis, Linux, and other related things.
My monitoring needs are low: I monitor a total of 30 devices/VMs/machines. I use PostgreSQL as my database of choice which is running on its own VM, this is important for this project as it removes one of the resource consumers leaving us with only needing to run Zabbix and Apache.
At this point in time it no longer makes sense to do a new install using Zabbix 2.x, so I will be using the latest stable Zabbix 3.0.x here. I also run Gentoo on all of my machines and installation will not be covered here because Gentoo has a great wiki covering Gentoo on Raspberry Pi. I also use OpenRC and refuse to use SystemD; However, this guide would be the same regardless of the init system used with the exception of the service and rc commands.
The first step is to keyword Zabbix on arm by creating a file (or editing an existing one) in /etc/portage/package.keywords/zabbix with the following line:
Next we need to select our use flags by creating a file (or editing an existing one) in /etc/portage/package.use/zabbix with the following line:
net-analyzer/zabbix agent curl frontend ipv6 -java -ldap libxml2 -mysql -odbc openipmi -oracle postgres -proxy server snmp -sqlite ssh ssl -static
dev-lang/php xmlreader gd sysvipc bcmath postgres truetype apache2 xmlwriter sockets
Now we can install Zabbix and Apache along with their dependencies:
emerge -av zabbix apache
This will take a while and for me was aided by setting up distcc and crossdev on another machine.
Once the emerge is finished we need to enable the Zabbix web frontend with webapp-config:
webapp-config -I zabbix 3.0.8
Be sure to replace “3.0.8” with the specific version you emerged.
Next we need to enable PHP in Apache by editing /etc/conf.d/apache2 and adding “-D PHP” to the APACHE2_OPTS.
Now we need to start Apache:
service apache2 start
At this point you should be able to configure Zabbix like normal following the official guide. Once you have finished with your Zabbix configuration you need to enable and start the Zabbix agent and Zabbix server:
rc-update add zabbix-server
rc-update add zabbix-agentd
service zabbix-server start
service zabbix-agentd start
That’s about all there is to the install. As for resource usage, here are some stats from mine:
# free -h
total used free shared buff/cache available
Mem: 925M 54M 453M 10M 417M 846M
Swap: 1.0G 0B 1.0G
top – 09:30:13 up 58 min, 1 user, load average: 0.00, 0.04, 0.05
Tasks: 137 total, 1 running, 136 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.9 us, 1.2 sy, 0.0 ni, 97.7 id, 0.1 wa, 0.0 hi, 0.1 si, 0.0 st
KiB Mem : 948016 total, 462944 free, 57204 used, 427868 buff/cache
KiB Swap: 1048572 total, 1048572 free, 0 used. 865836 avail Mem
That about covers the basics and should be enough to get you up and running!