Home Building Zabbix 2.2.5 agent on OpenBSD 5.4
Post
Cancel

Building Zabbix 2.2.5 agent on OpenBSD 5.4

Building Zabbix 2.2.5 agent from source, running ./configure --enable-agent, then make, on OpenBSD 5.4 fails with following error:

net.c: In function 'get_ifdata':
net.c:41: error: storage size of 'head' isn't known
net.c:85: error: storage size of 'v' isn't known
net.c:93: error: invalid application of 'sizeof' to incomplete type 'struct ifnet_head'
net.c:97: error: invalid application of 'sizeof' to incomplete type 'struct ifnet'
*** Error 1 in src/libs/zbxsysinfo/openbsd (Makefile:449 'libspecsysinfo_a-net.o')
*** Error 1 in src/libs/zbxsysinfo (Makefile:577 'all-recursive')
*** Error 1 in src/libs (Makefile:391 'all-recursive')
*** Error 1 in src (Makefile:367 'all-recursive')
*** Error 1 in /tmp/zabbix-2.2.5 (Makefile:380 'all-recursive')

The quick’n’dirty solution is to apply following small patch. The first part of it changes agent user from default zabbix to _zabbix. This is the user that is used by Zabbix agent from ports. Let’s assume we already have Zabbix client installed from ports (current version is 2.0.8), but we would like to use full functionality of Zabbix 2.2 tree.

diff -u -r zabbix-2.2.5/src/libs/zbxnix/daemon.c zabbix-2.2.5-openbsd54/src/libs/zbxnix/daemon.c
--- zabbix-2.2.5/src/libs/zbxnix/daemon.c       Thu Jul 17 15:49:45 2014
+++ zabbix-2.2.5-openbsd54/src/libs/zbxnix/daemon.c     Tue Jul 22 09:15:39 2014
@@ -144,7 +144,7 @@
 {
        pid_t                   pid;
        struct passwd           *pwd;
-       char                    user[7] = "zabbix";
+       char                    user[7] = "_zabbix";

        if (0 == allow_root && (0 == getuid() || 0 == getgid()))        /* running as root? */
        {
diff -u -r zabbix-2.2.5/src/libs/zbxsysinfo/openbsd/net.c zabbix-2.2.5-openbsd54/src/libs/zbxsysinfo/openbsd/net.c
--- zabbix-2.2.5/src/libs/zbxsysinfo/openbsd/net.c      Thu Jul 17 15:49:45 2014
+++ zabbix-2.2.5-openbsd54/src/libs/zbxsysinfo/openbsd/net.c    Tue Jul 22 09:15:11 2014
@@ -22,6 +22,7 @@
 #include "zbxjson.h"

 #include <sys/sockio.h>
+#include <net/if_var.h>

 static struct nlist kernel_symbols[] =
 {

To install run make install. Warning, this will overwrite existing Zabbix agent port installation in /usr/local/.