Ver código fonte

collectd: import from packages, add myself as maintainer

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Jo-Philipp Wich 10 anos atrás
pai
commit
56fd1eaa78

+ 312
- 0
utils/collectd/Makefile Ver arquivo

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

+ 90
- 0
utils/collectd/files/collectd.conf Ver arquivo

@@ -0,0 +1,90 @@
1
+#
2
+# OpenWrt Config file for collectd(1).
3
+# Please read collectd.conf(5) for a list of options.
4
+# http://collectd.org/
5
+#
6
+
7
+#Hostname   "localhost"
8
+#FQDNLookup  true
9
+BaseDir     "/var/lib/collectd"
10
+PIDFile     "/var/run/collectd.pid"
11
+#PluginDir  "/usr/lib/collectd"
12
+#TypesDB    "/usr/share/collectd/types.db"
13
+Interval    30
14
+ReadThreads 2
15
+
16
+#LoadPlugin syslog
17
+#LoadPlugin logfile
18
+
19
+#<Plugin syslog>
20
+#	LogLevel info
21
+#</Plugin>
22
+
23
+#<Plugin logfile>
24
+#	LogLevel info
25
+#	File STDOUT
26
+#	Timestamp true
27
+#</Plugin>
28
+
29
+LoadPlugin cpu
30
+LoadPlugin df
31
+LoadPlugin disk
32
+LoadPlugin interface
33
+LoadPlugin load
34
+LoadPlugin memory
35
+LoadPlugin network
36
+#LoadPlugin ping
37
+#LoadPlugin processes
38
+#LoadPlugin rrdtool
39
+#LoadPlugin serial
40
+LoadPlugin wireless
41
+
42
+#<Plugin df>
43
+#	FSType tmpfs
44
+#	IgnoreSelected true
45
+#	ReportByDevice false
46
+#	ReportReserved false
47
+#	ReportInodes false
48
+#</Plugin>
49
+
50
+#<Plugin disk>
51
+#	Disk "/^[hs]d[a-f][0-9]?$/"
52
+#	IgnoreSelected false
53
+#</Plugin>
54
+
55
+#<Plugin interface>
56
+#	Interface "eth0"
57
+#	Interface "br-lan"
58
+#	IgnoreSelected false
59
+#</Plugin>
60
+
61
+<Plugin network>
62
+#	Server "ff18::efc0:4a42" "25826"
63
+	Server "239.192.74.66" "25826"
64
+#	Listen "ff18::efc0:4a42" "25826"
65
+#	Listen "239.192.74.66" "25826"
66
+#	TimeToLive "128"
67
+#	Forward false
68
+#	CacheFlush 1800
69
+#	ReportStats false
70
+</Plugin>
71
+
72
+#<Plugin ping>
73
+#	Host "host.foo.bar"
74
+#	Interval 1.0
75
+#	Timeout 0.9
76
+#	TTL 255
77
+#	SourceAddress "1.2.3.4"
78
+#	Device "eth0"
79
+#	MaxMissed -1
80
+#</Plugin>
81
+
82
+#<Plugin processes>
83
+#	Process "name"
84
+#</Plugin>
85
+
86
+#<Plugin rrdtool>
87
+#	DataDir "/var/lib/collectd/rrd"
88
+#	CacheTimeout 120
89
+#	CacheFlush   900
90
+#</Plugin>

+ 15
- 0
utils/collectd/files/collectd.init Ver arquivo

@@ -0,0 +1,15 @@
1
+#!/bin/sh /etc/rc.common
2
+# Copyright (C) 2006-2011 OpenWrt.org
3
+
4
+START=80
5
+
6
+SERVICE_USE_PID=1
7
+
8
+start() {
9
+	mkdir -m 0755 -p /var/lib/collectd
10
+	service_start /usr/sbin/collectd
11
+}
12
+
13
+stop() {
14
+	service_stop /usr/sbin/collectd
15
+}

+ 4
- 0
utils/collectd/patches/001-undefined-AM_PATH_LIBGCRYPT.patch Ver arquivo

