You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

317 lines
8.5 KiB

  1. #
  2. # Copyright (C) 2006-2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=zabbix
  9. PKG_VERSION:=5.0.7
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://cdn.zabbix.com/zabbix/sources/stable/5.0/
  13. PKG_HASH:=d762f8a9aa9e8717d2e85d2a82d27316ea5c2b214eb00aff41b6e9b06107916a
  14. PKG_MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
  15. PKG_LICENSE:=GPL-2.0
  16. PKG_LICENSE_FILES:=COPYING
  17. PKG_CPE_ID:=cpe:/a:zabbix:zabbix
  18. PKG_INSTALL:=1
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_CONFIG_DEPENDS:= \
  21. CONFIG_ZABBIX_GNUTLS \
  22. CONFIG_ZABBIX_OPENSSL \
  23. CONFIG_ZABBIX_MYSQL \
  24. CONFIG_ZABBIX_POSTGRESQL
  25. include $(INCLUDE_DIR)/package.mk
  26. include $(INCLUDE_DIR)/nls.mk
  27. define Package/zabbix-agentd/config
  28. comment "SSL support"
  29. choice
  30. prompt "Selected SSL library"
  31. default ZABBIX_NOSSL
  32. config ZABBIX_OPENSSL
  33. bool "OpenSSL"
  34. config ZABBIX_GNUTLS
  35. bool "GnuTLS"
  36. config ZABBIX_NOSSL
  37. bool "No SSL support"
  38. endchoice
  39. endef
  40. define Package/zabbix-server/config
  41. comment "Database Software"
  42. choice
  43. prompt "Selected Database Software"
  44. default ZABBIX_POSTGRESQL
  45. config ZABBIX_MYSQL
  46. bool "MySQL/MariaDB"
  47. config ZABBIX_POSTGRESQL
  48. bool "PostgreSQL"
  49. endchoice
  50. endef
  51. define Package/zabbix/Default
  52. SECTION:=admin
  53. CATEGORY:=Administration
  54. SUBMENU:=Zabbix
  55. TITLE:=Zabbix
  56. URL:=https://www.zabbix.com/
  57. USERID:=zabbix=53:zabbix=53
  58. DEPENDS += $(ICONV_DEPENDS) +libpcre +zlib +ZABBIX_GNUTLS:libgnutls +ZABBIX_OPENSSL:libopenssl
  59. endef
  60. define Package/zabbix-agentd
  61. $(call Package/zabbix/Default)
  62. TITLE+= agentd
  63. endef
  64. define Package/zabbix-extra-mac80211
  65. $(call Package/zabbix/Default)
  66. TITLE+= discovery/userparameters for mac80211
  67. DEPENDS = +zabbix-agentd @PACKAGE_MAC80211_DEBUGFS @KERNEL_DEBUG_FS
  68. endef
  69. define Package/zabbix-extra-network
  70. $(call Package/zabbix/Default)
  71. TITLE+= discovery/userparameters for network
  72. DEPENDS = +zabbix-agentd +libubus-lua +lua
  73. endef
  74. define Package/zabbix-extra-wifi
  75. $(call Package/zabbix/Default)
  76. TITLE+= discovery/userparameters for wifi
  77. DEPENDS = +zabbix-agentd +libiwinfo-lua +libubus-lua +lua
  78. endef
  79. define Package/zabbix-sender
  80. $(call Package/zabbix/Default)
  81. TITLE+= sender
  82. endef
  83. define Package/zabbix-get
  84. $(call Package/zabbix/Default)
  85. TITLE+= get
  86. endef
  87. define Package/zabbix-server
  88. $(call Package/zabbix/Default)
  89. TITLE+= server
  90. DEPENDS += +ZABBIX_POSTGRESQL:libpq +ZABBIX_MYSQL:libmariadbclient +libevent2
  91. endef
  92. define Package/zabbix-server-frontend
  93. $(call Package/zabbix/Default)
  94. TITLE+= server-frontend
  95. DEPENDS += +php7 +php7-cgi +ZABBIX_POSTGRESQL:php7-mod-pgsql +ZABBIX_MYSQL:php7-mod-mysqli \
  96. +php7-mod-gd +php7-mod-bcmath +php7-mod-ctype +php7-mod-xmlreader +php7-mod-xmlwriter \
  97. +php7-mod-session +php7-mod-sockets +php7-mod-mbstring +php7-mod-gettext
  98. endef
  99. define Package/zabbix-proxy
  100. $(call Package/zabbix/Default)
  101. TITLE+= proxy
  102. DEPENDS += +ZABBIX_POSTGRESQL:libpq +ZABBIX_MYSQL:libmariadbclient +libevent2
  103. endef
  104. define Package/zabbix-extra-mac80211/description
  105. An extra package for zabbix-agentd that adds a discovery rule for mac80211 wifi phy and many userparameters.
  106. It contains an suid helper to allow zabbix-agentd to still run as zabbix user and not as root.
  107. See https://openwrt.org/docs/guide-user/services/network_monitoring/zabbix for ready to use zabbix templates.
  108. endef
  109. define Package/zabbix-extra-network/description
  110. An extra package for zabbix-agentd that adds a discovery rule for openwrt network interfaces.
  111. The idea here is to discover only interfaces listed in /etc/config/network (discover br-lan and not eth0.1 and wlan0)
  112. See https://openwrt.org/docs/guide-user/services/network_monitoring/zabbix for ready to use zabbix templates.
  113. endef
  114. define Package/zabbix-extra-wifi/description
  115. An extra package for zabbix-agentd that adds a discovery rule for wifi interfaces and many userparameters.
  116. As it uses libiwinfo, it works with all wifi devices supported by openwrt.
  117. See https://openwrt.org/docs/guide-user/services/network_monitoring/zabbix for ready to use zabbix templates.
  118. endef
  119. CONFIGURE_ARGS+= \
  120. --enable-agent \
  121. --enable-server \
  122. --enable-proxy \
  123. $(call autoconf_bool,CONFIG_IPV6,ipv6) \
  124. --disable-java \
  125. $(if $(CONFIG_ZABBIX_MYSQL),--with-mysql) \
  126. $(if $(CONFIG_ZABBIX_POSTGRESQL),--with-postgresql) \
  127. --with-libevent=$(STAGING_DIR)/usr/include/libevent \
  128. --with-libpcre=$(STAGING_DIR)/usr/include \
  129. --with-zlib=$(STAGING_DIR)/usr/include \
  130. $(if $(CONFIG_ZABBIX_GNUTLS),--with-gnutls="$(STAGING_DIR)/usr") \
  131. $(if $(CONFIG_ZABBIX_OPENSSL),--with-openssl="$(STAGING_DIR)/usr")
  132. CONFIGURE_VARS += \
  133. ac_cv_header_sys_sysinfo_h=no
  134. MAKE_FLAGS += ARCH="linux"
  135. define Package/zabbix/install/sbin
  136. $(INSTALL_DIR) \
  137. $(1)/usr/sbin
  138. $(INSTALL_BIN) \
  139. $(PKG_INSTALL_DIR)/usr/sbin/zabbix_$(2) \
  140. $(1)/usr/sbin/
  141. endef
  142. define Package/zabbix/install/bin
  143. $(INSTALL_DIR) \
  144. $(1)/usr/bin
  145. $(INSTALL_BIN) \
  146. $(PKG_INSTALL_DIR)/usr/bin/zabbix_$(2) \
  147. $(1)/usr/bin/
  148. endef
  149. define Package/zabbix/install/etc
  150. $(INSTALL_DIR) \
  151. $(1)/etc
  152. $(INSTALL_CONF) \
  153. $(PKG_INSTALL_DIR)/etc/zabbix_$(2).conf \
  154. $(1)/etc/
  155. endef
  156. define Package/zabbix/install/init.d
  157. $(INSTALL_DIR) \
  158. $(1)/etc/init.d
  159. $(INSTALL_BIN) \
  160. ./files/zabbix_$(2).init \
  161. $(1)/etc/init.d/zabbix_$(2)
  162. endef
  163. define Package/zabbix/install/zabbix.conf.d
  164. $(INSTALL_DIR) \
  165. $(1)/etc/zabbix_agentd.conf.d
  166. $(INSTALL_BIN) \
  167. ./files/$(2) \
  168. $(1)/etc/zabbix_agentd.conf.d/$(2)
  169. endef
  170. define Package/zabbix-agentd/conffiles
  171. /etc/zabbix_agentd.conf
  172. endef
  173. define Package/zabbix-server/conffiles
  174. /etc/zabbix_server.conf
  175. endef
  176. define Package/zabbix-proxy/conffiles
  177. /etc/zabbix_proxy.conf
  178. endef
  179. ifdef CONFIG_PACKAGE_zabbix-extra-mac80211
  180. define Build/Prepare/zabbix-extra-mac80211
  181. mkdir -p $(PKG_BUILD_DIR)/zabbix-extra-mac80211
  182. $(CP) ./files/zabbix_helper_mac80211.c $(PKG_BUILD_DIR)/zabbix-extra-mac80211/
  183. endef
  184. define Build/Compile/zabbix-extra-mac80211
  185. $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211.c -o $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211
  186. endef
  187. endif
  188. define Build/Prepare
  189. $(call Build/Prepare/Default)
  190. $(call Build/Prepare/zabbix-extra-mac80211)
  191. endef
  192. define Build/Compile
  193. $(call Build/Compile/Default)
  194. $(call Build/Compile/zabbix-extra-mac80211)
  195. endef
  196. define Package/zabbix-agentd/install
  197. $(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
  198. $(call Package/zabbix/install/sbin,$(1),agentd)
  199. $(call Package/zabbix/install/etc,$(1),agentd)
  200. $(call Package/zabbix/install/init.d,$(1),agentd)
  201. endef
  202. define Package/zabbix-extra-mac80211/install
  203. $(call Package/zabbix/install/zabbix.conf.d,$(1),mac80211)
  204. $(INSTALL_DIR) $(1)/usr/bin
  205. $(INSTALL_BIN) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 $(1)/usr/bin/
  206. chmod 4755 $(1)/usr/bin/zabbix_helper_mac80211
  207. endef
  208. define Package/zabbix-extra-network/install
  209. $(call Package/zabbix/install/zabbix.conf.d,$(1),network)
  210. $(INSTALL_DIR) $(1)/usr/share/acl.d
  211. $(INSTALL_DATA) ./files/zabbix-network-ubus-acl.json $(1)/usr/share/acl.d/zabbix-network.json
  212. endef
  213. define Package/zabbix-extra-network/postinst
  214. #!/bin/sh
  215. if [ -z "$${IPKG_INSTROOT}" ]; then
  216. killall -HUP ubusd
  217. fi
  218. endef
  219. define Package/zabbix-extra-wifi/install
  220. $(call Package/zabbix/install/zabbix.conf.d,$(1),wifi)
  221. $(INSTALL_DIR) $(1)/usr/share/acl.d
  222. $(INSTALL_DATA) ./files/zabbix-wifi-ubus-acl.json $(1)/usr/share/acl.d/zabbix-wifi.json
  223. endef
  224. define Package/zabbix-extra-wifi/postinst
  225. #!/bin/sh
  226. if [ -z "$${IPKG_INSTROOT}" ]; then
  227. killall -HUP ubusd
  228. fi
  229. endef
  230. define Package/zabbix-sender/install
  231. $(call Package/zabbix/install/bin,$(1),sender)
  232. endef
  233. define Package/zabbix-get/install
  234. $(call Package/zabbix/install/bin,$(1),get)
  235. endef
  236. define Package/zabbix-server/install
  237. $(call Package/zabbix/install/sbin,$(1),server)
  238. $(call Package/zabbix/install/etc,$(1),server)
  239. endef
  240. define Package/zabbix-server-frontend/install
  241. $(INSTALL_DIR) $(1)/www/zabbix
  242. $(CP) $(PKG_BUILD_DIR)/ui/* $(1)/www/zabbix
  243. endef
  244. define Package/zabbix-proxy/install
  245. $(call Package/zabbix/install/sbin,$(1),proxy)
  246. $(call Package/zabbix/install/etc,$(1),proxy)
  247. endef
  248. $(eval $(call BuildPackage,zabbix-agentd))
  249. $(eval $(call BuildPackage,zabbix-extra-mac80211))
  250. $(eval $(call BuildPackage,zabbix-extra-network))
  251. $(eval $(call BuildPackage,zabbix-extra-wifi))
  252. $(eval $(call BuildPackage,zabbix-sender))
  253. $(eval $(call BuildPackage,zabbix-server))
  254. $(eval $(call BuildPackage,zabbix-server-frontend))
  255. $(eval $(call BuildPackage,zabbix-proxy))
  256. $(eval $(call BuildPackage,zabbix-get))