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