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