Zabbix Agent on Redsleeve
Prerequisites
Creating a new RPM generally involves compiling the application from source (which is automated by the RPM tools). You’ll need the following RPMs installed before you can continue:
- gcc
- rpmdevtools
- libcurl-devel
- openssl-devel
- unixODBC-devel
- openldap-devel
- mysql-devel
- postgresql-devel
- net-snmp-devel
- gnutls-devel
- sqlite-devel
- OpenIPMI-devel
- libssh2-devel
- java-devel
- libxml2-devel
- iksemel-devel
That’s a lot of stuff for an agent, but that’s because the source RPM will build all the Zabbix RPMs – including the server. In theory, that means you can run not only the agent on a Raspberry Pi, but also the server itself. You won’t need most of these things at runtime for just the agent, but they’re necessary for the build.
And yes, I’m considering moving my Zabbix server to a Raspberry Pi; I’m just too lazy right now.
Also note that the last item, iksemel-devel, comes from EPEL, so
you’ll need that as well. If you don’t have it, add the following to
/etc/yum.repos.d/epel.repo
:
[epel]
name=Redsleeve EPEL (full distribution)
baseurl=http://ftp.mirrorservice.org/sites/ftp.redsleeve.org/pub/el7-devel/el7/EPEL-full
gpgcheck=0
enable=1
At that point, you should be able to get the EPEL packages. It’s probably not the right place to get them from, but it should at least work. The packages do not appear to be signed, so the gpgcheck=0 is necessary to avoid a failure.
Once you have EPEL, you can install all these things (and their dependencies) with the following command:
# yum install gcc rpmdevtools libcurl-devel openssl-devel unixODBC-devel openldap-devel mysql-devel postgresql-devel net-snmp-devel gnutls-devel sqlite-devel OpenIPMI-devel libssh2-devel java-devel libxml2-devel iksemel-devel
Building the Zabbix RPMs
This is, believe it or not, the easy part. If you’ve downloaded the 3.0.2-1 SRPM, for example, simply change to the directory it’s in and execute a command similar to the following (adjust for the SRPM filename as appropriate):
# rpmbuild --rebuild zabbix-3.0.2-1.el7.src.rpm
That’s it. That’s all it takes. All you have to do now is sit there and wait while it builds. It’ll take ten minutes or so, but when you’re done all the RPMs will be built and ready to go.
By default, rpmbuild will store your RPMs in
$HOME/rpmbuild/RPMS/armv5tel
. There will also be a few random web
pieces in $HOME/rpmbuild/RPMS/noarch
, but you won’t need those for
the agent. They’re only necessary if you’re going to run the web
interface on a Raspberry Pi.
Installation
Now that you have your shiny new RPMs, you can simply install the agent. Your yum command might look something like this:
# yum install ~/rpmbuild/RPMS/armv5tel/zabbix-agent-3.0.2-1.el7.armv5tel.rpm
From there, you can configure the Agent just as you would on an Intel-based host.
It’s really that easy.
Alternatives
Obviously, this won’t work for anything other than an RPM-based distribution. For those on Raspbian or other distributions, your best bet is probably just to compile it from source. That’s beyond the scope of this article, but you can find instructions here.
A Done Deal.
Once you’ve got it built and installed, the agent works just like you expect it to; see the Zabbix documentation for more information. I hope this mini-tutorial will help someone out there; if you have any questions, feel free to leave them in the comments.