packages: remove dependency on obsolete LINUX_2_4 symbol
[openwrt/svn-archive/archive.git] / utils / collectd / Makefile
1 #
2 # Copyright (C) 2006-2011 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:=collectd
11 PKG_VERSION:=4.10.2
12 PKG_RELEASE:=3
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://collectd.org/files/
16 PKG_MD5SUM:=85d9d8d0a1327782661e3c89800aa70e
17
18 PKG_FIXUP:=autoreconf
19 PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4
20
21 PKG_INSTALL:=1
22 PKG_BUILD_PARALLEL:=1
23
24 COLLECTD_PLUGINS_DISABLED:= \
25 apple_sensors \
26 battery \
27 cpufreq \
28 curl_json \
29 entropy \
30 genericjmx \
31 gmond \
32 hddtemp \
33 ipmi \
34 ipvs \
35 java \
36 libvirt \
37 mbmon \
38 memcachec \
39 memcached \
40 monitorus \
41 multimeter \
42 netapp \
43 nfs \
44 notify_desktop \
45 notify_email \
46 openvz \
47 oracle \
48 perl \
49 pinba \
50 python \
51 routeros \
52 rrdcached \
53 serial \
54 swap \
55 tape \
56 tokyotyrant \
57 uuid \
58 vserver \
59 xmms \
60 zfs_arc \
61
62 COLLECTD_PLUGINS_SELECTED:= \
63 apache \
64 apcups \
65 ascent \
66 bind \
67 conntrack \
68 contextswitch \
69 cpu \
70 csv \
71 curl \
72 dbi \
73 df \
74 disk \
75 dns \
76 email \
77 exec \
78 filecount \
79 fscache \
80 interface \
81 iptables \
82 irq \
83 load \
84 logfile \
85 madwifi \
86 memory \
87 modbus \
88 mysql \
89 netlink \
90 network \
91 nginx \
92 ntpd \
93 nut \
94 olsrd \
95 onewire \
96 openvpn \
97 ping \
98 postgresql \
99 powerdns \
100 processes \
101 protocols \
102 rrdtool \
103 sensors \
104 snmp \
105 syslog \
106 tail \
107 table \
108 ted \
109 tcpconns \
110 teamspeak2 \
111 thermal \
112 unixsock \
113 uptime \
114 users \
115 vmem \
116 wireless \
117 write_http \
118
119 PKG_CONFIG_DEPENDS:= \
120 $(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \
121
122 include $(INCLUDE_DIR)/package.mk
123 include $(INCLUDE_DIR)/kernel.mk
124
125 define Package/collectd/Default
126 SECTION:=utils
127 CATEGORY:=Utilities
128 TITLE:=Lightweight system statistics collection daemon
129 URL:=http://verplant.org/collectd/
130 endef
131
132 define Package/collectd
133 $(call Package/collectd/Default)
134 DEPENDS:= +libpthread +zlib +libltdl
135 MENU:=1
136 endef
137
138 define Package/collectd/description
139 collectd is a small daemon which collects system information periodically
140 and provides mechanismns to store the values in a variety of ways.
141 endef
142
143 ifneq ($(CONFIG_avr32),)
144 TARGET_CFLAGS += -fsigned-char
145 endif
146
147 # common configure args
148 CONFIGURE_ARGS+= \
149 --disable-debug \
150 --enable-daemon \
151 --enable-getifaddrs \
152 --with-nan-emulation \
153
154 CONFIGURE_VARS+= \
155 CFLAGS="$$$$CFLAGS $(FPIC)" \
156 LDFLAGS="$$$$LDFLAGS -lm -lz" \
157 KERNEL_DIR="$(LINUX_DIR)" \
158
159 CONFIGURE_PLUGIN= \
160 $(foreach m, $(1), \
161 $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
162 )
163
164 CONFIGURE_ARGS+= \
165 $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
166 $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
167
168 # exception: mod-ascent needs libxml2
169 ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),)
170 CONFIGURE_VARS+= \
171 CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
172 endif
173
174 ifneq ($(CONFIG_BIG_ENDIAN),)
175 CONFIGURE_ARGS+= --with-fp-layout=endianflip
176 else
177 CONFIGURE_ARGS+= --with-fp-layout=nothing
178 endif
179
180 ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),)
181 CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/"
182 endif
183
184 ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),)
185 CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/"
186 endif
187
188 # exception: mod-netlink needs libnetlink from iproute
189 ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
190 CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
191 endif
192
193 # exception: mod-modbus needs libmodbus
194 ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),)
195 CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr"
196 endif
197
198 # exception: mod-onewire needs libow-capi
199 ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),)
200 CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr"
201 endif
202
203 # exception: mod-rrdtool needs rrdtool-1.0.x
204 ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
205 CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
206 endif
207
208 define Package/collectd/conffiles
209 /etc/collectd.conf
210 endef
211
212 define Package/collectd/install
213 $(INSTALL_DIR) $(1)/usr/sbin
214 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
215 $(INSTALL_DIR) $(1)/usr/share/collectd
216 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/
217 $(INSTALL_DIR) $(1)/etc
218 $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/
219 $(INSTALL_DIR) $(1)/etc/init.d
220 $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
221 endef
222
223 # 1: plugin name
224 # 2: plugin title/description
225 # 3: files
226 # 4: extra dependency
227 define BuildPlugin
228
229 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
230
231 define Package/collectd-mod-$(1)
232 $$(call Package/collectd/Default)
233 TITLE:=$(2) plugin
234 DEPENDS:= collectd $(4)
235 endef
236
237 define Package/collectd-mod-$(1)/install
238 $(INSTALL_DIR) $$(1)/usr/lib/collectd
239 for m in $(3); do \
240 $(CP) \
241 $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
242 $$(1)/usr/lib/collectd/ ; \
243 done
244 endef
245
246 $$(eval $$(call BuildPackage,collectd-mod-$(1)))
247
248 endef
249
250 $(eval $(call BuildPackage,collectd))
251
252 #$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES))
253 $(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl))
254 $(eval $(call BuildPlugin,apcups,apcups status input,apcups,))
255 $(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2))
256 $(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2))
257 $(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
258 $(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
259 $(eval $(call BuildPlugin,cpu,CPU input,cpu,))
260 $(eval $(call BuildPlugin,csv,CSV output,csv,))
261 $(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
262 $(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
263 $(eval $(call BuildPlugin,df,disk space input,df,))
264 $(eval $(call BuildPlugin,disk,disk usage/timing input,disk,))
265 $(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap))
266 $(eval $(call BuildPlugin,email,email output,email,))
267 $(eval $(call BuildPlugin,exec,process exec input,exec,))
268 $(eval $(call BuildPlugin,filecount,file count input,filecount,))
269 $(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,))
270 $(eval $(call BuildPlugin,interface,network interfaces input,interface,))
271 $(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables))
272 $(eval $(call BuildPlugin,irq,interrupt usage input,irq,))
273 $(eval $(call BuildPlugin,load,system load input,load,))
274 $(eval $(call BuildPlugin,logfile,log files output,logfile,))
275 $(eval $(call BuildPlugin,madwifi,MadWifi status input,madwifi,))
276 $(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient))
277 $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
278 $(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus))
279 $(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:ip))
280 $(eval $(call BuildPlugin,network,network input/output,network))
281 $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
282 $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
283 $(eval $(call BuildPlugin,nut,UPS monitoring input,nut,@BROKEN))
284 $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
285 $(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN))
286 $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
287 $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping))
288 $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq))
289 $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
290 $(eval $(call BuildPlugin,processes,process status input,processes,))
291 $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
292 $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
293 $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors @BROKEN))
294 $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
295 $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
296 $(eval $(call BuildPlugin,tail,tail input,tail,))
297 $(eval $(call BuildPlugin,table,table-like structured file input,table,))
298 $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
299 $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,@((!TARGET_avr32)||BROKEN))) # fails on avr32 because of warnings treated as errors
300 $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
301 $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
302 $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
303 $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
304 $(eval $(call BuildPlugin,users,user logged in status input,users,))
305 $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
306 $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
307 $(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))