collectd: remove bogus maximum of 3600 seconds for 'timeleft'
[packages.git] / utils / collectd / Makefile
1 #
2 # Copyright (C) 2006-2012 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.8
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:=7a60495208b9383225493c6dd6abb2f0
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         iwinfo \
84         load \
85         logfile \
86         madwifi \
87         memory \
88         modbus \
89         mysql \
90         netlink \
91         network \
92         nginx \
93         ntpd \
94         nut \
95         olsrd \
96         onewire \
97         openvpn \
98         ping \
99         postgresql \
100         powerdns \
101         processes \
102         protocols \
103         rrdtool \
104         sensors \
105         snmp \
106         syslog \
107         tail \
108         table \
109         ted \
110         tcpconns \
111         teamspeak2 \
112         thermal \
113         unixsock \
114         uptime \
115         users \
116         vmem \
117         wireless \
118         write_http \
119
120 PKG_CONFIG_DEPENDS:= \
121         $(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \
122
123 include $(INCLUDE_DIR)/package.mk
124 include $(INCLUDE_DIR)/kernel.mk
125
126 define Package/collectd/Default
127   SECTION:=utils
128   CATEGORY:=Utilities
129   TITLE:=Lightweight system statistics collection daemon
130   URL:=http://verplant.org/collectd/
131 endef
132
133 define Package/collectd
134 $(call Package/collectd/Default)
135   DEPENDS:= +libpthread +zlib +libltdl +libip4tc
136   MENU:=1
137 endef
138
139 define Package/collectd/description
140  collectd is a small daemon which collects system information periodically
141  and provides mechanismns to store the values in a variety of ways.
142 endef
143
144 ifneq ($(CONFIG_avr32),)
145   TARGET_CFLAGS += -fsigned-char
146 endif
147
148 # common configure args
149 CONFIGURE_ARGS+= \
150         --disable-debug \
151         --enable-daemon \
152         --enable-getifaddrs \
153         --with-nan-emulation \
154         --without-libgcrypt
155
156 CONFIGURE_VARS+= \
157         CFLAGS="$$$$CFLAGS $(FPIC)" \
158         LDFLAGS="$$$$LDFLAGS -lm -lz" \
159         KERNEL_DIR="$(LINUX_DIR)" \
160
161 CONFIGURE_PLUGIN= \
162         $(foreach m, $(1), \
163                 $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
164         )
165
166 CONFIGURE_ARGS+= \
167         $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
168         $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
169
170 # exception: mod-ascent needs libxml2
171 ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),)
172   CONFIGURE_VARS+= \
173         CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
174 endif
175
176 ifneq ($(CONFIG_BIG_ENDIAN),)
177   CONFIGURE_ARGS+= --with-fp-layout=endianflip
178 else
179   CONFIGURE_ARGS+= --with-fp-layout=nothing
180 endif
181
182 ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),)
183   CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/"
184 endif
185
186 ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),)
187   CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/"
188 endif
189
190 # exception: mod-netlink needs libnetlink from iproute
191 ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
192   CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
193 endif
194
195 # exception: mod-modbus needs libmodbus
196 ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),)
197   CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr"
198 endif
199
200 # exception: mod-onewire needs libow-capi
201 ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),)
202   CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr"
203 endif
204
205 # exception: mod-rrdtool needs rrdtool-1.0.x
206 ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
207   CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
208 endif
209
210 define Package/collectd/conffiles
211 /etc/collectd.conf
212 endef
213
214 define Package/collectd/install
215         $(INSTALL_DIR) $(1)/usr/sbin
216         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
217         $(INSTALL_DIR) $(1)/usr/share/collectd
218         $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/
219         $(INSTALL_DIR) $(1)/etc
220         $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/
221         $(INSTALL_DIR) $(1)/etc/init.d
222         $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
223 endef
224
225 # 1: plugin name
226 # 2: plugin title/description
227 # 3: files
228 # 4: extra dependency
229 define BuildPlugin
230
231   PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
232
233   define Package/collectd-mod-$(1)
234   $$(call Package/collectd/Default)
235     TITLE:=$(2) plugin
236     DEPENDS:= collectd $(4)
237   endef
238
239   define Package/collectd-mod-$(1)/install
240         $(INSTALL_DIR) $$(1)/usr/lib/collectd
241         for m in $(3); do \
242                 $(CP) \
243                         $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
244                         $$(1)/usr/lib/collectd/ ; \
245         done
246   endef
247
248   $$(eval $$(call BuildPackage,collectd-mod-$(1)))
249
250 endef
251
252 $(eval $(call BuildPackage,collectd))
253
254 #$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES))
255 $(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl))
256 $(eval $(call BuildPlugin,apcups,apcups status input,apcups,))
257 $(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2))
258 $(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2))
259 $(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
260 $(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
261 $(eval $(call BuildPlugin,cpu,CPU input,cpu,))
262 $(eval $(call BuildPlugin,csv,CSV output,csv,))
263 $(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
264 $(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
265 $(eval $(call BuildPlugin,df,disk space input,df,))
266 $(eval $(call BuildPlugin,disk,disk usage/timing input,disk,))
267 $(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap))
268 $(eval $(call BuildPlugin,email,email output,email,))
269 $(eval $(call BuildPlugin,exec,process exec input,exec,))
270 $(eval $(call BuildPlugin,filecount,file count input,filecount,))
271 $(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,))
272 $(eval $(call BuildPlugin,interface,network interfaces input,interface,))
273 $(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables +libiptc))
274 $(eval $(call BuildPlugin,irq,interrupt usage input,irq,))
275 $(eval $(call BuildPlugin,iwinfo,libiwinfo wireless statistics,iwinfo,+PACKAGE_collectd-mod-iwinfo:libiwinfo))
276 $(eval $(call BuildPlugin,load,system load input,load,))
277 $(eval $(call BuildPlugin,logfile,log files output,logfile,))
278 $(eval $(call BuildPlugin,madwifi,MadWifi status input,madwifi,))
279 $(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r))
280 $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
281 $(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus @BROKEN))
282 $(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:ip))
283 $(eval $(call BuildPlugin,network,network input/output,network))
284 $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
285 $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
286 $(eval $(call BuildPlugin,nut,UPS monitoring input,nut,nut))
287 $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
288 $(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN))
289 $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
290 $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping))
291 $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq))
292 $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
293 $(eval $(call BuildPlugin,processes,process status input,processes,))
294 $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
295 $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
296 $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors @BROKEN))
297 $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
298 $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
299 $(eval $(call BuildPlugin,tail,tail input,tail,))
300 $(eval $(call BuildPlugin,table,table-like structured file input,table,))
301 $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
302 $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,@((!TARGET_avr32)||BROKEN))) # fails on avr32 because of warnings treated as errors
303 $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
304 $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
305 $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
306 $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
307 $(eval $(call BuildPlugin,users,user logged in status input,users,))
308 $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
309 $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
310 $(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))