1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
|
#
# Copyright (C) 2006-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=zabbix
PKG_VERSION:=6.4.7
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://cdn.zabbix.com/zabbix/sources/stable/$(basename $(PKG_VERSION))/ \
https://cdn.zabbix.com/zabbix/sources/oldstable/$(basename $(PKG_VERSION))/
PKG_HASH:=6b4e81f07de4c82c7994871bea51be4d6427683fa9a7fbe112fd7559b3670e49
PKG_MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
PKG_CPE_ID:=cpe:/a:zabbix:zabbix
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_CONFIG_DEPENDS:= \
CONFIG_ZABBIX_MYSQL \
CONFIG_ZABBIX_POSTGRESQL \
CONFIG_ZABBIX_SQLITE
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
define Package/zabbix-proxy/config
comment "Database Software"
choice
prompt "Selected Database Software"
default ZABBIX_POSTGRESQL
config ZABBIX_MYSQL
bool "MySQL/MariaDB"
config ZABBIX_POSTGRESQL
bool "PostgreSQL"
config ZABBIX_SQLITE
bool "SQLite"
endchoice
endef
define Package/zabbix/Default
SECTION:=admin
CATEGORY:=Administration
SUBMENU:=Zabbix
TITLE:=Zabbix
URL:=https://www.zabbix.com/
USERID:=zabbix=53:zabbix=53
DEPENDS+=$(ICONV_DEPENDS) +libpcre2 +zlib
endef
define Package/zabbix-agentd
$(call Package/zabbix/Default)
TITLE+= agentd
PROVIDES:=zabbix-agentd
VARIANT:=nossl
DEFAULT_VARIANT:=1
endef
define Package/zabbix-agentd-openssl
$(call Package/zabbix/Default)
TITLE+= agentd (with OpenSSL)
DEPENDS+= +libopenssl
PROVIDES:=zabbix-agentd
VARIANT:=openssl
endef
define Package/zabbix-agentd-gnutls
$(call Package/zabbix/Default)
TITLE+= agentd (with GnuTLS)
DEPENDS+= +libgnutls
PROVIDES:=zabbix-agentd
VARIANT:=gnutls
endef
define Package/zabbix-extra-mac80211
$(call Package/zabbix/Default)
TITLE+= discovery/userparameters for mac80211
DEPENDS = +zabbix-agentd @PACKAGE_MAC80211_DEBUGFS @KERNEL_DEBUG_FS
endef
define Package/zabbix-extra-network
$(call Package/zabbix/Default)
TITLE+= discovery/userparameters for network
DEPENDS = +zabbix-agentd +libubus-lua +lua
endef
define Package/zabbix-extra-wifi
$(call Package/zabbix/Default)
TITLE+= discovery/userparameters for wifi
DEPENDS = +zabbix-agentd +libiwinfo-lua +libubus-lua +lua
endef
define Package/zabbix-sender
$(call Package/zabbix/Default)
TITLE+= sender
PROVIDES:=zabbix-sender
VARIANT:=nossl
DEFAULT_VARIANT:=1
endef
define Package/zabbix-sender-openssl
$(call Package/zabbix/Default)
TITLE+= sender (with OpenSSL)
DEPENDS+= +libopenssl
PROVIDES:=zabbix-sender
VARIANT:=openssl
endef
define Package/zabbix-sender-gnutls
$(call Package/zabbix/Default)
TITLE+= sender (with GnuTLS)
DEPENDS+= +libgnutls
PROVIDES:=zabbix-sender
VARIANT:=gnutls
endef
define Package/zabbix-get
$(call Package/zabbix/Default)
TITLE+= get
PROVIDES:=zabbix-get
VARIANT:=nossl
DEFAULT_VARIANT:=1
endef
define Package/zabbix-get-openssl
$(call Package/zabbix/Default)
TITLE+= get (with OpenSSL)
DEPENDS+= +libopenssl
PROVIDES:=zabbix-get
VARIANT:=openssl
endef
define Package/zabbix-get-gnutls
$(call Package/zabbix/Default)
TITLE+= get (with GnuTLS)
DEPENDS+= +libgnutls
PROVIDES:=zabbix-get
VARIANT:=gnutls
endef
define Package/zabbix-server/Default
$(call Package/zabbix/Default)
TITLE+= server
DEPENDS += +ZABBIX_POSTGRESQL:libpq \
+ZABBIX_MYSQL:libmariadbclient \
@(!ZABBIX_SQLITE) \
+libevent2 \
+libevent2-pthreads \
+fping
endef
define Package/zabbix-server
$(call Package/zabbix-server/Default)
PROVIDES:=zabbix-server
VARIANT:=nossl
DEFAULT_VARIANT:=1
endef
define Package/zabbix-server-openssl
$(call Package/zabbix-server/Default)
TITLE+= (with OpenSSL)
PROVIDES:=zabbix-server
DEPENDS+= +libopenssl
VARIANT:=openssl
endef
define Package/zabbix-server-gnutls
$(call Package/zabbix-server/Default)
TITLE+= (with GnuTLS)
PROVIDES:=zabbix-server
DEPENDS+= +libgnutls
VARIANT:=gnutls
endef
define Package/zabbix-server-frontend
$(call Package/zabbix/Default)
TITLE+= server-frontend
DEPENDS += +php8 \
+php8-cgi \
+php8-mod-gd \
+php8-mod-bcmath \
+php8-mod-ctype \
+php8-mod-xmlreader \
+php8-mod-xmlwriter \
+php8-mod-session \
+php8-mod-sockets \
+php8-mod-mbstring \
+php8-mod-gettext \
+ZABBIX_POSTGRESQL:php8-mod-pgsql \
+ZABBIX_MYSQL:php8-mod-mysqli \
@(!ZABBIX_SQLITE)
endef
define Package/zabbix-proxy/Default
$(call Package/zabbix/Default)
TITLE+= proxy
DEPENDS += +ZABBIX_POSTGRESQL:libpq \
+ZABBIX_MYSQL:libmariadbclient \
+ZABBIX_SQLITE:libsqlite3 \
+libevent2 \
+libevent2-pthreads \
+fping
endef
define Package/zabbix-proxy
$(call Package/zabbix-proxy/Default)
PROVIDES:=zabbix-proxy
VARIANT:=nossl
DEFAULT_VARIANT:=1
endef
define Package/zabbix-proxy-openssl
$(call Package/zabbix-proxy/Default)
TITLE+= (with OpenSSL)
PROVIDES:=zabbix-proxy
DEPENDS+= +libopenssl
VARIANT:=openssl
endef
define Package/zabbix-proxy-gnutls
$(call Package/zabbix-proxy/Default)
TITLE+= (with GnuTLS)
PROVIDES:=zabbix-proxy
DEPENDS+= +libgnutls
VARIANT:=gnutls
endef
define Package/zabbix-extra-mac80211/description
An extra package for zabbix-agentd that adds a discovery rule for mac80211 wifi phy and many userparameters.
It contains an suid helper to allow zabbix-agentd to still run as zabbix user and not as root.
See https://openwrt.org/docs/guide-user/services/network_monitoring/zabbix for ready to use zabbix templates.
endef
define Package/zabbix-extra-network/description
An extra package for zabbix-agentd that adds a discovery rule for openwrt network interfaces.
The idea here is to discover only interfaces listed in /etc/config/network (discover br-lan and not eth0.1 and wlan0)
See https://openwrt.org/docs/guide-user/services/network_monitoring/zabbix for ready to use zabbix templates.
endef
define Package/zabbix-extra-wifi/description
An extra package for zabbix-agentd that adds a discovery rule for wifi interfaces and many userparameters.
As it uses libiwinfo, it works with all wifi devices supported by openwrt.
See https://openwrt.org/docs/guide-user/services/network_monitoring/zabbix for ready to use zabbix templates.
endef
CONFIGURE_ARGS+= \
--enable-agent \
$(if $(CONFIG_ZABBIX_SQLITE),--disable-server,--enable-server) \
--enable-proxy \
$(call autoconf_bool,CONFIG_IPV6,ipv6) \
--disable-java \
$(if $(CONFIG_ZABBIX_MYSQL),--with-mysql) \
$(if $(CONFIG_ZABBIX_POSTGRESQL),--with-postgresql) \
$(if $(CONFIG_ZABBIX_SQLITE),--with-sqlite3=$(STAGING_DIR)/usr) \
--with-libevent=$(STAGING_DIR)/usr/include \
--with-libpcre2=$(STAGING_DIR)/usr/include \
--with-zlib=$(STAGING_DIR)/usr/include
ifeq ($(BUILD_VARIANT),openssl)
CONFIGURE_ARGS+= --with-openssl="$(STAGING_DIR)/usr"
endif
ifeq ($(BUILD_VARIANT),gnutls)
CONFIGURE_ARGS+= --with-gnutls="$(STAGING_DIR)/usr"
endif
CONFIGURE_VARS += \
ac_cv_header_sys_sysinfo_h=no
MAKE_FLAGS += ARCH="linux"
define Package/zabbix/install/sbin
$(INSTALL_DIR) \
$(1)/usr/sbin
$(INSTALL_BIN) \
$(PKG_INSTALL_DIR)/usr/sbin/zabbix_$(2) \
$(1)/usr/sbin/
endef
define Package/zabbix/install/bin
$(INSTALL_DIR) \
$(1)/usr/bin
$(INSTALL_BIN) \
$(PKG_INSTALL_DIR)/usr/bin/zabbix_$(2) \
$(1)/usr/bin/
endef
define Package/zabbix/install/etc
$(INSTALL_DIR) \
$(1)/etc
$(INSTALL_CONF) \
$(PKG_INSTALL_DIR)/etc/zabbix_$(2).conf \
$(1)/etc/
endef
define Package/zabbix/install/init.d
$(INSTALL_DIR) \
$(1)/etc/init.d
$(INSTALL_BIN) \
./files/zabbix_$(2).init \
$(1)/etc/init.d/zabbix_$(2)
endef
define Package/zabbix/install/zabbix.conf.d
$(INSTALL_DIR) \
$(1)/etc/zabbix_agentd.conf.d
$(INSTALL_BIN) \
./files/$(2) \
$(1)/etc/zabbix_agentd.conf.d/$(2)
endef
define Package/zabbix-agentd/conffiles
/etc/zabbix_agentd.conf
endef
Package/zabbix-agentd-openssl/conffiles = $(Package/zabbix-agentd/conffiles)
Package/zabbix-agentd-gnutls/conffiles = $(Package/zabbix-agentd/conffiles)
define Package/zabbix-server/conffiles
/etc/zabbix_server.conf
endef
Package/zabbix-server-openssl/conffiles = $(Package/zabbix-server/conffiles)
Package/zabbix-server-gnutls/conffiles = $(Package/zabbix-server/conffiles)
define Package/zabbix-proxy/conffiles
/etc/zabbix_proxy.conf
endef
Package/zabbix-proxy-openssl/conffiles = $(Package/zabbix-proxy/conffiles)
Package/zabbix-proxy-gnutls/conffiles = $(Package/zabbix-proxy/conffiles)
ifdef CONFIG_PACKAGE_zabbix-extra-mac80211
define Build/Prepare/zabbix-extra-mac80211
mkdir -p $(PKG_BUILD_DIR)/zabbix-extra-mac80211
$(CP) ./files/zabbix_helper_mac80211.c $(PKG_BUILD_DIR)/zabbix-extra-mac80211/
endef
define Build/Compile/zabbix-extra-mac80211
$(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211.c -o $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211
endef
endif
define Build/Prepare
$(call Build/Prepare/Default)
$(call Build/Prepare/zabbix-extra-mac80211)
endef
define Build/Compile
$(call Build/Compile/Default)
$(call Build/Compile/zabbix-extra-mac80211)
endef
define Package/zabbix-agentd/install
$(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
$(call Package/zabbix/install/sbin,$(1),agentd)
$(call Package/zabbix/install/etc,$(1),agentd)
$(call Package/zabbix/install/init.d,$(1),agentd)
endef
Package/zabbix-agentd-openssl/install = $(Package/zabbix-agentd/install)
Package/zabbix-agentd-gnutls/install = $(Package/zabbix-agentd/install)
define Package/zabbix-extra-mac80211/install
$(call Package/zabbix/install/zabbix.conf.d,$(1),mac80211)
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 $(1)/usr/bin/
chmod 4755 $(1)/usr/bin/zabbix_helper_mac80211
endef
define Package/zabbix-extra-network/install
$(call Package/zabbix/install/zabbix.conf.d,$(1),network)
$(INSTALL_DIR) $(1)/usr/share/acl.d
$(INSTALL_DATA) ./files/zabbix-network-ubus-acl.json $(1)/usr/share/acl.d/zabbix-network.json
endef
define Package/zabbix-extra-network/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
killall -s HUP ubusd
fi
endef
define Package/zabbix-extra-wifi/install
$(call Package/zabbix/install/zabbix.conf.d,$(1),wifi)
$(INSTALL_DIR) $(1)/usr/share/acl.d
$(INSTALL_DATA) ./files/zabbix-wifi-ubus-acl.json $(1)/usr/share/acl.d/zabbix-wifi.json
endef
define Package/zabbix-extra-wifi/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
killall -s HUP ubusd
fi
endef
define Package/zabbix-sender/install
$(call Package/zabbix/install/bin,$(1),sender)
endef
Package/zabbix-sender-openssl/install = $(Package/zabbix-sender/install)
Package/zabbix-sender-gnutls/install = $(Package/zabbix-sender/install)
define Package/zabbix-get/install
$(call Package/zabbix/install/bin,$(1),get)
endef
Package/zabbix-get-openssl/install = $(Package/zabbix-get/install)
Package/zabbix-get-gnutls/install = $(Package/zabbix-get/install)
define Package/zabbix-server/install
$(call Package/zabbix/install/sbin,$(1),server)
$(call Package/zabbix/install/etc,$(1),server)
endef
Package/zabbix-server-openssl/install = $(Package/zabbix-server/install)
Package/zabbix-server-gnutls/install = $(Package/zabbix-server/install)
define Package/zabbix-server-frontend/install
$(INSTALL_DIR) $(1)/www/zabbix
$(CP) $(PKG_BUILD_DIR)/ui/* $(1)/www/zabbix
endef
define Package/zabbix-proxy/install
$(call Package/zabbix/install/sbin,$(1),proxy)
$(call Package/zabbix/install/etc,$(1),proxy)
endef
Package/zabbix-proxy-openssl/install = $(Package/zabbix-proxy/install)
Package/zabbix-proxy-gnutls/install = $(Package/zabbix-proxy/install)
$(eval $(call BuildPackage,zabbix-agentd))
$(eval $(call BuildPackage,zabbix-agentd-openssl))
$(eval $(call BuildPackage,zabbix-agentd-gnutls))
$(eval $(call BuildPackage,zabbix-extra-mac80211))
$(eval $(call BuildPackage,zabbix-extra-network))
$(eval $(call BuildPackage,zabbix-extra-wifi))
$(eval $(call BuildPackage,zabbix-sender))
$(eval $(call BuildPackage,zabbix-sender-openssl))
$(eval $(call BuildPackage,zabbix-sender-gnutls))
$(eval $(call BuildPackage,zabbix-server))
$(eval $(call BuildPackage,zabbix-server-openssl))
$(eval $(call BuildPackage,zabbix-server-gnutls))
$(eval $(call BuildPackage,zabbix-server-frontend))
$(eval $(call BuildPackage,zabbix-proxy))
$(eval $(call BuildPackage,zabbix-proxy-openssl))
$(eval $(call BuildPackage,zabbix-proxy-gnutls))
$(eval $(call BuildPackage,zabbix-get))
$(eval $(call BuildPackage,zabbix-get-openssl))
$(eval $(call BuildPackage,zabbix-get-gnutls))
|