0e418ef50c548728bb6a409e1328019045612cc2
[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:=4
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 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
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 TARGET_CFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
145
146 ifneq ($(CONFIG_avr32),)
147 TARGET_CFLAGS += -fsigned-char
148 endif
149
150 # common configure args
151 CONFIGURE_ARGS+= \
152 --disable-debug \
153 --enable-daemon \
154 --enable-getifaddrs \
155 --with-nan-emulation \
156
157 CONFIGURE_VARS+= \
158 CFLAGS="$$$$CFLAGS $(FPIC)" \
159 LDFLAGS="$$$$LDFLAGS -lm -lz" \
160 KERNEL_DIR="$(LINUX_DIR)" \
161
162 CONFIGURE_PLUGIN= \
163 $(foreach m, $(1), \
164 $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
165 )
166
167 CONFIGURE_ARGS+= \
168 $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
169 $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
170
171 # exception: mod-ascent needs libxml2
172 ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),)
173 CONFIGURE_VARS+= \
174 CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
175 endif
176
177 ifneq ($(CONFIG_BIG_ENDIAN),)
178 CONFIGURE_ARGS+= --with-fp-layout=endianflip
179 else
180 CONFIGURE_ARGS+= --with-fp-layout=nothing
181 endif
182
183 ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),)
184 CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/"
185 endif
186
187 ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),)
188 CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/"
189 endif
190
191 # exception: mod-netlink needs libnetlink from iproute
192 ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
193 CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
194 endif
195
196 # exception: mod-modbus needs libmodbus
197 ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),)
198 CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr"
199 endif
200
201 # exception: mod-onewire needs libow-capi
202 ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),)
203 CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr"
204 endif
205
206 # exception: mod-rrdtool needs rrdtool-1.0.x
207 ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
208 CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
209 endif
210
211 define Package/collectd/conffiles
212 /etc/collectd.conf
213 endef
214
215 define Package/collectd/install
216 $(INSTALL_DIR) $(1)/usr/sbin
217 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
218 $(INSTALL_DIR) $(1)/usr/share/collectd
219 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/
220 $(INSTALL_DIR) $(1)/etc
221 $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/
222 $(INSTALL_DIR) $(1)/etc/init.d
223 $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
224 endef
225
226 # 1: plugin name
227 # 2: plugin title/description
228 # 3: files
229 # 4: extra dependency
230 define BuildPlugin
231
232 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
233
234 define Package/collectd-mod-$(1)
235 $$(call Package/collectd/Default)
236 TITLE:=$(2) plugin
237 DEPENDS:= collectd $(4)
238 endef
239
240 define Package/collectd-mod-$(1)/install
241 $(INSTALL_DIR) $$(1)/usr/lib/collectd
242 for m in $(3); do \
243 $(CP) \
244 $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
245 $$(1)/usr/lib/collectd/ ; \
246 done
247 endef
248
249 $$(eval $$(call BuildPackage,collectd-mod-$(1)))
250
251 endef
252
253 $(eval $(call BuildPackage,collectd))
254
255 #$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES))
256 $(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl))
257 $(eval $(call BuildPlugin,apcups,apcups status input,apcups,))
258 $(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2))
259 $(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2))
260 $(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
261 $(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
262 $(eval $(call BuildPlugin,cpu,CPU input,cpu,))
263 $(eval $(call BuildPlugin,csv,CSV output,csv,))
264 $(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
265 $(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
266 $(eval $(call BuildPlugin,df,disk space input,df,))
267 $(eval $(call BuildPlugin,disk,disk usage/timing input,disk,))
268 $(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap))
269 $(eval $(call BuildPlugin,email,email output,email,))
270 $(eval $(call BuildPlugin,exec,process exec input,exec,))
271 $(eval $(call BuildPlugin,filecount,file count input,filecount,))
272 $(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,))
273 $(eval $(call BuildPlugin,interface,network interfaces input,interface,))
274 $(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables))
275 $(eval $(call BuildPlugin,irq,interrupt usage input,irq,))
276 $(eval $(call BuildPlugin,iwinfo,libiwinfo wireless statistics,iwinfo,+PACKAGE_collectd-mod-iwinfo:libiwinfo))
277 $(eval $(call BuildPlugin,load,system load input,load,))
278 $(eval $(call BuildPlugin,logfile,log files output,logfile,))
279 $(eval $(call BuildPlugin,madwifi,MadWifi status input,madwifi,))
280 $(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient))
281 $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
282 $(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus))
283 $(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:ip))
284 $(eval $(call BuildPlugin,network,network input/output,network))
285 $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
286 $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
287 $(eval $(call BuildPlugin,nut,UPS monitoring input,nut,@BROKEN))
288 $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
289 $(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN))
290 $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
291 $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping))
292 $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq))
293 $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
294 $(eval $(call BuildPlugin,processes,process status input,processes,))
295 $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
296 $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
297 $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors @BROKEN))
298 $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
299 $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
300 $(eval $(call BuildPlugin,tail,tail input,tail,))
301 $(eval $(call BuildPlugin,table,table-like structured file input,table,))
302 $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
303 $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,@((!TARGET_avr32)||BROKEN))) # fails on avr32 because of warnings treated as errors
304 $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
305 $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
306 $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
307 $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
308 $(eval $(call BuildPlugin,users,user logged in status input,users,))
309 $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
310 $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
311 $(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))