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