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.

314 lines
8.4 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:=3.4.14
  10. PKG_RELEASE:=6
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_HASH:=7443873cc970672d3c884230d3aeb082f2d8afcc2b757506c2d684ffdd12d77e
  13. PKG_SOURCE_URL:=@SF/zabbix
  14. PKG_LICENSE:=GPL-2.0
  15. PKG_LICENSE_FILES:=COPYING
  16. PKG_CPE_ID:=cpe:/a:zabbix:zabbix
  17. PKG_INSTALL:=1
  18. PKG_FIXUP:=autoreconf
  19. PKG_CONFIG_DEPENDS:= \
  20. CONFIG_ZABBIX_GNUTLS \
  21. CONFIG_ZABBIX_OPENSSL \
  22. CONFIG_ZABBIX_MYSQL \
  23. CONFIG_ZABBIX_POSTGRESQL
  24. include $(INCLUDE_DIR)/package.mk
  25. include $(INCLUDE_DIR)/nls.mk
  26. define Package/zabbix-agentd/config
  27. comment "SSL support"
  28. choice
  29. prompt "Selected SSL library"
  30. default ZABBIX_NOSSL
  31. config ZABBIX_OPENSSL
  32. bool "OpenSSL"
  33. config ZABBIX_GNUTLS
  34. bool "GnuTLS"
  35. config ZABBIX_NOSSL
  36. bool "No SSL support"
  37. endchoice
  38. endef
  39. define Package/zabbix-server/config
  40. comment "Database Software"
  41. choice
  42. prompt "Selected Database Software"
  43. default ZABBIX_POSTGRESQL
  44. config ZABBIX_MYSQL
  45. bool "MySQL/MariaDB"
  46. config ZABBIX_POSTGRESQL
  47. bool "PostgreSQL"
  48. endchoice
  49. endef
  50. define Package/zabbix/Default
  51. SECTION:=admin
  52. CATEGORY:=Administration
  53. TITLE:=Zabbix
  54. URL:=https://www.zabbix.com/
  55. SUBMENU:=zabbix
  56. MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
  57. USERID:=zabbix=53:zabbix=53
  58. DEPENDS += $(ICONV_DEPENDS) +libpcre +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
  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. $(if $(CONFIG_ZABBIX_GNUTLS),--with-gnutls="$(STAGING_DIR)/usr") \
  130. $(if $(CONFIG_ZABBIX_OPENSSL),--with-openssl="$(STAGING_DIR)/usr")
  131. MAKE_FLAGS += ARCH="linux"
  132. define Package/zabbix/install/sbin
  133. $(INSTALL_DIR) \
  134. $(1)/usr/sbin
  135. $(INSTALL_BIN) \
  136. $(PKG_INSTALL_DIR)/usr/sbin/zabbix_$(2) \
  137. $(1)/usr/sbin/
  138. endef
  139. define Package/zabbix/install/bin
  140. $(INSTALL_DIR) \
  141. $(1)/usr/bin
  142. $(INSTALL_BIN) \
  143. $(PKG_INSTALL_DIR)/usr/bin/zabbix_$(2) \
  144. $(1)/usr/bin/
  145. endef
  146. define Package/zabbix/install/etc
  147. $(INSTALL_DIR) \
  148. $(1)/etc
  149. $(INSTALL_CONF) \
  150. $(PKG_INSTALL_DIR)/etc/zabbix_$(2).conf \
  151. $(1)/etc/
  152. endef
  153. define Package/zabbix/install/init.d
  154. $(INSTALL_DIR) \
  155. $(1)/etc/init.d
  156. $(INSTALL_BIN) \
  157. ./files/zabbix_$(2).init \
  158. $(1)/etc/init.d/zabbix_$(2)
  159. endef
  160. define Package/zabbix/install/zabbix.conf.d
  161. $(INSTALL_DIR) \
  162. $(1)/etc/zabbix_agentd.conf.d
  163. $(INSTALL_BIN) \
  164. ./files/$(2) \
  165. $(1)/etc/zabbix_agentd.conf.d/$(2)
  166. endef
  167. define Package/zabbix-agentd/conffiles
  168. /etc/zabbix_agentd.conf
  169. endef
  170. define Package/zabbix-server/conffiles
  171. /etc/zabbix_server.conf
  172. endef
  173. define Package/zabbix-proxy/conffiles
  174. /etc/zabbix_proxy.conf
  175. endef
  176. ifdef CONFIG_PACKAGE_zabbix-extra-mac80211
  177. define Build/Prepare/zabbix-extra-mac80211
  178. mkdir -p $(PKG_BUILD_DIR)/zabbix-extra-mac80211
  179. $(CP) ./files/zabbix_helper_mac80211.c $(PKG_BUILD_DIR)/zabbix-extra-mac80211/
  180. endef
  181. define Build/Compile/zabbix-extra-mac80211
  182. $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211.c -o $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211
  183. endef
  184. endif
  185. define Build/Prepare
  186. $(call Build/Prepare/Default)
  187. $(call Build/Prepare/zabbix-extra-mac80211)
  188. endef
  189. define Build/Compile
  190. $(call Build/Compile/Default)
  191. $(call Build/Compile/zabbix-extra-mac80211)
  192. endef
  193. define Package/zabbix-agentd/install
  194. $(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
  195. $(call Package/zabbix/install/sbin,$(1),agentd)
  196. $(call Package/zabbix/install/etc,$(1),agentd)
  197. $(call Package/zabbix/install/init.d,$(1),agentd)
  198. endef
  199. define Package/zabbix-extra-mac80211/install
  200. $(call Package/zabbix/install/zabbix.conf.d,$(1),mac80211)
  201. $(INSTALL_DIR) $(1)/usr/bin
  202. $(INSTALL_BIN) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 $(1)/usr/bin/
  203. chmod 4755 $(1)/usr/bin/zabbix_helper_mac80211
  204. endef
  205. define Package/zabbix-extra-network/install
  206. $(call Package/zabbix/install/zabbix.conf.d,$(1),network)
  207. $(INSTALL_DIR) $(1)/usr/share/acl.d
  208. $(INSTALL_DATA) ./files/zabbix-network-ubus-acl.json $(1)/usr/share/acl.d/zabbix-network.json
  209. endef
  210. define Package/zabbix-extra-network/postinst
  211. #!/bin/sh
  212. if [ -z "$${IPKG_INSTROOT}" ]; then
  213. killall -HUP ubusd
  214. fi
  215. endef
  216. define Package/zabbix-extra-wifi/install
  217. $(call Package/zabbix/install/zabbix.conf.d,$(1),wifi)
  218. $(INSTALL_DIR) $(1)/usr/share/acl.d
  219. $(INSTALL_DATA) ./files/zabbix-wifi-ubus-acl.json $(1)/usr/share/acl.d/zabbix-wifi.json
  220. endef
  221. define Package/zabbix-extra-wifi/postinst
  222. #!/bin/sh
  223. if [ -z "$${IPKG_INSTROOT}" ]; then
  224. killall -HUP ubusd
  225. fi
  226. endef
  227. define Package/zabbix-sender/install
  228. $(call Package/zabbix/install/bin,$(1),sender)
  229. endef
  230. define Package/zabbix-get/install
  231. $(call Package/zabbix/install/bin,$(1),get)
  232. endef
  233. define Package/zabbix-server/install
  234. $(call Package/zabbix/install/sbin,$(1),server)
  235. $(call Package/zabbix/install/etc,$(1),server)
  236. endef
  237. define Package/zabbix-server-frontend/install
  238. $(INSTALL_DIR) $(1)/www/zabbix
  239. $(CP) $(PKG_BUILD_DIR)/frontends/php/* $(1)/www/zabbix
  240. endef
  241. define Package/zabbix-proxy/install
  242. $(call Package/zabbix/install/sbin,$(1),proxy)
  243. $(call Package/zabbix/install/etc,$(1),proxy)
  244. endef
  245. $(eval $(call BuildPackage,zabbix-agentd))
  246. $(eval $(call BuildPackage,zabbix-extra-mac80211))
  247. $(eval $(call BuildPackage,zabbix-extra-network))
  248. $(eval $(call BuildPackage,zabbix-extra-wifi))
  249. $(eval $(call BuildPackage,zabbix-sender))
  250. $(eval $(call BuildPackage,zabbix-server))
  251. $(eval $(call BuildPackage,zabbix-server-frontend))
  252. $(eval $(call BuildPackage,zabbix-proxy))
  253. $(eval $(call BuildPackage,zabbix-get))