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