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