03f30014846c5e92dd74b05ed9dbacf93fe1d5d4
[feed/packages.git] / utils / collectd / Makefile
1 #
2 # Copyright (C) 2006-2015 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.5.0
12 PKG_RELEASE:=4
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://collectd.org/files/
16 PKG_MD5SUM:=c39305ef5514b44238b0d31f77e29e6a
17
18 PKG_FIXUP:=autoreconf
19 PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4
20 PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
21
22 PKG_INSTALL:=1
23 PKG_BUILD_PARALLEL:=1
24 PKG_USE_MIPS16:=0
25
26 COLLECTD_PLUGINS_DISABLED:= \
27 amqp \
28 apple_sensors \
29 aquaero \
30 barometer \
31 battery \
32 ceph \
33 cgroups \
34 cpufreq \
35 curl_json \
36 curl_xml \
37 dbi \
38 drbd \
39 ethstat \
40 fhcount \
41 genericjmx \
42 gmond \
43 hddtemp \
44 ipc \
45 ipmi \
46 ipvs \
47 java \
48 log_logstash \
49 lvm \
50 lpar \
51 mbmon \
52 md \
53 memcachec \
54 memcached \
55 mic \
56 monitorus \
57 multimeter \
58 netapp \
59 nfs \
60 notify_desktop \
61 notify_email \
62 numa \
63 nut \
64 openldap \
65 openvz \
66 oracle \
67 perl \
68 pf \
69 pinba \
70 python \
71 redis \
72 routeros \
73 rrdcached \
74 serial \
75 sigrok \
76 smart \
77 statsd \
78 swap \
79 tape \
80 tokyotyrant \
81 turbostat \
82 uuid \
83 varnish \
84 virt \
85 vserver \
86 write_kafka \
87 write_log \
88 write_mongodb \
89 write_redis \
90 write_riemann \
91 write_sensu \
92 write_tsdb \
93 xmms \
94 zfs_arc \
95 zookeeper
96
97 COLLECTD_PLUGINS_SELECTED:= \
98 apache \
99 apcups \
100 ascent \
101 bind \
102 conntrack \
103 contextswitch \
104 cpu \
105 csv \
106 curl \
107 df \
108 disk \
109 dns \
110 email \
111 entropy \
112 exec \
113 filecount \
114 fscache \
115 interface \
116 iptables \
117 irq \
118 iwinfo \
119 load \
120 logfile \
121 madwifi \
122 memory \
123 modbus \
124 mysql \
125 netlink \
126 network \
127 nginx \
128 ntpd \
129 olsrd \
130 onewire \
131 openvpn \
132 ping \
133 postgresql \
134 powerdns \
135 processes \
136 protocols \
137 rrdtool \
138 sensors \
139 snmp \
140 syslog \
141 table \
142 tail \
143 tcpconns \
144 teamspeak2 \
145 ted \
146 thermal \
147 unixsock \
148 uptime \
149 users \
150 vmem \
151 wireless \
152 write_graphite \
153 write_http \
154
155 PKG_CONFIG_DEPENDS:= \
156 $(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \
157
158 include $(INCLUDE_DIR)/package.mk
159 include $(INCLUDE_DIR)/kernel.mk
160
161 define Package/collectd/Default
162 SECTION:=utils
163 CATEGORY:=Utilities
164 TITLE:=Lightweight system statistics collection daemon
165 URL:=http://verplant.org/collectd/
166 endef
167
168 define Package/collectd
169 $(call Package/collectd/Default)
170 DEPENDS:= +libpthread +zlib +libltdl +libip4tc
171 MENU:=1
172 endef
173
174 define Package/collectd/description
175 collectd is a small daemon which collects system information periodically
176 and provides mechanismns to store the values in a variety of ways.
177 endef
178
179 ifneq ($(CONFIG_avr32),)
180 TARGET_CFLAGS += -fsigned-char
181 endif
182
183 # common configure args
184 CONFIGURE_ARGS+= \
185 --disable-debug \
186 --enable-daemon \
187 --with-nan-emulation \
188 --without-libgcrypt
189
190 CONFIGURE_VARS+= \
191 CFLAGS="$$$$CFLAGS $(FPIC)" \
192 LDFLAGS="$$$$LDFLAGS -lm -lz" \
193 KERNEL_DIR="$(LINUX_DIR)" \
194
195 CONFIGURE_PLUGIN= \
196 $(foreach m, $(1), \
197 $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
198 )
199
200 CONFIGURE_ARGS+= \
201 $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
202 $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
203
204 # exception: mod-ascent needs libxml2
205 ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),)
206 CONFIGURE_VARS+= \
207 CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
208 endif
209
210 ifneq ($(CONFIG_BIG_ENDIAN),)
211 CONFIGURE_ARGS+= --with-fp-layout=endianflip
212 else
213 CONFIGURE_ARGS+= --with-fp-layout=nothing
214 endif
215
216 ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),)
217 CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/"
218 endif
219
220 ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),)
221 CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/"
222 endif
223
224 # exception: mod-netlink needs libnetlink from iproute
225 ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
226 CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
227 endif
228
229 # exception: mod-modbus needs libmodbus
230 ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),)
231 CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr"
232 endif
233
234 # exception: mod-onewire needs libow-capi
235 ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),)
236 CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr"
237 endif
238
239 # exception: mod-rrdtool needs rrdtool-1.0.x
240 ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
241 CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
242 endif
243
244 define Package/collectd/conffiles
245 /etc/collectd.conf
246 endef
247
248 define Package/collectd/install
249 $(INSTALL_DIR) $(1)/usr/sbin
250 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
251 $(INSTALL_DIR) $(1)/usr/share/collectd
252 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/
253 $(INSTALL_DIR) $(1)/etc
254 $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/
255 $(INSTALL_DIR) $(1)/etc/init.d
256 $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
257 endef
258
259 # 1: plugin name
260 # 2: plugin title/description
261 # 3: files
262 # 4: extra dependency
263 define BuildPlugin
264
265 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
266
267 define Package/collectd-mod-$(1)
268 $$(call Package/collectd/Default)
269 TITLE:=$(2) plugin
270 DEPENDS:= collectd $(4)
271 endef
272
273 define Package/collectd-mod-$(1)/install
274 $(INSTALL_DIR) $$(1)/usr/lib/collectd
275 for m in $(3); do \
276 $(CP) \
277 $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
278 $$(1)/usr/lib/collectd/ ; \
279 done
280 endef
281
282 $$(eval $$(call BuildPackage,collectd-mod-$(1)))
283
284 endef
285
286 $(eval $(call BuildPackage,collectd))
287
288 #$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES))
289 $(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl))
290 $(eval $(call BuildPlugin,apcups,apcups status input,apcups,))
291 $(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2))
292 $(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2))
293 $(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
294 $(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
295 $(eval $(call BuildPlugin,cpu,CPU input,cpu,))
296 $(eval $(call BuildPlugin,csv,CSV output,csv,))
297 $(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
298 #$(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
299 $(eval $(call BuildPlugin,df,disk space input,df,))
300 $(eval $(call BuildPlugin,disk,disk usage/timing input,disk,))
301 $(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap))
302 $(eval $(call BuildPlugin,email,email output,email,))
303 $(eval $(call BuildPlugin,entropy,Entropy amount input,entropy,))
304 $(eval $(call BuildPlugin,exec,process exec input,exec,))
305 $(eval $(call BuildPlugin,filecount,file count input,filecount,))
306 $(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,))
307 $(eval $(call BuildPlugin,interface,network interfaces input,interface,))
308 $(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables +libiptc))
309 $(eval $(call BuildPlugin,irq,interrupt usage input,irq,))
310 $(eval $(call BuildPlugin,iwinfo,libiwinfo wireless statistics,iwinfo,+PACKAGE_collectd-mod-iwinfo:libiwinfo))
311 $(eval $(call BuildPlugin,load,system load input,load,))
312 $(eval $(call BuildPlugin,logfile,log files output,logfile,))
313 $(eval $(call BuildPlugin,madwifi,MadWifi status input,madwifi,))
314 #$(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r))
315 $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
316 $(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus))
317 $(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:ip @BROKEN))
318 $(eval $(call BuildPlugin,network,network input/output,network))
319 $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
320 $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
321 #$(eval $(call BuildPlugin,nut,UPS monitoring input,nut,+PACKAGE_collectd-mod-nut:nut))
322 $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
323 $(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN))
324 $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
325 $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping))
326 $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq))
327 $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
328 $(eval $(call BuildPlugin,processes,process status input,processes,))
329 $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
330 $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
331 $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors))
332 $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
333 $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
334 $(eval $(call BuildPlugin,tail,tail input,tail,))
335 $(eval $(call BuildPlugin,table,table-like structured file input,table,))
336 $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
337 $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,@((!TARGET_avr32)||BROKEN))) # fails on avr32 because of warnings treated as errors
338 $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
339 $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
340 $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
341 $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
342 $(eval $(call BuildPlugin,users,user logged in status input,users,))
343 $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
344 $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
345 $(eval $(call BuildPlugin,write-graphite,Carbon/Graphite output,write_graphite,+PACKAGE_collectd-mod-write-graphite:libpthread))
346 $(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))