Merge pull request #1369 from kissg1988/seafile
[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.5
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=@SF/zabbix
16 PKG_MD5SUM:=a82eb0d55d3ca947e10a4a55238f4388
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 --disable-java \
111 --with-sqlite3="$(STAGING_DIR)/usr"
112
113 MAKE_FLAGS += ARCH="linux"
114
115 define Package/zabbix/install/sbin
116 $(INSTALL_DIR) \
117 $(1)/usr/sbin
118
119 $(INSTALL_BIN) \
120 $(PKG_INSTALL_DIR)/usr/sbin/zabbix_$(2) \
121 $(1)/usr/sbin/
122 endef
123
124 define Package/zabbix/install/bin
125 $(INSTALL_DIR) \
126 $(1)/usr/bin
127
128 $(INSTALL_BIN) \
129 $(PKG_INSTALL_DIR)/usr/bin/zabbix_$(2) \
130 $(1)/usr/bin/
131 endef
132
133 define Package/zabbix/install/etc
134 $(INSTALL_DIR) \
135 $(1)/etc
136
137 $(INSTALL_CONF) \
138 $(PKG_INSTALL_DIR)/etc/zabbix_$(2).conf \
139 $(1)/etc/
140 endef
141
142 define Package/zabbix/install/init.d
143 $(INSTALL_DIR) \
144 $(1)/etc/init.d
145
146 $(INSTALL_BIN) \
147 ./files/zabbix_$(2).init \
148 $(1)/etc/init.d/zabbix_$(2)
149 endef
150
151 define Package/zabbix/install/zabbix.conf.d
152 $(INSTALL_DIR) \
153 $(1)/etc/zabbix_agentd.conf.d
154
155 $(INSTALL_BIN) \
156 ./files/$(2) \
157 $(1)/etc/zabbix_agentd.conf.d/$(2)
158 endef
159
160 define Package/zabbix-agent/conffiles
161 /etc/zabbix_agent.conf
162 endef
163 define Package/zabbix-agentd/conffiles
164 /etc/zabbix_agentd.conf
165 endef
166 define Package/zabbix-server/conffiles
167 /etc/zabbix_server.conf
168 endef
169 define Package/zabbix-proxy/conffiles
170 /etc/zabbix_proxy.conf
171 endef
172
173 ifdef CONFIG_PACKAGE_zabbix-extra-mac80211
174 define Build/Prepare/zabbix-extra-mac80211
175 mkdir -p $(PKG_BUILD_DIR)/zabbix-extra-mac80211
176 $(CP) ./files/zabbix_helper_mac80211.c $(PKG_BUILD_DIR)/zabbix-extra-mac80211/
177 endef
178
179 define Build/Compile/zabbix-extra-mac80211
180 $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211.c -o $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211
181 endef
182 endif
183
184 define Build/Prepare
185 $(call Build/Prepare/Default)
186 $(call Build/Prepare/zabbix-extra-mac80211)
187 endef
188
189 define Build/Compile
190 $(call Build/Compile/Default)
191 $(call Build/Compile/zabbix-extra-mac80211)
192 endef
193
194 define Package/zabbix-agent/install
195 $(call Package/zabbix/install/sbin,$(1),agent)
196 $(call Package/zabbix/install/etc,$(1),agent)
197 endef
198
199 define Package/zabbix-agentd/install
200 $(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
201 $(call Package/zabbix/install/sbin,$(1),agentd)
202 $(call Package/zabbix/install/etc,$(1),agentd)
203 $(call Package/zabbix/install/init.d,$(1),agentd)
204 endef
205
206 define Package/zabbix-extra-mac80211/install
207 $(call Package/zabbix/install/zabbix.conf.d,$(1),mac80211)
208 $(INSTALL_DIR) $(1)/usr/bin
209 $(INSTALL_BIN) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 $(1)/usr/bin/
210 chmod 4755 $(1)/usr/bin/zabbix_helper_mac80211
211 endef
212
213 define Package/zabbix-extra-network/install
214 $(call Package/zabbix/install/zabbix.conf.d,$(1),network)
215 endef
216
217 define Package/zabbix-extra-wifi/install
218 $(call Package/zabbix/install/zabbix.conf.d,$(1),wifi)
219 endef
220
221 define Package/zabbix-sender/install
222 $(call Package/zabbix/install/bin,$(1),sender)
223 endef
224
225 define Package/zabbix-get/install
226 $(call Package/zabbix/install/bin,$(1),get)
227 endef
228
229 define Package/zabbix-server/install
230 $(call Package/zabbix/install/sbin,$(1),server)
231 $(call Package/zabbix/install/etc,$(1),server)
232 endef
233
234 define Package/zabbix-proxy/install
235 $(call Package/zabbix/install/sbin,$(1),proxy)
236 $(call Package/zabbix/install/etc,$(1),proxy)
237 endef
238
239 $(eval $(call BuildPackage,zabbix-agent))
240 $(eval $(call BuildPackage,zabbix-agentd))
241 $(eval $(call BuildPackage,zabbix-extra-mac80211))
242 $(eval $(call BuildPackage,zabbix-extra-network))
243 $(eval $(call BuildPackage,zabbix-extra-wifi))
244 $(eval $(call BuildPackage,zabbix-sender))
245 $(eval $(call BuildPackage,zabbix-server))
246 $(eval $(call BuildPackage,zabbix-proxy))
247 $(eval $(call BuildPackage,zabbix-get))