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.

315 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:=4.0.6
  10. PKG_RELEASE:=2
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=@SF/zabbix
  13. PKG_HASH:=2890851b3a4b0f70f69ef754aa0d07070b42440f56d280113a9474bc4ed75e5b
  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_FIXUP:=autoreconf
  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
  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. MAKE_FLAGS += ARCH="linux"
  133. define Package/zabbix/install/sbin
  134. $(INSTALL_DIR) \
  135. $(1)/usr/sbin
  136. $(INSTALL_BIN) \
  137. $(PKG_INSTALL_DIR)/usr/sbin/zabbix_$(2) \
  138. $(1)/usr/sbin/
  139. endef
  140. define Package/zabbix/install/bin
  141. $(INSTALL_DIR) \
  142. $(1)/usr/bin
  143. $(INSTALL_BIN) \
  144. $(PKG_INSTALL_DIR)/usr/bin/zabbix_$(2) \
  145. $(1)/usr/bin/
  146. endef
  147. define Package/zabbix/install/etc
  148. $(INSTALL_DIR) \
  149. $(1)/etc
  150. $(INSTALL_CONF) \
  151. $(PKG_INSTALL_DIR)/etc/zabbix_$(2).conf \
  152. $(1)/etc/
  153. endef
  154. define Package/zabbix/install/init.d
  155. $(INSTALL_DIR) \
  156. $(1)/etc/init.d
  157. $(INSTALL_BIN) \
  158. ./files/zabbix_$(2).init \
  159. $(1)/etc/init.d/zabbix_$(2)
  160. endef
  161. define Package/zabbix/install/zabbix.conf.d
  162. $(INSTALL_DIR) \
  163. $(1)/etc/zabbix_agentd.conf.d
  164. $(INSTALL_BIN) \
  165. ./files/$(2) \
  166. $(1)/etc/zabbix_agentd.conf.d/$(2)
  167. endef
  168. define Package/zabbix-agentd/conffiles
  169. /etc/zabbix_agentd.conf
  170. endef
  171. define Package/zabbix-server/conffiles
  172. /etc/zabbix_server.conf
  173. endef
  174. define Package/zabbix-proxy/conffiles
  175. /etc/zabbix_proxy.conf
  176. endef
  177. ifdef CONFIG_PACKAGE_zabbix-extra-mac80211
  178. define Build/Prepare/zabbix-extra-mac80211
  179. mkdir -p $(PKG_BUILD_DIR)/zabbix-extra-mac80211
  180. $(CP) ./files/zabbix_helper_mac80211.c $(PKG_BUILD_DIR)/zabbix-extra-mac80211/
  181. endef
  182. define Build/Compile/zabbix-extra-mac80211
  183. $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211.c -o $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211
  184. endef
  185. endif
  186. define Build/Prepare
  187. $(call Build/Prepare/Default)
  188. $(call Build/Prepare/zabbix-extra-mac80211)
  189. endef
  190. define Build/Compile
  191. $(call Build/Compile/Default)
  192. $(call Build/Compile/zabbix-extra-mac80211)
  193. endef
  194. define Package/zabbix-agentd/install
  195. $(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
  196. $(call Package/zabbix/install/sbin,$(1),agentd)
  197. $(call Package/zabbix/install/etc,$(1),agentd)
  198. $(call Package/zabbix/install/init.d,$(1),agentd)
  199. endef
  200. define Package/zabbix-extra-mac80211/install
  201. $(call Package/zabbix/install/zabbix.conf.d,$(1),mac80211)
  202. $(INSTALL_DIR) $(1)/usr/bin
  203. $(INSTALL_BIN) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 $(1)/usr/bin/
  204. chmod 4755 $(1)/usr/bin/zabbix_helper_mac80211
  205. endef
  206. define Package/zabbix-extra-network/install
  207. $(call Package/zabbix/install/zabbix.conf.d,$(1),network)
  208. $(INSTALL_DIR) $(1)/usr/share/acl.d
  209. $(INSTALL_DATA) ./files/zabbix-network-ubus-acl.json $(1)/usr/share/acl.d/zabbix-network.json
  210. endef
  211. define Package/zabbix-extra-network/postinst
  212. #!/bin/sh
  213. if [ -z "$${IPKG_INSTROOT}" ]; then
  214. killall -HUP ubusd
  215. fi
  216. endef
  217. define Package/zabbix-extra-wifi/install
  218. $(call Package/zabbix/install/zabbix.conf.d,$(1),wifi)
  219. $(INSTALL_DIR) $(1)/usr/share/acl.d
  220. $(INSTALL_DATA) ./files/zabbix-wifi-ubus-acl.json $(1)/usr/share/acl.d/zabbix-wifi.json
  221. endef
  222. define Package/zabbix-extra-wifi/postinst
  223. #!/bin/sh
  224. if [ -z "$${IPKG_INSTROOT}" ]; then
  225. killall -HUP ubusd
  226. fi
  227. endef
  228. define Package/zabbix-sender/install
  229. $(call Package/zabbix/install/bin,$(1),sender)
  230. endef
  231. define Package/zabbix-get/install
  232. $(call Package/zabbix/install/bin,$(1),get)
  233. endef
  234. define Package/zabbix-server/install
  235. $(call Package/zabbix/install/sbin,$(1),server)
  236. $(call Package/zabbix/install/etc,$(1),server)
  237. endef
  238. define Package/zabbix-server-frontend/install
  239. $(INSTALL_DIR) $(1)/www/zabbix
  240. $(CP) $(PKG_BUILD_DIR)/frontends/php/* $(1)/www/zabbix
  241. endef
  242. define Package/zabbix-proxy/install
  243. $(call Package/zabbix/install/sbin,$(1),proxy)
  244. $(call Package/zabbix/install/etc,$(1),proxy)
  245. endef
  246. $(eval $(call BuildPackage,zabbix-agentd))
  247. $(eval $(call BuildPackage,zabbix-extra-mac80211))
  248. $(eval $(call BuildPackage,zabbix-extra-network))
  249. $(eval $(call BuildPackage,zabbix-extra-wifi))
  250. $(eval $(call BuildPackage,zabbix-sender))
  251. $(eval $(call BuildPackage,zabbix-server))
  252. $(eval $(call BuildPackage,zabbix-server-frontend))
  253. $(eval $(call BuildPackage,zabbix-proxy))
  254. $(eval $(call BuildPackage,zabbix-get))