bluez-tools: Add package bluezetools
[feed/packages.git] / utils / collectd / Makefile
1 #
2 # Copyright (C) 2006-2016 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:=5.12.0
12 PKG_RELEASE:=15
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=https://collectd.org/files/ \
16 https://github.com/collectd/collectd/releases/download/collectd-$(PKG_VERSION)
17 PKG_HASH:=5bae043042c19c31f77eb8464e56a01a5454e0b39fa07cf7ad0f1bfc9c3a09d6
18
19 PKG_FIXUP:=autoreconf
20 PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4
21 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>, Hannu Nyman <hannu.nyman@iki.fi>
22 PKG_CPE_ID:=cpe:/a:collectd:collectd
23
24 PKG_INSTALL:=1
25 PKG_BUILD_PARALLEL:=1
26 PKG_USE_MIPS16:=0
27
28 PKG_CONFIG_DEPENDS:= \
29 PACKAGE_COLLECTD_ENCRYPTED_NETWORK \
30 PACKAGE_COLLECTD_DEBUG_OUTPUT_ENABLE
31
32 COLLECTD_PLUGINS_DISABLED:= \
33 amqp \
34 ampq1 \
35 apple_sensors \
36 aquaero \
37 barometer \
38 battery \
39 buddyinfo \
40 capabilities \
41 ceph \
42 cgroups \
43 cpusleep \
44 curl_jolokia \
45 curl_json \
46 curl_xml \
47 dbi \
48 dcpmm \
49 dpdkevents \
50 dpdkstat \
51 dpdk_telemetry \
52 drbd \
53 fhcount \
54 genericjmx \
55 gmond \
56 gps \
57 gpu_nvidia \
58 grpc \
59 hddtemp \
60 hugepages \
61 infiniband \
62 intel_pmu \
63 intel_rdt \
64 ipc \
65 ipmi \
66 ipstats \
67 ipvs \
68 java \
69 logparser \
70 log_logstash \
71 lvm \
72 lpar \
73 madwifi \
74 mbmon \
75 mcelog \
76 md \
77 mdevents \
78 memcachec \
79 memcached \
80 mic \
81 monitorus \
82 multimeter \
83 netapp \
84 netstat_udp \
85 nfs \
86 notify_desktop \
87 notify_email \
88 notify_nagios \
89 numa \
90 onewire \
91 openldap \
92 openvz \
93 oracle \
94 ovs_events \
95 ovs_stats \
96 pcie_errors \
97 perl \
98 pf \
99 pinba \
100 procevent \
101 python \
102 redfish \
103 redis \
104 rrdcached \
105 serial \
106 sigrok \
107 slurm \
108 snmp_agent \
109 statsd \
110 synproxy \
111 sysevent \
112 tape \
113 tokyotyrant \
114 turbostat \
115 uuid \
116 varnish \
117 virt \
118 vserver \
119 write_influxdb_udp \
120 write_kafka \
121 write_log \
122 write_mongodb \
123 write_prometheus \
124 write_redis \
125 write_riemann \
126 write_sensu \
127 write_stackdriver \
128 write_syslog \
129 write_tsdb \
130 xencpu \
131 xmms \
132 zfs_arc \
133 zone \
134 zookeeper
135
136 COLLECTD_PLUGINS_SELECTED:= \
137 apache \
138 apcups \
139 ascent \
140 bind \
141 chrony \
142 conntrack \
143 contextswitch \
144 cpu \
145 cpufreq \
146 csv \
147 curl \
148 df \
149 dhcpleases \
150 disk \
151 dns \
152 email \
153 entropy \
154 ethstat \
155 exec \
156 filecount \
157 fscache \
158 interface \
159 ipstatistics \
160 iptables \
161 irq \
162 iwinfo \
163 load \
164 logfile \
165 lua \
166 match_empty_counter \
167 match_hashed \
168 match_regex \
169 match_timediff \
170 match_value \
171 memory \
172 modbus \
173 mqtt \
174 mysql \
175 netlink \
176 network \
177 nginx \
178 ntpd \
179 nut \
180 olsrd \
181 openvpn \
182 ping \
183 postgresql \
184 powerdns \
185 processes \
186 protocols \
187 routeros \
188 rrdtool \
189 sensors \
190 smart \
191 snmp \
192 snmp6 \
193 swap \
194 syslog \
195 table \
196 tail \
197 tail_csv \
198 tcpconns \
199 teamspeak2 \
200 ted \
201 thermal \
202 threshold \
203 ubi \
204 unixsock \
205 uptime \
206 users \
207 vmem \
208 wireless \
209 write_graphite \
210 write_http
211
212 PKG_CONFIG_DEPENDS:= \
213 $(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \
214
215 include $(INCLUDE_DIR)/package.mk
216 include $(INCLUDE_DIR)/kernel.mk
217 # collectd-mod-mysql needs iconv
218 include $(INCLUDE_DIR)/nls.mk
219
220 define Package/collectd/Default
221 SECTION:=utils
222 CATEGORY:=Utilities
223 TITLE:=Lightweight system statistics collection daemon
224 URL:=https://collectd.org/
225 endef
226
227 define Package/collectd
228 $(call Package/collectd/Default)
229 DEPENDS:= +libpthread \
230 +zlib \
231 +libltdl \
232 +libip4tc \
233 +jshn \
234 +PACKAGE_collectd-mod-lua:liblua
235 MENU:=1
236 endef
237
238 define Package/collectd/description
239 collectd is a small daemon which collects system information periodically
240 and provides mechanismns to store the values in a variety of ways.
241 endef
242
243 define Package/collectd/config
244 config PACKAGE_COLLECTD_ENCRYPTED_NETWORK
245 bool "Enable ability to use encrypted networking"
246 default n
247 depends on PACKAGE_collectd
248 select PACKAGE_collectd-mod-network
249
250 config PACKAGE_COLLECTD_DEBUG_OUTPUT_ENABLE
251 bool "Enable debug output"
252 default n
253 depends on PACKAGE_collectd
254 help
255 Enables the compiler option that collectd is compiled with
256 debugging support. This is used at development stages to get
257 more messages from the collectd during development.
258 endef
259
260 # common configure args
261 CONFIGURE_ARGS+= \
262 --disable-werror \
263 --enable-daemon \
264 --with-nan-emulation \
265 --with-libyajl=no \
266 --without-perl-bindings
267
268 CONFIGURE_VARS+= \
269 CFLAGS="$$$$CFLAGS $(FPIC)" \
270 LDFLAGS="$$$$LDFLAGS -lm -lz" \
271 KERNEL_DIR="$(LINUX_DIR)"
272
273 ifneq ($(CONFIG_PACKAGE_collectd-mod-lua),)
274 CONFIGURE_VARS+= \
275 LDFLAGS="$$$$LDFLAGS -llua"
276 endif
277
278 ifneq ($(CONFIG_PACKAGE_COLLECTD_ENCRYPTED_NETWORK),)
279 CONFIGURE_ARGS+= \
280 --with-libgcrypt=$(STAGING_DIR)/usr
281 CONFIGURE_VARS+= \
282 GCRYPT_LIBS="-lgcrypt"
283 else
284 CONFIGURE_ARGS+= \
285 --without-libgcrypt
286 endif
287
288 ifeq ($(CONFIG_PACKAGE_COLLECTD_DEBUG_OUTPUT_ENABLE),y)
289 CONFIGURE_ARGS+= \
290 --enable-debug
291 else
292 CONFIGURE_ARGS+= \
293 --disable-debug
294 endif
295
296 CONFIGURE_PLUGIN= \
297 $(foreach m, $(1), \
298 $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
299 )
300
301 CONFIGURE_ARGS+= \
302 $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
303 $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
304
305 # exception: mod-ascent needs libxml2
306 ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),)
307 CONFIGURE_VARS+= \
308 CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
309 endif
310
311 ifneq ($(CONFIG_BIG_ENDIAN),)
312 CONFIGURE_ARGS+= --with-fp-layout=endianflip
313 else
314 CONFIGURE_ARGS+= --with-fp-layout=nothing
315 endif
316
317 ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),)
318 CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/"
319 endif
320
321 ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),)
322 CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/"
323 endif
324
325 # exception: mod-netlink needs libnetlink from iproute
326 ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
327 CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
328 endif
329
330 # exception: mod-modbus needs libmodbus
331 ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),)
332 CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr"
333 endif
334
335 # exception: mod-rrdtool needs rrdtool-1.0.x
336 ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
337 CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
338 endif
339
340 # exception: mod-smart needs libatasmart
341 ifneq ($(CONFIG_PACKAGE_collectd-mod-smart),)
342 CONFIGURE_ARGS+= \
343 --with-libatasmart="$(STAGING_DIR)/usr" \
344 --with-libudev="$(STAGING_DIR)/usr"
345 else
346 CONFIGURE_ARGS+= --without-libudev
347 endif
348
349 define Package/collectd/conffiles
350 /etc/collectd.conf
351 /etc/config/collectd
352 endef
353
354 define Package/collectd/install
355 $(INSTALL_DIR) $(1)/usr/sbin
356 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
357
358 $(INSTALL_DIR) $(1)/usr/share/collectd
359 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/
360
361 $(INSTALL_DIR) $(1)/etc/init.d
362 $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
363
364 $(INSTALL_DIR) $(1)/etc/config
365 $(INSTALL_CONF) files/collectd.uci $(1)/etc/config/collectd
366 endef
367
368 # 1: plugin name
369 # 2: plugin title/description
370 # 3: files
371 # 4: extra dependency
372 define BuildPlugin
373
374 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
375
376 define Package/collectd-mod-$(1)
377 $$(call Package/collectd/Default)
378 TITLE:=$(2) plugin
379 DEPENDS:= collectd $(4)
380 endef
381
382 define Package/collectd-mod-$(1)/install
383 $(INSTALL_DIR) $$(1)/usr/lib/collectd
384 for m in $(3); do \
385 $(CP) \
386 $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
387 $$(1)/usr/lib/collectd/ ; \
388 done
389 if [ -f ./files/usr/share/collectd/plugin/$(1).json ]; then \
390 $(INSTALL_DIR) $$(1)/usr/share/collectd/plugin ; \
391 $(INSTALL_DATA) ./files/usr/share/collectd/plugin/$(1).json \
392 $$(1)/usr/share/collectd/plugin/$(1).json ; \
393 fi
394 endef
395
396 $$(eval $$(call BuildPackage,collectd-mod-$(1)))
397
398 endef
399
400 define BuildScriptLuaPlugin
401 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
402
403 define Package/collectd-mod-$(1)
404 $$(call Package/collectd/Default)
405 TITLE:=$(2) plugin
406 DEPENDS:= $(4)
407 endef
408
409 define Package/collectd-mod-$(1)/install
410 $(INSTALL_DIR) $$(1)/usr/lib/collectd-mod-lua
411 for m in $(3); do \
412 ${INSTALL_DATA} \
413 ./files/lua-scripts/$$$$$$$${m}.lua $$(1)/usr/lib/collectd-mod-lua/ ; \
414 done
415 if [ -f ./files/usr/share/collectd/plugin/$(1).json ]; then \
416 $(INSTALL_DIR) $$(1)/usr/share/collectd/plugin ; \
417 $(INSTALL_DATA) ./files/usr/share/collectd/plugin/$(1).json \
418 $$(1)/usr/share/collectd/plugin/$(1).json ; \
419 fi
420 endef
421
422 $$(eval $$(call BuildPackage,collectd-mod-$(1)))
423
424 endef
425
426 define BuildScriptPlugin
427 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
428
429 define Package/collectd-mod-$(1)
430 $$(call Package/collectd/Default)
431 TITLE:=$(2) plugin
432 DEPENDS:= $(4)
433 endef
434
435 define Package/collectd-mod-$(1)/install
436 $(INSTALL_DIR) $$(1)/usr/libexec/collectd
437 for m in $(3); do \
438 ${INSTALL_BIN} \
439 ./files/exec-scripts/$$$$$$$${m}.sh $$(1)/usr/libexec/collectd/ ; \
440 done
441 if [ -f ./files/usr/share/collectd/plugin/$(1).json ]; then \
442 $(INSTALL_DIR) $$(1)/usr/share/collectd/plugin ; \
443 $(INSTALL_DATA) ./files/usr/share/collectd/plugin/$(1).json \
444 $$(1)/usr/share/collectd/plugin/$(1).json ; \
445 fi
446 endef
447
448 $$(eval $$(call BuildPackage,collectd-mod-$(1)))
449
450 endef
451
452 $(eval $(call BuildPackage,collectd))
453
454 #$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES))
455 $(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl))
456 $(eval $(call BuildPlugin,apcups,apcups status input,apcups,))
457 $(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2))
458 $(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2))
459 $(eval $(call BuildPlugin,chrony,chrony status input,chrony,))
460 $(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
461 $(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
462 $(eval $(call BuildPlugin,cpu,CPU input,cpu,))
463 $(eval $(call BuildPlugin,cpufreq,CPU Freq input,cpufreq,@(TARGET_x86||TARGET_x86_64||TARGET_mvebu||TARGET_ipq806x||TARGET_armvirt||TARGET_ipq40xx||TARGET_bcm27xx_bcm2709||TARGET_rockchip||TARGET_mediatek||TARGET_ipq807x))) # Only enable on targets with CPUs supporting frequency scaling
464 $(eval $(call BuildPlugin,csv,CSV output,csv,))
465 $(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
466 #$(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
467 $(eval $(call BuildPlugin,df,disk space input,df,))
468 $(eval $(call BuildPlugin,dhcpleases,show dhcpleases,dhcpleases,))
469 $(eval $(call BuildPlugin,disk,disk usage/timing input,disk,+PACKAGE_collectd-mod-smart:libudev))
470 $(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap))
471 $(eval $(call BuildPlugin,email,email output,email,))
472 $(eval $(call BuildPlugin,entropy,Entropy amount input,entropy,))
473 $(eval $(call BuildPlugin,ethstat,Ethernet adapter statistics input,ethstat,))
474 $(eval $(call BuildPlugin,exec,process exec input,exec,))
475 $(eval $(call BuildPlugin,filecount,file count input,filecount,))
476 $(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,))
477 $(eval $(call BuildPlugin,interface,network interfaces input,interface,))
478 $(eval $(call BuildPlugin,ipstatistics,ipstatistics input,ipstatistics,))
479 $(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables +libip4tc +libip6tc))
480 $(eval $(call BuildPlugin,irq,interrupt usage input,irq,))
481 $(eval $(call BuildPlugin,iwinfo,libiwinfo wireless statistics,iwinfo,+PACKAGE_collectd-mod-iwinfo:libiwinfo))
482 $(eval $(call BuildPlugin,load,system load input,load,))
483 $(eval $(call BuildPlugin,logfile,log files output,logfile,))
484 $(eval $(call BuildPlugin,lua,lua input/output,lua,+PACKAGE_collectd-mod-lua:liblua))
485 $(eval $(call BuildPlugin,match-empty-counter,empty-counter match,match_empty_counter,))
486 $(eval $(call BuildPlugin,match-hashed,hashed match,match_hashed,))
487 $(eval $(call BuildPlugin,match-regex,regex match,match_regex,))
488 $(eval $(call BuildPlugin,match-timediff,timediff match,match_timediff,))
489 $(eval $(call BuildPlugin,match-value,value match,match_value,))
490 $(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r))
491 $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
492 $(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus))
493 $(eval $(call BuildPlugin,mqtt,transmit data with MQTT,mqtt,+PACKAGE_collectd-mod-mqtt:libmosquitto))
494 $(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:libmnl))
495 $(eval $(call BuildPlugin,network,network input/output,network,+PACKAGE_COLLECTD_ENCRYPTED_NETWORK:libgcrypt))
496 $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
497 $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
498 $(eval $(call BuildPlugin,nut,UPS monitoring input,nut,+PACKAGE_collectd-mod-nut:nut-common))
499 $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
500 $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
501 $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping))
502 $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq))
503 $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
504 $(eval $(call BuildPlugin,processes,process status input,processes,+PACKAGE_collectd-mod-processes:libmnl))
505 $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
506 $(eval $(call BuildPlugin,routeros,MikroTik RouterOS input,routeros,+PACKAGE_collectd-mod-routeros:librouteros))
507 $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
508 $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:lm-sensors))
509 $(eval $(call BuildPlugin,smart,smart input,smart,+PACKAGE_collectd-mod-smart:libatasmart))
510 $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
511 $(eval $(call BuildPlugin,snmp6,snmp6 input,snmp6,))
512 $(eval $(call BuildPlugin,swap,swap input,swap,))
513 $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
514 $(eval $(call BuildPlugin,tail,tail input,tail,))
515 $(eval $(call BuildPlugin,tail-csv,tail CSV input,tail_csv,))
516 $(eval $(call BuildPlugin,table,table-like structured file input,table,))
517 $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
518 $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,))
519 $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
520 $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
521 $(eval $(call BuildPlugin,threshold,Notifications and thresholds,threshold,))
522 $(eval $(call BuildPlugin,ubi,Unsorted block images,ubi,@NAND_SUPPORT))
523 $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
524 $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
525 $(eval $(call BuildPlugin,users,user logged in status input,users,))
526 $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
527 $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
528 $(eval $(call BuildPlugin,write-graphite,Carbon/Graphite output,write_graphite,+PACKAGE_collectd-mod-write-graphite:libpthread))
529 $(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))
530
531 $(eval $(call BuildScriptPlugin,sqm,SQM/qdisc collection,sqm_collectd,+PACKAGE_collectd-mod-sqm:collectd-mod-exec))
532 $(eval $(call BuildScriptLuaPlugin,ltq-dsl,Lantiq DSL collection,dsl,@TARGET_lantiq_xrx200 +PACKAGE_collectd-mod-ltq-dsl:collectd-mod-lua +libubus-lua))