@@ -0,0 +1,4 @@
1
+--- /dev/null
2
++++ b/fake-am_path_libgcrypt.m4
3
+@@ -0,0 +1 @@
4
++AC_DEFUN([AM_PATH_LIBGCRYPT],[:])

+ 66
- 0
utils/collectd/patches/003-remove-werror.patch Ver arquivo

@@ -0,0 +1,66 @@
1
+--- a/src/Makefile.am
2
++++ b/src/Makefile.am
3
+@@ -7,7 +7,7 @@ SUBDIRS += liboconfig
4
+ endif
5
+ 
6
+ if COMPILER_IS_GCC
7
+-AM_CFLAGS = -Wall -Werror
8
++AM_CFLAGS = -Wall
9
+ endif
10
+ 
11
+ AM_CPPFLAGS = -DPREFIX='"${prefix}"'
12
+--- a/src/Makefile.in
13
++++ b/src/Makefile.in
14
+@@ -1833,7 +1833,7 @@ top_build_prefix = @top_build_prefix@
15
+ top_builddir = @top_builddir@
16
+ top_srcdir = @top_srcdir@
17
+ SUBDIRS = libcollectdclient $(am__append_1) $(am__append_2)
18
+-@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall -Werror
19
++@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall
20
+ AM_CPPFLAGS = -DPREFIX='"${prefix}"' \
21
+ 	-DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' \
22
+ 	-DLOCALSTATEDIR='"${localstatedir}"' \
23
+--- a/src/libcollectdclient/Makefile.am
24
++++ b/src/libcollectdclient/Makefile.am
25
+@@ -1,7 +1,7 @@
26
+ AUTOMAKE_OPTIONS = foreign no-dependencies
27
+ 
28
+ if COMPILER_IS_GCC
29
+-AM_CFLAGS = -Wall -Werror
30
++AM_CFLAGS = -Wall
31
+ endif
32
+ 
33
+ pkginclude_HEADERS = client.h lcc_features.h
34
+--- a/src/libcollectdclient/Makefile.in
35
++++ b/src/libcollectdclient/Makefile.in
36
+@@ -327,7 +327,7 @@ top_build_prefix = @top_build_prefix@
37
+ top_builddir = @top_builddir@
38
+ top_srcdir = @top_srcdir@
39
+ AUTOMAKE_OPTIONS = foreign no-dependencies
40
+-@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall -Werror
41
++@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall
42
+ pkginclude_HEADERS = client.h lcc_features.h
43
+ lib_LTLIBRARIES = libcollectdclient.la
44
+ nodist_pkgconfig_DATA = libcollectdclient.pc
45
+--- a/src/owniptc/Makefile.am
46
++++ b/src/owniptc/Makefile.am
47
+@@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = foreign no-dependenci
48
+ EXTRA_DIST = libiptc.c README.collectd
49
+ 
50
+ if COMPILER_IS_GCC
51
+-AM_CFLAGS = -Wall -Werror
52
++AM_CFLAGS = -Wall
53
+ endif
54
+ 
55
+ noinst_LTLIBRARIES = libiptc.la
56
+--- a/src/owniptc/Makefile.in
57
++++ b/src/owniptc/Makefile.in
58
+@@ -296,7 +296,7 @@ top_builddir = @top_builddir@
59
+ top_srcdir = @top_srcdir@
60
+ AUTOMAKE_OPTIONS = foreign no-dependencies
61
+ EXTRA_DIST = libiptc.c README.collectd
62
+-@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall -Werror
63
++@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall
64
+ noinst_LTLIBRARIES = libiptc.la
65
+ libiptc_la_SOURCES = libip4tc.c libip6tc.c \
66
+ 		ipt_kernel_headers.h libip6tc.h libiptc.h linux_list.h \

+ 57
- 0
utils/collectd/patches/100-rrdtool-add-rrasingle-option.patch Ver arquivo

