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