Makefile 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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.0.3
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=@SF/zabbix
  13. PKG_MD5SUM:=7c45d37000e67d75042695344c9937e0
  14. PKG_LICENSE:=GPL-2.0
  15. PKG_LICENSE_FILES:=COPYING
  16. PKG_INSTALL:=1
  17. PKG_FIXUP:=autoreconf
  18. include $(INCLUDE_DIR)/package.mk
  19. include $(INCLUDE_DIR)/nls.mk
  20. define Package/zabbix/Default
  21. SECTION:=admin
  22. CATEGORY:=Administration
  23. TITLE:=Zabbix
  24. URL:=http://www.zabbix.com/
  25. SUBMENU:=zabbix
  26. MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
  27. USERID:=zabbix=53:zabbix=53
  28. DEPENDS += $(ICONV_DEPENDS)
  29. endef
  30. define Package/zabbix-agentd
  31. $(call Package/zabbix/Default)
  32. TITLE+= agentd
  33. endef
  34. define Package/zabbix-extra-mac80211
  35. $(call Package/zabbix/Default)
  36. TITLE+= discovery/userparameters for mac80211
  37. DEPENDS = +zabbix-agentd @PACKAGE_MAC80211_DEBUGFS @KERNEL_DEBUG_FS
  38. endef
  39. define Package/zabbix-extra-network
  40. $(call Package/zabbix/Default)
  41. TITLE+= discovery/userparameters for network
  42. DEPENDS = +zabbix-agentd +libuci-lua +lua
  43. endef
  44. define Package/zabbix-extra-wifi
  45. $(call Package/zabbix/Default)
  46. TITLE+= discovery/userparameters for wifi
  47. DEPENDS = +zabbix-agentd +libiwinfo-lua +libuci-lua +lua
  48. endef
  49. define Package/zabbix-sender
  50. $(call Package/zabbix/Default)
  51. TITLE+= sender
  52. endef
  53. define Package/zabbix-get
  54. $(call Package/zabbix/Default)
  55. TITLE+= get
  56. endef
  57. define Package/zabbix-server
  58. $(call Package/zabbix/Default)
  59. TITLE+= server
  60. DEPENDS += +libsqlite3
  61. endef
  62. define Package/zabbix-proxy
  63. $(call Package/zabbix/Default)
  64. TITLE+= proxy
  65. DEPENDS += +libsqlite3
  66. endef
  67. define Package/zabbix-extra-mac80211/description
  68. An extra package for zabbix-agentd that adds a discovery rule for mac80211 wifi phy and many userparameters.
  69. It contains an suid helper to allow zabbix-agentd to still run as zabbix user and not as root.
  70. See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates.
  71. endef
  72. define Package/zabbix-extra-network/description
  73. An extra package for zabbix-agentd that adds a discovery rule for openwrt network interfaces.
  74. The idea here is to discover only interfaces listed in /etc/config/network (discover br-lan and not eth0.1 and wlan0)
  75. See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates.
  76. endef
  77. define Package/zabbix-extra-wifi/description
  78. An extra package for zabbix-agentd that adds a discovery rule for wifi interfaces and many userparameters.
  79. As it uses libiwinfo, it works with all wifi devices supported by openwrt.
  80. See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates.
  81. endef
  82. CONFIGURE_ARGS+= \
  83. --enable-agent \
  84. --enable-server \
  85. --enable-proxy \
  86. $(call autoconf_bool,CONFIG_IPV6,ipv6) \
  87. --disable-java \
  88. --with-sqlite3="$(STAGING_DIR)/usr"
  89. MAKE_FLAGS += ARCH="linux"
  90. define Package/zabbix/install/sbin
  91. $(INSTALL_DIR) \
  92. $(1)/usr/sbin
  93. $(INSTALL_BIN) \
  94. $(PKG_INSTALL_DIR)/usr/sbin/zabbix_$(2) \
  95. $(1)/usr/sbin/
  96. endef
  97. define Package/zabbix/install/bin
  98. $(INSTALL_DIR) \
  99. $(1)/usr/bin
  100. $(INSTALL_BIN) \
  101. $(PKG_INSTALL_DIR)/usr/bin/zabbix_$(2) \
  102. $(1)/usr/bin/
  103. endef
  104. define Package/zabbix/install/etc
  105. $(INSTALL_DIR) \
  106. $(1)/etc
  107. $(INSTALL_CONF) \
  108. $(PKG_INSTALL_DIR)/etc/zabbix_$(2).conf \
  109. $(1)/etc/
  110. endef
  111. define Package/zabbix/install/init.d
  112. $(INSTALL_DIR) \
  113. $(1)/etc/init.d
  114. $(INSTALL_BIN) \
  115. ./files/zabbix_$(2).init \
  116. $(1)/etc/init.d/zabbix_$(2)
  117. endef
  118. define Package/zabbix/install/zabbix.conf.d
  119. $(INSTALL_DIR) \
  120. $(1)/etc/zabbix_agentd.conf.d
  121. $(INSTALL_BIN) \
  122. ./files/$(2) \
  123. $(1)/etc/zabbix_agentd.conf.d/$(2)
  124. endef
  125. define Package/zabbix-agentd/conffiles
  126. /etc/zabbix_agentd.conf
  127. endef
  128. define Package/zabbix-server/conffiles
  129. /etc/zabbix_server.conf
  130. endef
  131. define Package/zabbix-proxy/conffiles
  132. /etc/zabbix_proxy.conf
  133. endef
  134. ifdef CONFIG_PACKAGE_zabbix-extra-mac80211
  135. define Build/Prepare/zabbix-extra-mac80211
  136. mkdir -p $(PKG_BUILD_DIR)/zabbix-extra-mac80211
  137. $(CP) ./files/zabbix_helper_mac80211.c $(PKG_BUILD_DIR)/zabbix-extra-mac80211/
  138. endef
  139. define Build/Compile/zabbix-extra-mac80211
  140. $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211.c -o $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211
  141. endef
  142. endif
  143. define Build/Prepare
  144. $(call Build/Prepare/Default)
  145. $(call Build/Prepare/zabbix-extra-mac80211)
  146. endef
  147. define Build/Compile
  148. $(call Build/Compile/Default)
  149. $(call Build/Compile/zabbix-extra-mac80211)
  150. endef
  151. define Package/zabbix-agentd/install
  152. $(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
  153. $(call Package/zabbix/install/sbin,$(1),agentd)
  154. $(call Package/zabbix/install/etc,$(1),agentd)
  155. $(call Package/zabbix/install/init.d,$(1),agentd)
  156. endef
  157. define Package/zabbix-extra-mac80211/install
  158. $(call Package/zabbix/install/zabbix.conf.d,$(1),mac80211)
  159. $(INSTALL_DIR) $(1)/usr/bin
  160. $(INSTALL_BIN) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 $(1)/usr/bin/
  161. chmod 4755 $(1)/usr/bin/zabbix_helper_mac80211
  162. endef
  163. define Package/zabbix-extra-network/install
  164. $(call Package/zabbix/install/zabbix.conf.d,$(1),network)
  165. endef
  166. define Package/zabbix-extra-wifi/install
  167. $(call Package/zabbix/install/zabbix.conf.d,$(1),wifi)
  168. endef
  169. define Package/zabbix-sender/install
  170. $(call Package/zabbix/install/bin,$(1),sender)
  171. endef
  172. define Package/zabbix-get/install
  173. $(call Package/zabbix/install/bin,$(1),get)
  174. endef
  175. define Package/zabbix-server/install
  176. $(call Package/zabbix/install/sbin,$(1),server)
  177. $(call Package/zabbix/install/etc,$(1),server)
  178. endef
  179. define Package/zabbix-proxy/install
  180. $(call Package/zabbix/install/sbin,$(1),proxy)
  181. $(call Package/zabbix/install/etc,$(1),proxy)
  182. endef
  183. $(eval $(call BuildPackage,zabbix-agentd))
  184. $(eval $(call BuildPackage,zabbix-extra-mac80211))
  185. $(eval $(call BuildPackage,zabbix-extra-network))
  186. $(eval $(call BuildPackage,zabbix-extra-wifi))
  187. $(eval $(call BuildPackage,zabbix-sender))
  188. $(eval $(call BuildPackage,zabbix-server))
  189. $(eval $(call BuildPackage,zabbix-proxy))
  190. $(eval $(call BuildPackage,zabbix-get))