@@ -0,0 +1,57 @@
1
+--- a/src/rrdtool.c
2
++++ b/src/rrdtool.c
3
+@@ -80,6 +80,7 @@ static const char *config_keys[] =
4
+ 	"HeartBeat",
5
+ 	"RRARows",
6
+ 	"RRATimespan",
7
++	"RRASingle",
8
+ 	"XFF",
9
+ 	"WritesPerSecond",
10
+ 	"RandomTimeout"
11
+@@ -101,6 +102,8 @@ static rrdcreate_config_t rrdcreate_conf
12
+ 	/* timespans = */ NULL,
13
+ 	/* timespans_num = */ 0,
14
+ 
15
++	/* rrasingle = */ 0,
16
++
17
+ 	/* consolidation_functions = */ NULL,
18
+ 	/* consolidation_functions_num = */ 0
19
+ };
20
+@@ -1027,6 +1030,14 @@ static int rrd_config (const char *key,
21
+ 
22
+ 		free (value_copy);
23
+ 	}
24
++	else if (strcasecmp ("RRASingle", key) == 0)
25
++	{
26
++		if (IS_TRUE (value))
27
++		{
28
++			rrdcreate_config.rrasingle = 1;
29
++			NOTICE ("rrdtool plugin: RRASingle = true: creating only AVERAGE RRAs");
30
++		}
31
++	}
32
+ 	else if (strcasecmp ("XFF", key) == 0)
33
+ 	{
34
+ 		double tmp = atof (value);
35
+--- a/src/utils_rrdcreate.c
36
++++ b/src/utils_rrdcreate.c
37
+@@ -122,6 +122,9 @@ static int rra_get (char ***ret, const v
38
+     rts_num = rra_timespans_num;
39
+   }
40
+ 
41
++  if (cfg->rrasingle)
42
++    rra_types_num = 1;
43
++
44
+   rra_max = rts_num * rra_types_num;
45
+ 
46
+   if ((rra_def = (char **) malloc ((rra_max + 1) * sizeof (char *))) == NULL)
47
+--- a/src/utils_rrdcreate.h
48
++++ b/src/utils_rrdcreate.h
49
+@@ -36,6 +36,8 @@ struct rrdcreate_config_s
50
+   int *timespans;
51
+   size_t timespans_num;
52
+ 
53
++  int rrasingle;
54
++
55
+   char **consolidation_functions;
56
+   size_t consolidation_functions_num;
57
+ };

+ 46
- 0
utils/collectd/patches/110-net-device-stats.patch Ver arquivo

@@ -0,0 +1,46 @@
1
+---
2
+ src/interface.c |   33 ++++++++++++++++++++++++++++++++-
3
+ 1 file changed, 32 insertions(+), 1 deletion(-)
4
+
5
+--- a/src/interface.c
6
++++ b/src/interface.c
7
+@@ -203,7 +203,38 @@ static int interface_read (void)
8
+ #  define IFA_RX_ERROR rx_errors
9
+ #  define IFA_TX_ERROR tx_errors
10
+ #else
11
+-#  error "No suitable type for `struct ifaddrs->ifa_data' found."
12
++struct net_device_stats {
13
++	unsigned long	rx_packets;
14
++	unsigned long	tx_packets;
15
++	unsigned long	rx_bytes;
16
++	unsigned long	tx_bytes;
17
++	unsigned long	rx_errors;
18
++	unsigned long	tx_errors;
19
++	unsigned long	rx_dropped;
20
++	unsigned long	tx_dropped;
21
++	unsigned long	multicast;
22
++	unsigned long	collisions;
23
++	unsigned long	rx_length_errors;
24
++	unsigned long	rx_over_errors;
25
++	unsigned long	rx_crc_errors;
26
++	unsigned long	rx_frame_errors;
27
++	unsigned long	rx_fifo_errors;
28
++	unsigned long	rx_missed_errors;
29
++	unsigned long	tx_aborted_errors;
30
++	unsigned long	tx_carrier_errors;
31
++	unsigned long	tx_fifo_errors;
32
++	unsigned long	tx_heartbeat_errors;
33
++	unsigned long	tx_window_errors;
34
++	unsigned long	rx_compressed;
35
++	unsigned long	tx_compressed;
36
++};
37
++#  define IFA_DATA net_device_stats
38
++#  define IFA_RX_BYTES rx_bytes
39
++#  define IFA_TX_BYTES tx_bytes
40
++#  define IFA_RX_PACKT rx_packets
41
++#  define IFA_TX_PACKT tx_packets
42
++#  define IFA_RX_ERROR rx_errors
43
++#  define IFA_TX_ERROR tx_errors
44
+ #endif
45
+ 
46
+ 	struct IFA_DATA *if_data;

