c6add0c028d1d6c5bb65620132e6f813a9f9e4e7
[openwrt/svn-archive/archive.git] / utils / collectd / Makefile
1 #
2 # Copyright (C) 2006-2009 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:=4.9.0
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://collectd.org/files/
16 PKG_MD5SUM:=5b2e5f57716f2485a3b4eb57774a3818
17
18 PKG_FIXUP:=libtool
19
20 COLLECTD_PLUGINS_DISABLED:= \
21 apple_sensors \
22 battery \
23 cpufreq \
24 curl_json \
25 entropy \
26 genericjmx \
27 gmond \
28 hddtemp \
29 ipmi \
30 ipvs \
31 java \
32 libvirt \
33 mbmon \
34 memcachec \
35 memcached \
36 monitorus \
37 multimeter \
38 netapp \
39 nfs \
40 notify_desktop \
41 notify_email \
42 openvz \
43 oracle \
44 perl \
45 python \
46 routeros \
47 rrdcached \
48 serial \
49 swap \
50 tape \
51 tokyotyrant \
52 uuid \
53 vserver \
54 xmms \
55 zfs_arc \
56
57 COLLECTD_PLUGINS_SELECTED:= \
58 apache \
59 apcups \
60 ascent \
61 bind \
62 conntrack \
63 contextswitch \
64 cpu \
65 csv \
66 curl \
67 dbi \
68 df \
69 disk \
70 dns \
71 email \
72 exec \
73 filecount \
74 fscache \
75 interface \
76 iptables \
77 irq \
78 load \
79 logfile \
80 madwifi \
81 memory \
82 mysql \
83 netlink \
84 network \
85 nginx \
86 ntpd \
87 nut \
88 olsrd \
89 onewire \
90 openvpn \
91 ping \
92 postgresql \
93 powerdns \
94 processes \
95 protocols \
96 rrdtool \
97 sensors \
98 snmp \
99 syslog \
100 tail \
101 table \
102 ted \
103 tcpconns \
104 teamspeak2 \
105 thermal \
106 unixsock \
107 uptime \
108 users \
109 vmem \
110 wireless \
111 write_http \
112
113 PKG_CONFIG_DEPENDS:= \
114 $(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(COLLECTD_PLUGINS_SELECTED)) \
115
116 include $(INCLUDE_DIR)/package.mk
117 include $(INCLUDE_DIR)/kernel.mk
118
119 define Package/collectd/Default
120 SECTION:=utils
121 CATEGORY:=Utilities
122 TITLE:=Lightweight system statistics collection daemon
123 URL:=http://verplant.org/collectd/
124 endef
125
126 define Package/collectd
127 $(call Package/collectd/Default)
128 DEPENDS:=+libgcc +libpthread +zlib
129 MENU:=1
130 endef
131
132 define Package/collectd/description
133 collectd is a small daemon which collects system information periodically
134 and provides mechanismns to store the values in a variety of ways.
135 endef
136
137 # common configure args
138 CONFIGURE_ARGS+= \
139 --disable-debug \
140 --enable-daemon \
141 --enable-getifaddrs \
142 --with-nan-emulation \
143 --with-fp-layout=nothing
144
145 CONFIGURE_VARS+= \
146 CFLAGS="$$$$CFLAGS $(FPIC)" \
147 LDFLAGS="$$$$LDFLAGS -lm -lz" \
148 KERNEL_DIR="$(LINUX_DIR)" \
149
150 CONFIGURE_PLUGIN:= \
151 $(foreach m, $(1), \
152 $(if $(CONFIG_PACKAGE_collectd-mod-$(m)),--enable-$(m),--disable-$(m)) \
153 )
154
155 CONFIGURE_ARGS+= \
156 $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
157 $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
158
159 # exception: mod-ascent needs libxml2
160 ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
161 CONFIGURE_VARS+= \
162 CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
163 endif
164
165 # exception: mod-netlink needs libnetlink from iproute
166 ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
167 CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
168 endif
169
170 # exception: mod-onewire needs libow-capi
171 ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),)
172 CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr"
173 endif
174
175 # exception: mod-rrdtool needs rrdtool-1.0.x
176 ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
177 CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
178 endif
179
180 MAKE_FLAGS += \
181 DESTDIR="$(PKG_INSTALL_DIR)" \
182 all install
183
184 define Package/collectd/conffiles
185 /etc/collectd.conf
186 endef
187
188 define Package/collectd/install
189 $(INSTALL_DIR) $(1)/usr/sbin
190 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
191 $(INSTALL_DIR) $(1)/usr/share/collectd
192 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/
193 $(INSTALL_DIR) $(1)/etc
194 $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/
195 $(INSTALL_DIR) $(1)/etc/init.d
196 $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
197 endef
198
199 # 1: plugin name
200 # 2: plugin title/description
201 # 3: files
202 # 4: extra dependency
203 define BuildPlugin
204
205 PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
206
207 define Package/collectd-mod-$(1)
208 $$(call Package/collectd/Default)
209 TITLE:=$(2) plugin
210 DEPENDS:= collectd $(4)
211 endef
212
213 define Package/collectd-mod-$(1)/install
214 $(INSTALL_DIR) $$(1)/usr/lib/collectd
215 for m in $(3); do \
216 $(CP) \
217 $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
218 $$(1)/usr/lib/collectd/ ; \
219 done
220 endef
221
222 $$(eval $$(call BuildPackage,collectd-mod-$(1)))
223
224 endef
225
226 $(eval $(call BuildPackage,collectd))
227
228 #$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES))
229 $(eval $(call BuildPlugin,apache,apache status input,apache,+libcurl))
230 $(eval $(call BuildPlugin,apcups,apcups status input,apcups,))
231 $(eval $(call BuildPlugin,ascent,ascent status input,ascent,+libcurl +libxml2))
232 $(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+libcurl +libxml2))
233 $(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
234 $(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
235 $(eval $(call BuildPlugin,cpu,CPU input,cpu,))
236 $(eval $(call BuildPlugin,csv,CSV output,csv,))
237 $(eval $(call BuildPlugin,curl,cURL input,curl,+libcurl))
238 $(eval $(call BuildPlugin,dbi,relational database input,dbi,+libdbi))
239 $(eval $(call BuildPlugin,df,disk space input,df,))
240 $(eval $(call BuildPlugin,disk,disk usage/timing input,disk,))
241 $(eval $(call BuildPlugin,dns,DNS traffic input,dns,+libpcap))
242 $(eval $(call BuildPlugin,email,email output,email,))
243 $(eval $(call BuildPlugin,exec,process exec input,exec,))
244 $(eval $(call BuildPlugin,filecount,file count input,filecount,))
245 $(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,))
246 $(eval $(call BuildPlugin,interface,network interfaces input,interface,))
247 $(eval $(call BuildPlugin,iptables,iptables status input,iptables,+iptables))
248 $(eval $(call BuildPlugin,irq,interrupt usage input,irq,))
249 $(eval $(call BuildPlugin,load,system load input,load,))
250 $(eval $(call BuildPlugin,logfile,log files output,logfile,))
251 $(eval $(call BuildPlugin,madwifi,MadWifi status input,madwifi,))
252 $(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+libmysqlclient))
253 $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
254 $(eval $(call BuildPlugin,netlink,netlink input,netlink,+ip))
255 $(eval $(call BuildPlugin,network,network input/output,network))
256 $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+libcurl))
257 $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
258 $(eval $(call BuildPlugin,nut,UPS monitoring input,nut,@BROKEN))
259 $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
260 $(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+libow-capi @BROKEN))
261 $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
262 $(eval $(call BuildPlugin,ping,ping status input,ping,+liboping))
263 $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+libpq))
264 $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
265 $(eval $(call BuildPlugin,processes,process status input,processes,))
266 $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
267 $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+librrd1))
268 $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+libsensors @BROKEN))
269 $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+libnetsnmp))
270 $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
271 $(eval $(call BuildPlugin,tail,tail input,tail,))
272 $(eval $(call BuildPlugin,table,table-like structured file input,table,))
273 $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
274 $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,))
275 $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
276 $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
277 $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
278 $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
279 $(eval $(call BuildPlugin,users,user logged in status input,users,))
280 $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
281 $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
282 $(eval $(call BuildPlugin,write_http,HTTP POST output,write_http,+libcurl))