[packages] collectd: provide missing AM_PATH_LIBGCRYPT macro and autoreconf libltdl...
[packages.git] / utils / collectd / Makefile
1 #
2 # Copyright (C) 2006-2010 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:=2
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:=libtool
19 PKG_LIBTOOL_PATHS:=. libltdl
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         python \
50         routeros \
51         rrdcached \
52         serial \
53         swap \
54         tape \
55         tokyotyrant \
56         uuid \
57         vserver \
58         xmms \
59         zfs_arc \
60
61 COLLECTD_PLUGINS_SELECTED:= \
62         apache \
63         apcups \
64         ascent \
65         bind \
66         conntrack \
67         contextswitch \
68         cpu \
69         csv \
70         curl \
71         dbi \
72         df \
73         disk \
74         dns \
75         email \
76         exec \
77         filecount \
78         fscache \
79         interface \
80         iptables \
81         irq \
82         load \
83         logfile \
84         madwifi \
85         memory \
86         mysql \
87         netlink \
88         network \
89         nginx \
90         ntpd \
91         nut \
92         olsrd \
93         onewire \
94         openvpn \
95         ping \
96         postgresql \
97         powerdns \
98         processes \
99         protocols \
100         rrdtool \
101         sensors \
102         snmp \
103         syslog \
104         tail \
105         table \
106         ted \
107         tcpconns \
108         teamspeak2 \
109         thermal \
110         unixsock \
111         uptime \
112         users \
113         vmem \
114         wireless \
115         write_http \
116
117 PKG_CONFIG_DEPENDS:= \
118         $(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \
119
120 include $(INCLUDE_DIR)/package.mk
121 include $(INCLUDE_DIR)/kernel.mk
122
123 define Package/collectd/Default
124   SECTION:=utils
125   CATEGORY:=Utilities
126   TITLE:=Lightweight system statistics collection daemon
127   URL:=http://verplant.org/collectd/
128 endef
129
130 define Package/collectd
131 $(call Package/collectd/Default)
132   DEPENDS:= +libpthread +zlib +libltdl
133   MENU:=1
134 endef
135
136 define Package/collectd/description
137  collectd is a small daemon which collects system information periodically
138  and provides mechanismns to store the values in a variety of ways.
139 endef
140
141 ifneq ($(CONFIG_avr32),)
142   TARGET_CFLAGS += -fsigned-char
143 endif
144
145 # common configure args
146 CONFIGURE_ARGS+= \
147         --disable-debug \
148         --enable-daemon \
149         --enable-getifaddrs \
150         --with-nan-emulation \
151
152 CONFIGURE_VARS+= \
153         CFLAGS="$$$$CFLAGS $(FPIC)" \
154         LDFLAGS="$$$$LDFLAGS -lm -lz" \
155         KERNEL_DIR="$(LINUX_DIR)" \
156
157 CONFIGURE_PLUGIN= \
158         $(foreach m, $(1), \
159                 $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
160         )
161
162 CONFIGURE_ARGS+= \
163         $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
164         $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
165
166 # exception: mod-ascent needs libxml2
167 ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),)
168   CONFIGURE_VARS+= \
169         CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
170 endif
171
172 ifneq ($(CONFIG_BIG_ENDIAN),)
173   CONFIGURE_ARGS+= --with-fp-layout=endianflip
174 else
175   CONFIGURE_ARGS+= --with-fp-layout=nothing
176 endif
177
178 ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),)
179   CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/"
180 endif
181
182 ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),)
183   CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/"
184 endif
185
186 # exception: mod-netlink needs libnetlink from iproute
187 ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
188   CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
189 endif
190
191 # exception: mod-onewire needs libow-capi
192 ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),)
193   CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr"
194 endif
195
196 # exception: mod-rrdtool needs rrdtool-1.0.x
197 ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
198   CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
199 endif
200
201 define Package/collectd/conffiles
202 /etc/collectd.conf
203 endef
204
205 #define Build/Configure
206 #       (cd $(PKG_BUILD_DIR); \
207 #               autoreconf -v --install || exit 1 \
208 #       );
209 #       $(call Build/Configure/Default)
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 @(!LINUX_2_4||BROKEN)))
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,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:ip @(!LINUX_2_4||BROKEN)))
279 $(eval $(call BuildPlugin,network,network input/output,network))
280 $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
281 $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
282 $(eval $(call BuildPlugin,nut,UPS monitoring input,nut,@BROKEN))
283 $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
284 $(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN))
285 $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
286 $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping))
287 $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq))
288 $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
289 $(eval $(call BuildPlugin,processes,process status input,processes,))
290 $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
291 $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
292 $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors @BROKEN))
293 $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
294 $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
295 $(eval $(call BuildPlugin,tail,tail input,tail,))
296 $(eval $(call BuildPlugin,table,table-like structured file input,table,))
297 $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
298 $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,@((!TARGET_avr32)||BROKEN))) # fails on avr32 because of warnings treated as errors
299 $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
300 $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
301 $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
302 $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
303 $(eval $(call BuildPlugin,users,user logged in status input,users,))
304 $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
305 $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
306 $(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))