+ 78
- 0
utils/collectd/patches/120-fix_kernel_2.6.37.patch Ver arquivo

@@ -0,0 +1,78 @@
1
+--- a/src/owniptc/libiptc.c
2
++++ b/src/owniptc/libiptc.c
3
+@@ -81,11 +81,11 @@ static const char *hooknames[] = {
4
+ };
5
+ 
6
+ /* Convenience structures */
7
+-struct ipt_error_target
8
++ struct ipt_error_target2
9
+ {
10
+ 	STRUCT_ENTRY_TARGET t;
11
+ 	char error[TABLE_MAXNAMELEN];
12
+-};
13
++}; 
14
+ 
15
+ struct chain_head;
16
+ struct rule_head;
17
+@@ -1007,10 +1007,10 @@ static int parse_table(TC_HANDLE_T h)
18
+ /* Convenience structures */
19
+ struct iptcb_chain_start{
20
+ 	STRUCT_ENTRY e;
21
+-	struct ipt_error_target name;
22
++	struct ipt_error_target2 name;
23
+ };
24
+ #define IPTCB_CHAIN_START_SIZE	(sizeof(STRUCT_ENTRY) +			\
25
+-				 ALIGN(sizeof(struct ipt_error_target)))
26
++				 ALIGN(sizeof(struct ipt_error_target2)))
27
+ 
28
+ struct iptcb_chain_foot {
29
+ 	STRUCT_ENTRY e;
30
+@@ -1021,10 +1021,10 @@ struct iptcb_chain_foot {
31
+ 
32
+ struct iptcb_chain_error {
33
+ 	STRUCT_ENTRY entry;
34
+-	struct ipt_error_target target;
35
++	struct ipt_error_target2 target;
36
+ };
37
+ #define IPTCB_CHAIN_ERROR_SIZE	(sizeof(STRUCT_ENTRY) +			\
38
+-				 ALIGN(sizeof(struct ipt_error_target)))
39
++				 ALIGN(sizeof(struct ipt_error_target2)))
40
+ 
41
+ 
42
+ 
43
+@@ -1069,7 +1069,7 @@ static int iptcc_compile_chain(TC_HANDLE
44
+ 		head->e.next_offset = IPTCB_CHAIN_START_SIZE;
45
+ 		strcpy(head->name.t.u.user.name, ERROR_TARGET);
46
+ 		head->name.t.u.target_size = 
47
+-				ALIGN(sizeof(struct ipt_error_target));
48
++				ALIGN(sizeof(struct ipt_error_target2));
49
+ 		strcpy(head->name.error, c->name);
50
+ 	} else {
51
+ 		repl->hook_entry[c->hooknum-1] = c->head_offset;	
52
+@@ -1113,7 +1113,7 @@ static int iptcc_compile_chain_offsets(T
53
+ 	if (!iptcc_is_builtin(c))  {
54
+ 		/* Chain has header */
55
+ 		*offset += sizeof(STRUCT_ENTRY) 
56
+-			     + ALIGN(sizeof(struct ipt_error_target));
57
++			     + ALIGN(sizeof(struct ipt_error_target2));
58
+ 		(*num)++;
59
+ 	}
60
+ 
61
+@@ -1153,7 +1153,7 @@ static int iptcc_compile_table_prep(TC_H
62
+ 	/* Append one error rule at end of chain */
63
+ 	num++;
64
+ 	offset += sizeof(STRUCT_ENTRY)
65
+-		  + ALIGN(sizeof(struct ipt_error_target));
66
++		  + ALIGN(sizeof(struct ipt_error_target2));
67
+ 
68
+ 	/* ruleset size is now in offset */
69
+ 	*size = offset;
70
+@@ -1177,7 +1177,7 @@ static int iptcc_compile_table(TC_HANDLE
71
+ 	error->entry.target_offset = sizeof(STRUCT_ENTRY);
72
+ 	error->entry.next_offset = IPTCB_CHAIN_ERROR_SIZE;
73
+ 	error->target.t.u.user.target_size = 
74
+-		ALIGN(sizeof(struct ipt_error_target));
75
++		ALIGN(sizeof(struct ipt_error_target2));
76
+ 	strcpy((char *)&error->target.t.u.user.name, ERROR_TARGET);
77
+ 	strcpy((char *)&error->target.error, "ERROR");
78
+ 

+ 14
- 0
utils/collectd/patches/130-timeleft-max.patch Ver arquivo

@@ -0,0 +1,14 @@
1
+Derived from uptream commit d5b09f2b: http://octo.cx/d5b09f2
2
+
3
+--- a/src/types.db
4
++++ b/src/types.db
5
+@@ -152,7 +152,7 @@ tcp_connections		value:GAUGE:0:429496729
6
+ temperature		value:GAUGE:-273.15:U
7
+ threads			value:GAUGE:0:U
8
+ time_dispersion		seconds:GAUGE:-1000000:1000000
9
+-timeleft		timeleft:GAUGE:0:3600
10
++timeleft		timeleft:GAUGE:0:U
11
+ time_offset		seconds:GAUGE:-1000000:1000000
12
+ total_bytes		value:DERIVE:0:U
13
+ total_requests		value:DERIVE:0:U
14
+

+ 11
- 0
utils/collectd/patches/200-fix-git-describe-error.patch Ver arquivo

@@ -0,0 +1,11 @@
1
+--- a/version-gen.sh
2
++++ b/version-gen.sh
3
+@@ -2,7 +2,7 @@
4
+ 
5
+ DEFAULT_VERSION="4.10.8.git"
6
+ 
7
+-VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`"
8
++#VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`"
9
+ 
10
+ if test -z "$VERSION"; then
11
+ 	VERSION="$DEFAULT_VERSION"

+ 11
- 0
utils/collectd/patches/400-fix-olsrd-get-all.patch Ver arquivo

@@ -0,0 +1,11 @@
1
+--- a/src/olsrd.c
2
++++ b/src/olsrd.c
3
+@@ -653,7 +653,7 @@ static int olsrd_read (void) /* {{{ */
4
+   if (fh == NULL)
5
+     return (-1);
6
+ 
7
+-  fputs ("\r\n", fh);
8
++  fputs ("/all \r\n", fh);
9
+   fflush (fh);
10
+ 
11
+   while (fgets (buffer, sizeof (buffer), fh) != NULL)

+ 275
- 0
utils/collectd/patches/900-add-iwinfo-plugin.patch Ver arquivo

@@ -0,0 +1,275 @@
1
+--- a/configure.in
2
++++ b/configure.in
3
+@@ -490,6 +490,9 @@ AC_CHECK_HEADERS(netinet/if_ether.h, [],
4
+ have_termios_h="no"
5
+ AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
6
+ 
7
++# For the iwinfo plugin
8
++AC_CHECK_LIB(iwinfo, iwinfo_backend, [with_iwinfo="yes"], [with_iwinfo="no (libiwinfo not found)"], [])
9
++
10
+ #
11
+ # Checks for typedefs, structures, and compiler characteristics.
12
+ #
13
+@@ -4081,6 +4084,7 @@ plugin_interface="no"
14
+ plugin_ipmi="no"
15
+ plugin_ipvs="no"
16
+ plugin_irq="no"
17
++plugin_iwinfo="no"
18
+ plugin_libvirt="no"
19
+ plugin_load="no"
20
+ plugin_memory="no"
21
+@@ -4388,6 +4392,7 @@ AC_PLUGIN([ipmi],        [$plugin_ipmi],
22
+ AC_PLUGIN([iptables],    [$with_libiptc],      [IPTables rule counters])
23
+ AC_PLUGIN([ipvs],        [$plugin_ipvs],       [IPVS connection statistics])
24
+ AC_PLUGIN([irq],         [$plugin_irq],        [IRQ statistics])
25
++AC_PLUGIN([iwinfo],      [$with_iwinfo],       [Common iwinfo wireless statistics])
26
+ AC_PLUGIN([java],        [$with_java],         [Embed the Java Virtual Machine])
27
+ AC_PLUGIN([libvirt],     [$plugin_libvirt],    [Virtual machine statistics])
28
+ AC_PLUGIN([load],        [$plugin_load],       [System load])
29
+@@ -4666,6 +4671,7 @@ Configuration:
30
+     protobuf-c  . . . . . $have_protoc_c
31
+     oracle  . . . . . . . $with_oracle
32
+     python  . . . . . . . $with_python
33
++    iwinfo  . . . . . . . $with_iwinfo
34
+ 
35
+   Features:
36
+     daemon mode . . . . . $enable_daemon
37
+@@ -4705,6 +4711,7 @@ Configuration:
38
+     iptables  . . . . . . $enable_iptables
39
+     ipvs  . . . . . . . . $enable_ipvs
40
+     irq . . . . . . . . . $enable_irq
41
++    iwinfo  . . . . . . . $enable_iwinfo
42
+     java  . . . . . . . . $enable_java
43
+     libvirt . . . . . . . $enable_libvirt
44
+     load  . . . . . . . . $enable_load
45
+--- a/src/collectd.conf.in
46
++++ b/src/collectd.conf.in
47
+@@ -82,6 +82,7 @@ FQDNLookup   true
48
+ #@BUILD_PLUGIN_IPMI_TRUE@LoadPlugin ipmi
49
+ #@BUILD_PLUGIN_IPVS_TRUE@LoadPlugin ipvs
50
+ #@BUILD_PLUGIN_IRQ_TRUE@LoadPlugin irq
51
++#@BUILD_PLUGIN_IWINFO_TRUE@LoadPlugin iwinfo
52
+ #@BUILD_PLUGIN_JAVA_TRUE@LoadPlugin java
53
+ #@BUILD_PLUGIN_LIBVIRT_TRUE@LoadPlugin libvirt
54
+ @BUILD_PLUGIN_LOAD_TRUE@@BUILD_PLUGIN_LOAD_TRUE@LoadPlugin load
55
+@@ -376,6 +377,12 @@ FQDNLookup   true
56
+ #	IgnoreSelected true
57
+ #</Plugin>
58
+ 
59
++#<Plugin iwinfo>
60
++#   Interface "ath0"
61
++#   Interface "ra0"
62
++#   Interface "wlan0"
63
++#</Plugin>
64
++
65
+ #<Plugin "java">
66
+ #	JVMArg "-verbose:jni"
67
+ #	JVMArg "-Djava.class.path=@prefix@/share/collectd/java/collectd-api.jar"
68
+--- a/src/collectd.conf.pod
69
++++ b/src/collectd.conf.pod
70
+@@ -1478,6 +1478,27 @@ and all other interrupts are collected.
71
+ 
72
+ =back
73
+ 
74
++=head2 Plugin C<iwinfo>
75
++
76
++=over 4
77
++
78
++=item B<Interface> I<Interface>
79
++
80
++Select this interface. By default all detected wireless interfaces will be
81
++collected. For a more detailed description see B<IgnoreSelected> below.
82
++
83
++=item B<IgnoreSelected> I<true>|I<false>
84
++
85
++If no configuration if given, the B<iwinfo>-plugin will collect data from all
86
++detected wireless interfaces. You can use the B<Interface>-option to pick the
87
++interfaces you're interested in. Sometimes, however, it's easier/preferred to
88
++collect all interfaces I<except> a few ones. This option enables you to do
89
++that: By setting B<IgnoreSelected> to I<true> the effect of B<Interface> is
90
++inverted: All selected interfaces are ignored and all other interfaces are
91
++collected.
92
++
93
++=back
94
++
95
+ =head2 Plugin C<java>
96
+ 
97
+ The I<Java> plugin makes it possible to write extensions for collectd in Java.
98
+--- /dev/null
99
++++ b/src/iwinfo.c
100
+@@ -0,0 +1,150 @@
101
++/**
102
++ * collectd - src/iwinfo.c
103
++ * Copyright (C) 2011  Jo-Philipp Wich
104
++ *
105
++ * This program is free software; you can redistribute it and/or modify it
106
++ * under the terms of the GNU General Public License as published by the
107
++ * Free Software Foundation; only version 2 of the License is applicable.
108
++ *
109
++ * This program is distributed in the hope that it will be useful, but
110
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
111
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
112
++ * General Public License for more details.
113
++ *
114
++ * You should have received a copy of the GNU General Public License along
115
++ * with this program; if not, write to the Free Software Foundation, Inc.,
116
++ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
117
++ **/
118
++
119
++#include "collectd.h"
120
++#include "common.h"
121
++#include "plugin.h"
122
++#include "utils_ignorelist.h"
123
++
124
++#include <stdint.h>
125
++#include <iwinfo.h>
126
++
127
++#define PROCNETDEV "/proc/net/dev"
128
++
129
++static const char *config_keys[] = {
130
++	"Interface",
131
++	"IgnoreSelected"
132
++};
133
++static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
134
++
135
++static ignorelist_t *ignorelist = NULL;
136
++
137
++static int iwinfo_config(const char *key, const char *value)
138
++{
139
++	if (ignorelist == NULL)
140
++		ignorelist = ignorelist_create(1);
141
++
142
++	if (ignorelist == NULL)
143
++		return 1;
144
++
145
++	if (strcasecmp(key, "Interface") == 0)
146
++		ignorelist_add(ignorelist, value);
147
++	else if (strcasecmp(key, "IgnoreSelected") == 0)
148
++		ignorelist_set_invert(ignorelist, IS_TRUE(value) ? 0 : 1);
149
++	else
150
++		return -1;
151
++
152
++	return 0;
153
++}
154
++
155
++static void iwinfo_submit(const char *ifname, const char *type, int value)
156
++{
157
++	value_t values[1];
158
++	value_list_t vl = VALUE_LIST_INIT;
159
++
160
++	values[0].gauge = value;
161
++
162
++	vl.values = values;
163
++	vl.values_len = 1;
164
++
165
++	sstrncpy(vl.host, hostname_g, sizeof(vl.host));
166
++	sstrncpy(vl.plugin, "iwinfo", sizeof(vl.plugin));
167
++	sstrncpy(vl.plugin_instance, ifname, sizeof(vl.plugin_instance));
168
++	sstrncpy(vl.type, type, sizeof(vl.type));
169
++	/*sstrncpy(vl.type_instance, "", sizeof(vl.type_instance));*/
170
++
171
++	plugin_dispatch_values(&vl);
172
++}
173
++
174
++static void iwinfo_process(const char *ifname)
175
++{
176
++	int val;
177
++	char buf[IWINFO_BUFSIZE];
178
++	const struct iwinfo_ops *iw = iwinfo_backend(ifname);
179
++
180
++	/* does appear to be a wifi iface */
181
++	if (iw)
182
++	{
183
++		if (iw->bitrate(ifname, &val))
184
++			val = 0;
185
++		iwinfo_submit(ifname, "bitrate", val * 1000);
186
++
187
++		if (iw->signal(ifname, &val))
188
++			val = 0;
189
++		iwinfo_submit(ifname, "signal_power", val);
190
++
191
++		if (iw->noise(ifname, &val))
192
++			val = 0;
193
++		iwinfo_submit(ifname, "signal_noise", val);
194
++
195
++		if (iw->quality(ifname, &val))
196
++			val = 0;
197
++		iwinfo_submit(ifname, "signal_quality", val);
198
++
199
++		if (iw->assoclist(ifname, buf, &val))
200
++			val = 0;
201
++		iwinfo_submit(ifname, "stations",
202
++		              val / sizeof(struct iwinfo_assoclist_entry));
203
++	}
204
++
205
++	iwinfo_finish();
206
++}
207
++
208
++static int iwinfo_read(void)
209
++{
210
++	char line[1024];
211
++	char ifname[128];
212
++	FILE *f;
213
++
214
++	f = fopen(PROCNETDEV, "r");
215
++	if (f == NULL)
216
++	{
217
++		char err[1024];
218
++		WARNING("iwinfo: Unable to open " PROCNETDEV ": %s",
219
++		        sstrerror(errno, err, sizeof(err)));
220
++		return -1;
221
++	}
222
++
223
++	while (fgets(line, sizeof(line), f))
224
++	{
225
++		if (!strchr(line, ':'))
226
++			continue;
227
++
228
++		if (!sscanf(line, " %127[^:]", ifname))
229
++			continue;
230
++
231
++		if (ignorelist_match(ignorelist, ifname))
232
++			continue;
233
++
234
++		if (strstr(ifname, "mon.") || strstr(ifname, ".sta") ||
235
++		    strstr(ifname, "tmp.") || strstr(ifname, "wifi"))
236
++			continue;
237
++
238
++		iwinfo_process(ifname);
239
++	}
240
++
241
++	fclose(f);
242
++
243
++	return 0;
244
++}
245
++
246
++void module_register(void)
247
++{
248
++	plugin_register_config("iwinfo", iwinfo_config, config_keys, config_keys_num);
249
++	plugin_register_read("iwinfo", iwinfo_read);
250
++}
251
+--- a/src/Makefile.am
252
++++ b/src/Makefile.am
253
+@@ -453,6 +453,15 @@ collectd_LDADD += "-dlopen" irq.la
254
+ collectd_DEPENDENCIES += irq.la
255
+ endif
256
+ 
257
++if BUILD_PLUGIN_IWINFO
258
++pkglib_LTLIBRARIES += iwinfo.la
259
++iwinfo_la_SOURCES = iwinfo.c
260
++iwinfo_la_LDFLAGS = -module -avoid-version
261
++iwinfo_la_LIBADD = -liwinfo
262
++collectd_LDADD += "-dlopen" iwinfo.la
263
++collectd_DEPENDENCIES += iwinfo.la
264
++endif
265
++
266
+ if BUILD_PLUGIN_JAVA
267
+ pkglib_LTLIBRARIES += java.la
268
+ java_la_SOURCES = java.c
269
+--- a/src/types.db
270
++++ b/src/types.db
271
+@@ -171,3 +171,4 @@ voltage			value:GAUGE:U:U
272
+ vs_memory		value:GAUGE:0:9223372036854775807
273
+ vs_processes		value:GAUGE:0:65535
274
+ vs_threads		value:GAUGE:0:65535
275
++stations		value:GAUGE:0:256

+ 11
- 0
utils/collectd/patches/920-fix-ping-droprate.patch Ver arquivo

@@ -0,0 +1,11 @@
1
+--- a/src/ping.c
2
++++ b/src/ping.c
3
+@@ -651,7 +651,7 @@ static int ping_read (void) /* {{{ */
4
+           / ((double) (pkg_recv * (pkg_recv - 1))));
5
+ 
6
+     /* Calculate drop rate. */
7
+-    droprate = ((double) (pkg_sent - pkg_recv)) / ((double) pkg_sent);
8
++    droprate = ((double) (pkg_sent - pkg_recv)) * 100 / ((double) pkg_sent);
9
+ 
10
+     submit (hl->host, "ping", latency_average);
11
+     submit (hl->host, "ping_stddev", latency_stddev);