79f33345c1f0d39013e797da90e0a858e46b128d
[openwrt/svn-archive/archive.git] / utils / collectd / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=collectd
12 PKG_VERSION:=4.4.1
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://collectd.org/files/
17 PKG_MD5SUM:=176880c32a06bee9d5e6e2e7c76751a3
18
19 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
20 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/collectd/common_info
25 SECTION:=utils
26 CATEGORY:=Utilities
27 TITLE:=Lightweight system statistics collection daemon
28 URL:=http://verplant.org/collectd/
29 endef
30
31 define Package/collectd/description
32 collectd is a small daemon which collects system information periodically
33 and provides mechanismns to store the values in a variety of ways.
34 endef
35
36 define Package/collectd
37 $(call Package/collectd/common_info)
38 DEPENDS:=+libgcc +libpthread
39 MENU:=1
40 endef
41
42
43 #
44 # output plugins
45 #
46 define Package/collectd-mod-csv
47 $(call Package/collectd/common_info)
48 TITLE:=collectd - csv output plugin
49 DEPENDS:=collectd
50 endef
51
52 define Package/collectd-mod-email
53 $(call Package/collectd/common_info)
54 TITLE:=collectd - email output plugin
55 DEPENDS:=collectd
56 endef
57
58 define Package/collectd-mod-logfile
59 $(call Package/collectd/common_info)
60 TITLE:=collectd - logfile output plugin
61 DEPENDS:=collectd
62 endef
63
64 define Package/collectd-mod-network
65 $(call Package/collectd/common_info)
66 TITLE:=collectd - network input/output plugin
67 DEPENDS:=collectd
68 endef
69
70 define Package/collectd-mod-syslog
71 $(call Package/collectd/common_info)
72 TITLE:=collectd - syslog output plugin
73 DEPENDS:=collectd
74 endef
75
76 define Package/collectd-mod-unixsock
77 $(call Package/collectd/common_info)
78 TITLE:=collectd - unix socket output plugin
79 DEPENDS:=collectd
80 endef
81
82
83 #
84 # input plugins
85 #
86 define Package/collectd-mod-apache
87 $(call Package/collectd/common_info)
88 TITLE:=collectd - apache status input plugin
89 DEPENDS:=collectd +libcurl
90 endef
91
92 define Package/collectd-mod-apcups
93 $(call Package/collectd/common_info)
94 TITLE:=collectd - apcups status input plugin
95 DEPENDS:=collectd
96 endef
97
98 define Package/collectd-mod-ascent
99 $(call Package/collectd/common_info)
100 TITLE:=collectd - ascent status input plugin
101 DEPENDS:=collectd +libcurl +libxml2
102 endef
103
104 define Package/collectd-mod-cpu
105 $(call Package/collectd/common_info)
106 TITLE:=collectd - cpu input plugin
107 DEPENDS:=collectd
108 endef
109
110 define Package/collectd-mod-df
111 $(call Package/collectd/common_info)
112 TITLE:=collectd - disk space input plugin
113 DEPENDS:=collectd
114 endef
115
116 define Package/collectd-mod-disk
117 $(call Package/collectd/common_info)
118 TITLE:=collectd - disk usage/timing input plugin
119 DEPENDS:=collectd
120 endef
121
122 define Package/collectd-mod-dns
123 $(call Package/collectd/common_info)
124 TITLE:=collectd - dns traffic input plugin
125 DEPENDS:=collectd +libpcap
126 endef
127
128 define Package/collectd-mod-exec
129 $(call Package/collectd/common_info)
130 TITLE:=collectd - process exec input plugin
131 DEPENDS:=collectd
132 endef
133
134 define Package/collectd-mod-interface
135 $(call Package/collectd/common_info)
136 TITLE:=collectd - network interfaces input plugin
137 DEPENDS:=collectd
138 endef
139
140 define Package/collectd-mod-iptables
141 $(call Package/collectd/common_info)
142 TITLE:=collectd - iptables status input plugin
143 DEPENDS:=collectd
144 endef
145
146 define Package/collectd-mod-irq
147 $(call Package/collectd/common_info)
148 TITLE:=collectd - interrupt usage input plugin
149 DEPENDS:=collectd
150 endef
151
152 define Package/collectd-mod-load
153 $(call Package/collectd/common_info)
154 TITLE:=collectd - system load input plugin
155 DEPENDS:=collectd
156 endef
157
158 define Package/collectd-mod-netlink
159 $(call Package/collectd/common_info)
160 TITLE:=collectd - netlink input plugin (uses iproute2)
161 DEPENDS:=collectd +ip
162 endef
163
164 define Package/collectd-mod-nginx
165 $(call Package/collectd/common_info)
166 TITLE:=collectd - nginx status input plugin
167 DEPENDS:=collectd +libcurl
168 endef
169
170 define Package/collectd-mod-ntpd
171 $(call Package/collectd/common_info)
172 TITLE:=collectd - ntp daemon status input plugin
173 DEPENDS:=collectd
174 endef
175
176 define Package/collectd-mod-ping
177 $(call Package/collectd/common_info)
178 TITLE:=collectd - ping status input plugin
179 DEPENDS:=collectd
180 endef
181
182 define Package/collectd-mod-powerdns
183 $(call Package/collectd/common_info)
184 TITLE:=collectd - powerdns server status input plugin
185 DEPENDS:=collectd
186 endef
187
188 define Package/collectd-mod-processes
189 $(call Package/collectd/common_info)
190 TITLE:=collectd - process status plugin
191 DEPENDS:=collectd
192 endef
193
194
195 define Package/collectd-mod-rrdtool1
196 $(call Package/collectd/common_info)
197 TITLE:=collectd - rrdtool 1.0.x output plugin
198 DEPENDS:=collectd +librrd1
199 endef
200
201 define Package/collectd-mod-rrdtool
202 $(call Package/collectd/common_info)
203 TITLE:=collectd - rrdtool 1.2.x output plugin
204 DEPENDS:=collectd +librrd
205 endef
206
207 define Package/collectd-mod-snmp
208 $(call Package/collectd/common_info)
209 TITLE:=collectd - snmp input plugin
210 DEPENDS:=collectd +libnetsnmp
211 endef
212
213 define Package/collectd-mod-tail
214 $(call Package/collectd/common_info)
215 TITLE:=collectd - tail input plugin
216 DEPENDS:=collectd
217 endef
218
219 define Package/collectd-mod-teamspeak2
220 $(call Package/collectd/common_info)
221 TITLE:=collectd - teamspeak2 input plugin
222 DEPENDS:=collectd
223 endef
224
225 define Package/collectd-mod-tcpconns
226 $(call Package/collectd/common_info)
227 TITLE:=collectd - tcp connection tracking input plugin
228 DEPENDS:=collectd
229 endef
230
231 define Package/collectd-mod-users
232 $(call Package/collectd/common_info)
233 TITLE:=collectd - user login status input plugin
234 DEPENDS:=collectd
235 endef
236
237 define Package/collectd-mod-vmem
238 $(call Package/collectd/common_info)
239 TITLE:=collectd - virtual memory usage input plugin
240 DEPENDS:=collectd
241 endef
242
243 define Package/collectd-mod-wireless
244 $(call Package/collectd/common_info)
245 TITLE:=collectd - wireless status input plugin
246 DEPENDS:=collectd
247 endef
248
249
250 define Package/collectd/conffiles
251 /etc/collectd.conf
252 endef
253
254 define Build/Configure
255 endef
256
257 define Build/Compile
258 -$(MAKE) -C $(PKG_BUILD_DIR) clean
259 $(call Build/Configure/Default, $(PKG_CONFIGURE_OPTS))
260 $(call Build/Compile/Default)
261 endef
262
263
264 #
265 # Build PKG_CONFIGURE_OPTS
266 #
267
268 # common configure args
269 PKG_CONFIGURE_OPTS:= \
270 --disable-debug \
271 --enable-daemon \
272 --enable-getifaddrs \
273 --with-nan-emulation \
274 --with-fp-layout=nothing
275
276 # list of permanently disabled plugins
277 disabled_plugins := apple_sensors battery cpufreq entropy hddtemp ipmi ipvs libvirt mbmon memcached \
278 multimeter mysql nfs nut perl sensors serial swap tape uuid vserver xmms
279
280 # list of selectable plugins
281 selectable_plugins := apache apcups ascent cpu csv df disk dns email exec interface iptables irq load \
282 logfile memory netlink network nginx ntpd ping powerdns processes snmp \
283 syslog tail tcpconns teamspeak2 unixsock users vmem wireless
284
285 # makro to enable / disable plugin
286 define enable_plugin
287 ifneq ($$(CONFIG_PACKAGE_collectd-mod-$(1)),)
288 PKG_CONFIGURE_OPTS += --enable-$(1)
289 else
290 PKG_CONFIGURE_OPTS += --disable-$(1)
291 endif
292 endef
293
294 # build args for permanently disabled plugins
295 PKG_CONFIGURE_OPTS += $(foreach plugin,$(disabled_plugins),--disable-$(plugin))
296
297 # build args for selectable plugins
298 $(foreach plugin,$(selectable_plugins),$(eval $(call enable_plugin,$(plugin))))
299
300 # exception: mod-netlink needs iproute2
301 ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
302 PKG_CONFIGURE_OPTS += --with-libnetlink=$(wildcard $(BUILD_DIR)/iproute2-*)
303 endif
304
305 # exception: mod-rrdtool(1) needs rrdtool
306 ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool1)$(CONFIG_PACKAGE_collectd-mod-rrdtool),)
307 PKG_CONFIGURE_OPTS += --enable-rrdtool
308 ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool1),)
309 PKG_CONFIGURE_OPTS += --with-rrdtool=$(wildcard $(BUILD_DIR)/rrdtool-1.0.*)
310 else
311 PKG_CONFIGURE_OPTS += --with-rrdtool=$(wildcard $(BUILD_DIR)/rrdtool-1.2.*)
312 endif
313 endif
314
315
316 MAKE_FLAGS += \
317 DESTDIR="$(PKG_INSTALL_DIR)" \
318 all install
319
320 define Package/collectd/install
321 $(INSTALL_DIR) $(1)/usr/sbin
322 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
323 $(INSTALL_DIR) $(1)/usr/lib/collectd
324 $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/lib/collectd/types.db $(1)/usr/lib/collectd/
325 $(INSTALL_DIR) $(1)/etc
326 $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/
327 $(INSTALL_DIR) $(1)/etc/init.d
328 $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
329 endef
330
331 define Package/collectd-mod-apache/install
332 $(INSTALL_DIR) $(1)/usr/lib/collectd
333 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/apache.so $(1)/usr/lib/collectd/
334 endef
335
336 define Package/collectd-mod-apcups/install
337 $(INSTALL_DIR) $(1)/usr/lib/collectd
338 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/apcups.so $(1)/usr/lib/collectd/
339 endef
340
341 define Package/collectd-mod-ascent/install
342 $(INSTALL_DIR) $(1)/usr/lib/collectd
343 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/ascent.so $(1)/usr/lib/collectd/
344 endef
345
346 define Package/collectd-mod-cpu/install
347 $(INSTALL_DIR) $(1)/usr/lib/collectd
348 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/cpu.so $(1)/usr/lib/collectd/
349 endef
350
351 define Package/collectd-mod-csv/install
352 $(INSTALL_DIR) $(1)/usr/lib/collectd
353 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/csv.so $(1)/usr/lib/collectd/
354 endef
355
356 define Package/collectd-mod-df/install
357 $(INSTALL_DIR) $(1)/usr/lib/collectd
358 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/df.so $(1)/usr/lib/collectd/
359 endef
360
361 define Package/collectd-mod-disk/install
362 $(INSTALL_DIR) $(1)/usr/lib/collectd
363 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/disk.so $(1)/usr/lib/collectd/
364 endef
365
366 define Package/collectd-mod-dns/install
367 $(INSTALL_DIR) $(1)/usr/lib/collectd
368 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/dns.so $(1)/usr/lib/collectd/
369 endef
370
371 define Package/collectd-mod-email/install
372 $(INSTALL_DIR) $(1)/usr/lib/collectd
373 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/email.so $(1)/usr/lib/collectd/
374 endef
375
376 define Package/collectd-mod-exec/install
377 $(INSTALL_DIR) $(1)/usr/lib/collectd
378 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/exec.so $(1)/usr/lib/collectd/
379 endef
380
381 define Package/collectd-mod-interface/install
382 $(INSTALL_DIR) $(1)/usr/lib/collectd
383 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/interface.so $(1)/usr/lib/collectd/
384 endef
385
386 define Package/collectd-mod-iptables/install
387 $(INSTALL_DIR) $(1)/usr/lib/collectd
388 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/iptables.so $(1)/usr/lib/collectd/
389 endef
390
391 define Package/collectd-mod-irq/install
392 $(INSTALL_DIR) $(1)/usr/lib/collectd
393 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/irq.so $(1)/usr/lib/collectd/
394 endef
395
396 define Package/collectd-mod-load/install
397 $(INSTALL_DIR) $(1)/usr/lib/collectd
398 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/load.so $(1)/usr/lib/collectd/
399 endef
400
401 define Package/collectd-mod-logfile/install
402 $(INSTALL_DIR) $(1)/usr/lib/collectd
403 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/logfile.so $(1)/usr/lib/collectd/
404 endef
405
406 define Package/collectd-mod-netlink/install
407 $(INSTALL_DIR) $(1)/usr/lib/collectd
408 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/netlink.so $(1)/usr/lib/collectd/
409 endef
410
411 define Package/collectd-mod-network/install
412 $(INSTALL_DIR) $(1)/usr/lib/collectd
413 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/network.so $(1)/usr/lib/collectd/
414 endef
415
416 define Package/collectd-mod-nginx/install
417 $(INSTALL_DIR) $(1)/usr/lib/collectd
418 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/nginx.so $(1)/usr/lib/collectd/
419 endef
420
421 define Package/collectd-mod-ntpd/install
422 $(INSTALL_DIR) $(1)/usr/lib/collectd
423 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/ntpd.so $(1)/usr/lib/collectd/
424 endef
425
426 define Package/collectd-mod-ping/install
427 $(INSTALL_DIR) $(1)/usr/lib/collectd
428 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/ping.so $(1)/usr/lib/collectd/
429 endef
430
431 define Package/collectd-mod-powerdns/install
432 $(INSTALL_DIR) $(1)/usr/lib/collectd
433 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/powerdns.so $(1)/usr/lib/collectd/
434 endef
435
436 define Package/collectd-mod-processes/install
437 $(INSTALL_DIR) $(1)/usr/lib/collectd
438 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/processes.so $(1)/usr/lib/collectd/
439 endef
440
441 define Package/collectd-mod-rrdtool1/install
442 $(INSTALL_DIR) $(1)/usr/lib/collectd
443 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/rrdtool.so $(1)/usr/lib/collectd/
444 endef
445
446 define Package/collectd-mod-rrdtool/install
447 $(INSTALL_DIR) $(1)/usr/lib/collectd
448 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/rrdtool.so $(1)/usr/lib/collectd/
449 endef
450
451 define Package/collectd-mod-snmp/install
452 $(INSTALL_DIR) $(1)/usr/lib/collectd
453 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/snmp.so $(1)/usr/lib/collectd/
454 endef
455
456 define Package/collectd-mod-syslog/install
457 $(INSTALL_DIR) $(1)/usr/lib/collectd
458 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/syslog.so $(1)/usr/lib/collectd/
459 endef
460
461 define Package/collectd-mod-tail/install
462 $(INSTALL_DIR) $(1)/usr/lib/collectd
463 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/tail.so $(1)/usr/lib/collectd/
464 endef
465
466 define Package/collectd-mod-teamspeak2/install
467 $(INSTALL_DIR) $(1)/usr/lib/collectd
468 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/teamspeak2.so $(1)/usr/lib/collectd/
469 endef
470
471 define Package/collectd-mod-tcpconns/install
472 $(INSTALL_DIR) $(1)/usr/lib/collectd
473 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/tcpconns.so $(1)/usr/lib/collectd/
474 endef
475
476 define Package/collectd-mod-unixsock/install
477 $(INSTALL_DIR) $(1)/usr/lib/collectd
478 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/unixsock.so $(1)/usr/lib/collectd/
479 endef
480
481 define Package/collectd-mod-users/install
482 $(INSTALL_DIR) $(1)/usr/lib/collectd
483 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/users.so $(1)/usr/lib/collectd/
484 endef
485
486 define Package/collectd-mod-vmem/install
487 $(INSTALL_DIR) $(1)/usr/lib/collectd
488 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/vmem.so $(1)/usr/lib/collectd/
489 endef
490
491 define Package/collectd-mod-wireless/install
492 $(INSTALL_DIR) $(1)/usr/lib/collectd
493 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/collectd/wireless.so $(1)/usr/lib/collectd/
494 endef
495
496
497 $(eval $(call BuildPackage,collectd))
498 $(eval $(call BuildPackage,collectd-mod-apache))
499 $(eval $(call BuildPackage,collectd-mod-apcups))
500 $(eval $(call BuildPackage,collectd-mod-ascent))
501 $(eval $(call BuildPackage,collectd-mod-cpu))
502 $(eval $(call BuildPackage,collectd-mod-csv))
503 $(eval $(call BuildPackage,collectd-mod-df))
504 $(eval $(call BuildPackage,collectd-mod-disk))
505 $(eval $(call BuildPackage,collectd-mod-dns))
506 $(eval $(call BuildPackage,collectd-mod-email))
507 $(eval $(call BuildPackage,collectd-mod-exec))
508 $(eval $(call BuildPackage,collectd-mod-interface))
509 $(eval $(call BuildPackage,collectd-mod-iptables))
510 $(eval $(call BuildPackage,collectd-mod-irq))
511 $(eval $(call BuildPackage,collectd-mod-load))
512 $(eval $(call BuildPackage,collectd-mod-logfile))
513 $(eval $(call BuildPackage,collectd-mod-netlink))
514 $(eval $(call BuildPackage,collectd-mod-network))
515 $(eval $(call BuildPackage,collectd-mod-nginx))
516 $(eval $(call BuildPackage,collectd-mod-ntpd))
517 $(eval $(call BuildPackage,collectd-mod-ping))
518 $(eval $(call BuildPackage,collectd-mod-powerdns))
519 $(eval $(call BuildPackage,collectd-mod-processes))
520 $(eval $(call BuildPackage,collectd-mod-rrdtool1))
521 $(eval $(call BuildPackage,collectd-mod-rrdtool))
522 $(eval $(call BuildPackage,collectd-mod-snmp))
523 $(eval $(call BuildPackage,collectd-mod-syslog))
524 $(eval $(call BuildPackage,collectd-mod-tail))
525 $(eval $(call BuildPackage,collectd-mod-teamspeak2))
526 $(eval $(call BuildPackage,collectd-mod-tcpconns))
527 $(eval $(call BuildPackage,collectd-mod-unixsock))
528 $(eval $(call BuildPackage,collectd-mod-users))
529 $(eval $(call BuildPackage,collectd-mod-vmem))
530 $(eval $(call BuildPackage,collectd-mod-wireless))