From: Jo-Philipp Wich Date: Wed, 11 Jun 2014 14:42:42 +0000 (+0200) Subject: collectd: import from packages, add myself as maintainer X-Git-Tag: v14.07~340 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=56fd1eaa78764aa0d1348d36e9f3fd9a9edc7328;p=feed%2Fpackages.git collectd: import from packages, add myself as maintainer Signed-off-by: Jo-Philipp Wich --- diff --git a/utils/collectd/Makefile b/utils/collectd/Makefile new file mode 100644 index 0000000000..200b91f9c2 --- /dev/null +++ b/utils/collectd/Makefile @@ -0,0 +1,312 @@ +# +# Copyright (C) 2006-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=collectd +PKG_VERSION:=4.10.8 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://collectd.org/files/ +PKG_MD5SUM:=7a60495208b9383225493c6dd6abb2f0 + +PKG_FIXUP:=autoreconf +PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4 +PKG_MAINTAINER:=Jo-Philipp Wich + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +COLLECTD_PLUGINS_DISABLED:= \ + apple_sensors \ + battery \ + cpufreq \ + curl_json \ + entropy \ + genericjmx \ + gmond \ + hddtemp \ + ipmi \ + ipvs \ + java \ + libvirt \ + mbmon \ + memcachec \ + memcached \ + monitorus \ + multimeter \ + netapp \ + nfs \ + notify_desktop \ + notify_email \ + openvz \ + oracle \ + perl \ + pinba \ + python \ + routeros \ + rrdcached \ + serial \ + swap \ + tape \ + tokyotyrant \ + uuid \ + vserver \ + xmms \ + zfs_arc \ + +COLLECTD_PLUGINS_SELECTED:= \ + apache \ + apcups \ + ascent \ + bind \ + conntrack \ + contextswitch \ + cpu \ + csv \ + curl \ + dbi \ + df \ + disk \ + dns \ + email \ + exec \ + filecount \ + fscache \ + interface \ + iptables \ + irq \ + iwinfo \ + load \ + logfile \ + madwifi \ + memory \ + modbus \ + mysql \ + netlink \ + network \ + nginx \ + ntpd \ + nut \ + olsrd \ + onewire \ + openvpn \ + ping \ + postgresql \ + powerdns \ + processes \ + protocols \ + rrdtool \ + sensors \ + snmp \ + syslog \ + tail \ + table \ + ted \ + tcpconns \ + teamspeak2 \ + thermal \ + unixsock \ + uptime \ + users \ + vmem \ + wireless \ + write_http \ + +PKG_CONFIG_DEPENDS:= \ + $(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \ + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk + +define Package/collectd/Default + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Lightweight system statistics collection daemon + URL:=http://verplant.org/collectd/ +endef + +define Package/collectd +$(call Package/collectd/Default) + DEPENDS:= +libpthread +zlib +libltdl +libip4tc + MENU:=1 +endef + +define Package/collectd/description + collectd is a small daemon which collects system information periodically + and provides mechanismns to store the values in a variety of ways. +endef + +ifneq ($(CONFIG_avr32),) + TARGET_CFLAGS += -fsigned-char +endif + +# common configure args +CONFIGURE_ARGS+= \ + --disable-debug \ + --enable-daemon \ + --enable-getifaddrs \ + --with-nan-emulation \ + --without-libgcrypt + +CONFIGURE_VARS+= \ + CFLAGS="$$$$CFLAGS $(FPIC)" \ + LDFLAGS="$$$$LDFLAGS -lm -lz" \ + KERNEL_DIR="$(LINUX_DIR)" \ + +CONFIGURE_PLUGIN= \ + $(foreach m, $(1), \ + $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \ + ) + +CONFIGURE_ARGS+= \ + $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \ + $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \ + +# exception: mod-ascent needs libxml2 +ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),) + CONFIGURE_VARS+= \ + CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2" +endif + +ifneq ($(CONFIG_BIG_ENDIAN),) + CONFIGURE_ARGS+= --with-fp-layout=endianflip +else + CONFIGURE_ARGS+= --with-fp-layout=nothing +endif + +ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),) + CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/" +endif + +ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),) + CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/" +endif + +# exception: mod-netlink needs libnetlink from iproute +ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),) + CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr" +endif + +# exception: mod-modbus needs libmodbus +ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),) + CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr" +endif + +# exception: mod-onewire needs libow-capi +ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),) + CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr" +endif + +# exception: mod-rrdtool needs rrdtool-1.0.x +ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),) + CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0" +endif + +define Package/collectd/conffiles +/etc/collectd.conf +endef + +define Package/collectd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/share/collectd + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd +endef + +# 1: plugin name +# 2: plugin title/description +# 3: files +# 4: extra dependency +define BuildPlugin + + PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1) + + define Package/collectd-mod-$(1) + $$(call Package/collectd/Default) + TITLE:=$(2) plugin + DEPENDS:= collectd $(4) + endef + + define Package/collectd-mod-$(1)/install + $(INSTALL_DIR) $$(1)/usr/lib/collectd + for m in $(3); do \ + $(CP) \ + $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \ + $$(1)/usr/lib/collectd/ ; \ + done + endef + + $$(eval $$(call BuildPackage,collectd-mod-$(1))) + +endef + +$(eval $(call BuildPackage,collectd)) + +#$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES)) +$(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl)) +$(eval $(call BuildPlugin,apcups,apcups status input,apcups,)) +$(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2)) +$(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2)) +$(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,)) +$(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,)) +$(eval $(call BuildPlugin,cpu,CPU input,cpu,)) +$(eval $(call BuildPlugin,csv,CSV output,csv,)) +$(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl)) +$(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi)) +$(eval $(call BuildPlugin,df,disk space input,df,)) +$(eval $(call BuildPlugin,disk,disk usage/timing input,disk,)) +$(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap)) +$(eval $(call BuildPlugin,email,email output,email,)) +$(eval $(call BuildPlugin,exec,process exec input,exec,)) +$(eval $(call BuildPlugin,filecount,file count input,filecount,)) +$(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,)) +$(eval $(call BuildPlugin,interface,network interfaces input,interface,)) +$(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables +libiptc)) +$(eval $(call BuildPlugin,irq,interrupt usage input,irq,)) +$(eval $(call BuildPlugin,iwinfo,libiwinfo wireless statistics,iwinfo,+PACKAGE_collectd-mod-iwinfo:libiwinfo)) +$(eval $(call BuildPlugin,load,system load input,load,)) +$(eval $(call BuildPlugin,logfile,log files output,logfile,)) +$(eval $(call BuildPlugin,madwifi,MadWifi status input,madwifi,)) +$(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r)) +$(eval $(call BuildPlugin,memory,physical memory usage input,memory,)) +$(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus @BROKEN)) +$(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:ip @BROKEN)) +$(eval $(call BuildPlugin,network,network input/output,network)) +$(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl)) +$(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,)) +$(eval $(call BuildPlugin,nut,UPS monitoring input,nut,+PACKAGE_collectd-mod-nut:nut)) +$(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,)) +$(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN)) +$(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,)) +$(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping)) +$(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq)) +$(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,)) +$(eval $(call BuildPlugin,processes,process status input,processes,)) +$(eval $(call BuildPlugin,protocols,network protocols input,protocols,)) +$(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1)) +$(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors @BROKEN)) +$(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp)) +$(eval $(call BuildPlugin,syslog,syslog output,syslog,)) +$(eval $(call BuildPlugin,tail,tail input,tail,)) +$(eval $(call BuildPlugin,table,table-like structured file input,table,)) +$(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,)) +$(eval $(call BuildPlugin,ted,The Energy Detective input,ted,@((!TARGET_avr32)||BROKEN))) # fails on avr32 because of warnings treated as errors +$(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,)) +$(eval $(call BuildPlugin,thermal,system temperatures input,thermal,)) +$(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,)) +$(eval $(call BuildPlugin,uptime,uptime status input,uptime,)) +$(eval $(call BuildPlugin,users,user logged in status input,users,)) +$(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,)) +$(eval $(call BuildPlugin,wireless,wireless status input,wireless,)) +$(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl)) diff --git a/utils/collectd/files/collectd.conf b/utils/collectd/files/collectd.conf new file mode 100644 index 0000000000..2ef78fe7ff --- /dev/null +++ b/utils/collectd/files/collectd.conf @@ -0,0 +1,90 @@ +# +# OpenWrt Config file for collectd(1). +# Please read collectd.conf(5) for a list of options. +# http://collectd.org/ +# + +#Hostname "localhost" +#FQDNLookup true +BaseDir "/var/lib/collectd" +PIDFile "/var/run/collectd.pid" +#PluginDir "/usr/lib/collectd" +#TypesDB "/usr/share/collectd/types.db" +Interval 30 +ReadThreads 2 + +#LoadPlugin syslog +#LoadPlugin logfile + +# +# LogLevel info +# + +# +# LogLevel info +# File STDOUT +# Timestamp true +# + +LoadPlugin cpu +LoadPlugin df +LoadPlugin disk +LoadPlugin interface +LoadPlugin load +LoadPlugin memory +LoadPlugin network +#LoadPlugin ping +#LoadPlugin processes +#LoadPlugin rrdtool +#LoadPlugin serial +LoadPlugin wireless + +# +# FSType tmpfs +# IgnoreSelected true +# ReportByDevice false +# ReportReserved false +# ReportInodes false +# + +# +# Disk "/^[hs]d[a-f][0-9]?$/" +# IgnoreSelected false +# + +# +# Interface "eth0" +# Interface "br-lan" +# IgnoreSelected false +# + + +# Server "ff18::efc0:4a42" "25826" + Server "239.192.74.66" "25826" +# Listen "ff18::efc0:4a42" "25826" +# Listen "239.192.74.66" "25826" +# TimeToLive "128" +# Forward false +# CacheFlush 1800 +# ReportStats false + + +# +# Host "host.foo.bar" +# Interval 1.0 +# Timeout 0.9 +# TTL 255 +# SourceAddress "1.2.3.4" +# Device "eth0" +# MaxMissed -1 +# + +# +# Process "name" +# + +# +# DataDir "/var/lib/collectd/rrd" +# CacheTimeout 120 +# CacheFlush 900 +# diff --git a/utils/collectd/files/collectd.init b/utils/collectd/files/collectd.init new file mode 100644 index 0000000000..8204c38acb --- /dev/null +++ b/utils/collectd/files/collectd.init @@ -0,0 +1,15 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=80 + +SERVICE_USE_PID=1 + +start() { + mkdir -m 0755 -p /var/lib/collectd + service_start /usr/sbin/collectd +} + +stop() { + service_stop /usr/sbin/collectd +} diff --git a/utils/collectd/patches/001-undefined-AM_PATH_LIBGCRYPT.patch b/utils/collectd/patches/001-undefined-AM_PATH_LIBGCRYPT.patch new file mode 100644 index 0000000000..0e01744bbd --- /dev/null +++ b/utils/collectd/patches/001-undefined-AM_PATH_LIBGCRYPT.patch @@ -0,0 +1,4 @@ +--- /dev/null ++++ b/fake-am_path_libgcrypt.m4 +@@ -0,0 +1 @@ ++AC_DEFUN([AM_PATH_LIBGCRYPT],[:]) diff --git a/utils/collectd/patches/003-remove-werror.patch b/utils/collectd/patches/003-remove-werror.patch new file mode 100644 index 0000000000..0e572bf312 --- /dev/null +++ b/utils/collectd/patches/003-remove-werror.patch @@ -0,0 +1,66 @@ +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -7,7 +7,7 @@ SUBDIRS += liboconfig + endif + + if COMPILER_IS_GCC +-AM_CFLAGS = -Wall -Werror ++AM_CFLAGS = -Wall + endif + + AM_CPPFLAGS = -DPREFIX='"${prefix}"' +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -1833,7 +1833,7 @@ top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + SUBDIRS = libcollectdclient $(am__append_1) $(am__append_2) +-@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall -Werror ++@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall + AM_CPPFLAGS = -DPREFIX='"${prefix}"' \ + -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"' \ + -DLOCALSTATEDIR='"${localstatedir}"' \ +--- a/src/libcollectdclient/Makefile.am ++++ b/src/libcollectdclient/Makefile.am +@@ -1,7 +1,7 @@ + AUTOMAKE_OPTIONS = foreign no-dependencies + + if COMPILER_IS_GCC +-AM_CFLAGS = -Wall -Werror ++AM_CFLAGS = -Wall + endif + + pkginclude_HEADERS = client.h lcc_features.h +--- a/src/libcollectdclient/Makefile.in ++++ b/src/libcollectdclient/Makefile.in +@@ -327,7 +327,7 @@ top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + AUTOMAKE_OPTIONS = foreign no-dependencies +-@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall -Werror ++@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall + pkginclude_HEADERS = client.h lcc_features.h + lib_LTLIBRARIES = libcollectdclient.la + nodist_pkgconfig_DATA = libcollectdclient.pc +--- a/src/owniptc/Makefile.am ++++ b/src/owniptc/Makefile.am +@@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = foreign no-dependenci + EXTRA_DIST = libiptc.c README.collectd + + if COMPILER_IS_GCC +-AM_CFLAGS = -Wall -Werror ++AM_CFLAGS = -Wall + endif + + noinst_LTLIBRARIES = libiptc.la +--- a/src/owniptc/Makefile.in ++++ b/src/owniptc/Makefile.in +@@ -296,7 +296,7 @@ top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + AUTOMAKE_OPTIONS = foreign no-dependencies + EXTRA_DIST = libiptc.c README.collectd +-@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall -Werror ++@COMPILER_IS_GCC_TRUE@AM_CFLAGS = -Wall + noinst_LTLIBRARIES = libiptc.la + libiptc_la_SOURCES = libip4tc.c libip6tc.c \ + ipt_kernel_headers.h libip6tc.h libiptc.h linux_list.h \ diff --git a/utils/collectd/patches/100-rrdtool-add-rrasingle-option.patch b/utils/collectd/patches/100-rrdtool-add-rrasingle-option.patch new file mode 100644 index 0000000000..ce1daa473f --- /dev/null +++ b/utils/collectd/patches/100-rrdtool-add-rrasingle-option.patch @@ -0,0 +1,57 @@ +--- a/src/rrdtool.c ++++ b/src/rrdtool.c +@@ -80,6 +80,7 @@ static const char *config_keys[] = + "HeartBeat", + "RRARows", + "RRATimespan", ++ "RRASingle", + "XFF", + "WritesPerSecond", + "RandomTimeout" +@@ -101,6 +102,8 @@ static rrdcreate_config_t rrdcreate_conf + /* timespans = */ NULL, + /* timespans_num = */ 0, + ++ /* rrasingle = */ 0, ++ + /* consolidation_functions = */ NULL, + /* consolidation_functions_num = */ 0 + }; +@@ -1027,6 +1030,14 @@ static int rrd_config (const char *key, + + free (value_copy); + } ++ else if (strcasecmp ("RRASingle", key) == 0) ++ { ++ if (IS_TRUE (value)) ++ { ++ rrdcreate_config.rrasingle = 1; ++ NOTICE ("rrdtool plugin: RRASingle = true: creating only AVERAGE RRAs"); ++ } ++ } + else if (strcasecmp ("XFF", key) == 0) + { + double tmp = atof (value); +--- a/src/utils_rrdcreate.c ++++ b/src/utils_rrdcreate.c +@@ -122,6 +122,9 @@ static int rra_get (char ***ret, const v + rts_num = rra_timespans_num; + } + ++ if (cfg->rrasingle) ++ rra_types_num = 1; ++ + rra_max = rts_num * rra_types_num; + + if ((rra_def = (char **) malloc ((rra_max + 1) * sizeof (char *))) == NULL) +--- a/src/utils_rrdcreate.h ++++ b/src/utils_rrdcreate.h +@@ -36,6 +36,8 @@ struct rrdcreate_config_s + int *timespans; + size_t timespans_num; + ++ int rrasingle; ++ + char **consolidation_functions; + size_t consolidation_functions_num; + }; diff --git a/utils/collectd/patches/110-net-device-stats.patch b/utils/collectd/patches/110-net-device-stats.patch new file mode 100644 index 0000000000..91e73aa374 --- /dev/null +++ b/utils/collectd/patches/110-net-device-stats.patch @@ -0,0 +1,46 @@ +--- + src/interface.c | 33 ++++++++++++++++++++++++++++++++- + 1 file changed, 32 insertions(+), 1 deletion(-) + +--- a/src/interface.c ++++ b/src/interface.c +@@ -203,7 +203,38 @@ static int interface_read (void) + # define IFA_RX_ERROR rx_errors + # define IFA_TX_ERROR tx_errors + #else +-# error "No suitable type for `struct ifaddrs->ifa_data' found." ++struct net_device_stats { ++ unsigned long rx_packets; ++ unsigned long tx_packets; ++ unsigned long rx_bytes; ++ unsigned long tx_bytes; ++ unsigned long rx_errors; ++ unsigned long tx_errors; ++ unsigned long rx_dropped; ++ unsigned long tx_dropped; ++ unsigned long multicast; ++ unsigned long collisions; ++ unsigned long rx_length_errors; ++ unsigned long rx_over_errors; ++ unsigned long rx_crc_errors; ++ unsigned long rx_frame_errors; ++ unsigned long rx_fifo_errors; ++ unsigned long rx_missed_errors; ++ unsigned long tx_aborted_errors; ++ unsigned long tx_carrier_errors; ++ unsigned long tx_fifo_errors; ++ unsigned long tx_heartbeat_errors; ++ unsigned long tx_window_errors; ++ unsigned long rx_compressed; ++ unsigned long tx_compressed; ++}; ++# define IFA_DATA net_device_stats ++# define IFA_RX_BYTES rx_bytes ++# define IFA_TX_BYTES tx_bytes ++# define IFA_RX_PACKT rx_packets ++# define IFA_TX_PACKT tx_packets ++# define IFA_RX_ERROR rx_errors ++# define IFA_TX_ERROR tx_errors + #endif + + struct IFA_DATA *if_data; diff --git a/utils/collectd/patches/120-fix_kernel_2.6.37.patch b/utils/collectd/patches/120-fix_kernel_2.6.37.patch new file mode 100644 index 0000000000..cca445af5b --- /dev/null +++ b/utils/collectd/patches/120-fix_kernel_2.6.37.patch @@ -0,0 +1,78 @@ +--- a/src/owniptc/libiptc.c ++++ b/src/owniptc/libiptc.c +@@ -81,11 +81,11 @@ static const char *hooknames[] = { + }; + + /* Convenience structures */ +-struct ipt_error_target ++ struct ipt_error_target2 + { + STRUCT_ENTRY_TARGET t; + char error[TABLE_MAXNAMELEN]; +-}; ++}; + + struct chain_head; + struct rule_head; +@@ -1007,10 +1007,10 @@ static int parse_table(TC_HANDLE_T h) + /* Convenience structures */ + struct iptcb_chain_start{ + STRUCT_ENTRY e; +- struct ipt_error_target name; ++ struct ipt_error_target2 name; + }; + #define IPTCB_CHAIN_START_SIZE (sizeof(STRUCT_ENTRY) + \ +- ALIGN(sizeof(struct ipt_error_target))) ++ ALIGN(sizeof(struct ipt_error_target2))) + + struct iptcb_chain_foot { + STRUCT_ENTRY e; +@@ -1021,10 +1021,10 @@ struct iptcb_chain_foot { + + struct iptcb_chain_error { + STRUCT_ENTRY entry; +- struct ipt_error_target target; ++ struct ipt_error_target2 target; + }; + #define IPTCB_CHAIN_ERROR_SIZE (sizeof(STRUCT_ENTRY) + \ +- ALIGN(sizeof(struct ipt_error_target))) ++ ALIGN(sizeof(struct ipt_error_target2))) + + + +@@ -1069,7 +1069,7 @@ static int iptcc_compile_chain(TC_HANDLE + head->e.next_offset = IPTCB_CHAIN_START_SIZE; + strcpy(head->name.t.u.user.name, ERROR_TARGET); + head->name.t.u.target_size = +- ALIGN(sizeof(struct ipt_error_target)); ++ ALIGN(sizeof(struct ipt_error_target2)); + strcpy(head->name.error, c->name); + } else { + repl->hook_entry[c->hooknum-1] = c->head_offset; +@@ -1113,7 +1113,7 @@ static int iptcc_compile_chain_offsets(T + if (!iptcc_is_builtin(c)) { + /* Chain has header */ + *offset += sizeof(STRUCT_ENTRY) +- + ALIGN(sizeof(struct ipt_error_target)); ++ + ALIGN(sizeof(struct ipt_error_target2)); + (*num)++; + } + +@@ -1153,7 +1153,7 @@ static int iptcc_compile_table_prep(TC_H + /* Append one error rule at end of chain */ + num++; + offset += sizeof(STRUCT_ENTRY) +- + ALIGN(sizeof(struct ipt_error_target)); ++ + ALIGN(sizeof(struct ipt_error_target2)); + + /* ruleset size is now in offset */ + *size = offset; +@@ -1177,7 +1177,7 @@ static int iptcc_compile_table(TC_HANDLE + error->entry.target_offset = sizeof(STRUCT_ENTRY); + error->entry.next_offset = IPTCB_CHAIN_ERROR_SIZE; + error->target.t.u.user.target_size = +- ALIGN(sizeof(struct ipt_error_target)); ++ ALIGN(sizeof(struct ipt_error_target2)); + strcpy((char *)&error->target.t.u.user.name, ERROR_TARGET); + strcpy((char *)&error->target.error, "ERROR"); + diff --git a/utils/collectd/patches/130-timeleft-max.patch b/utils/collectd/patches/130-timeleft-max.patch new file mode 100644 index 0000000000..f263152950 --- /dev/null +++ b/utils/collectd/patches/130-timeleft-max.patch @@ -0,0 +1,14 @@ +Derived from uptream commit d5b09f2b: http://octo.cx/d5b09f2 + +--- a/src/types.db ++++ b/src/types.db +@@ -152,7 +152,7 @@ tcp_connections value:GAUGE:0:429496729 + temperature value:GAUGE:-273.15:U + threads value:GAUGE:0:U + time_dispersion seconds:GAUGE:-1000000:1000000 +-timeleft timeleft:GAUGE:0:3600 ++timeleft timeleft:GAUGE:0:U + time_offset seconds:GAUGE:-1000000:1000000 + total_bytes value:DERIVE:0:U + total_requests value:DERIVE:0:U + diff --git a/utils/collectd/patches/200-fix-git-describe-error.patch b/utils/collectd/patches/200-fix-git-describe-error.patch new file mode 100644 index 0000000000..1946650a73 --- /dev/null +++ b/utils/collectd/patches/200-fix-git-describe-error.patch @@ -0,0 +1,11 @@ +--- a/version-gen.sh ++++ b/version-gen.sh +@@ -2,7 +2,7 @@ + + DEFAULT_VERSION="4.10.8.git" + +-VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`" ++#VERSION="`git describe 2> /dev/null | sed -e 's/^collectd-//'`" + + if test -z "$VERSION"; then + VERSION="$DEFAULT_VERSION" diff --git a/utils/collectd/patches/400-fix-olsrd-get-all.patch b/utils/collectd/patches/400-fix-olsrd-get-all.patch new file mode 100644 index 0000000000..b49a0e7398 --- /dev/null +++ b/utils/collectd/patches/400-fix-olsrd-get-all.patch @@ -0,0 +1,11 @@ +--- a/src/olsrd.c ++++ b/src/olsrd.c +@@ -653,7 +653,7 @@ static int olsrd_read (void) /* {{{ */ + if (fh == NULL) + return (-1); + +- fputs ("\r\n", fh); ++ fputs ("/all \r\n", fh); + fflush (fh); + + while (fgets (buffer, sizeof (buffer), fh) != NULL) diff --git a/utils/collectd/patches/900-add-iwinfo-plugin.patch b/utils/collectd/patches/900-add-iwinfo-plugin.patch new file mode 100644 index 0000000000..a635493325 --- /dev/null +++ b/utils/collectd/patches/900-add-iwinfo-plugin.patch @@ -0,0 +1,275 @@ +--- a/configure.in ++++ b/configure.in +@@ -490,6 +490,9 @@ AC_CHECK_HEADERS(netinet/if_ether.h, [], + have_termios_h="no" + AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"]) + ++# For the iwinfo plugin ++AC_CHECK_LIB(iwinfo, iwinfo_backend, [with_iwinfo="yes"], [with_iwinfo="no (libiwinfo not found)"], []) ++ + # + # Checks for typedefs, structures, and compiler characteristics. + # +@@ -4081,6 +4084,7 @@ plugin_interface="no" + plugin_ipmi="no" + plugin_ipvs="no" + plugin_irq="no" ++plugin_iwinfo="no" + plugin_libvirt="no" + plugin_load="no" + plugin_memory="no" +@@ -4388,6 +4392,7 @@ AC_PLUGIN([ipmi], [$plugin_ipmi], + AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters]) + AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics]) + AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics]) ++AC_PLUGIN([iwinfo], [$with_iwinfo], [Common iwinfo wireless statistics]) + AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine]) + AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics]) + AC_PLUGIN([load], [$plugin_load], [System load]) +@@ -4666,6 +4671,7 @@ Configuration: + protobuf-c . . . . . $have_protoc_c + oracle . . . . . . . $with_oracle + python . . . . . . . $with_python ++ iwinfo . . . . . . . $with_iwinfo + + Features: + daemon mode . . . . . $enable_daemon +@@ -4705,6 +4711,7 @@ Configuration: + iptables . . . . . . $enable_iptables + ipvs . . . . . . . . $enable_ipvs + irq . . . . . . . . . $enable_irq ++ iwinfo . . . . . . . $enable_iwinfo + java . . . . . . . . $enable_java + libvirt . . . . . . . $enable_libvirt + load . . . . . . . . $enable_load +--- a/src/collectd.conf.in ++++ b/src/collectd.conf.in +@@ -82,6 +82,7 @@ FQDNLookup true + #@BUILD_PLUGIN_IPMI_TRUE@LoadPlugin ipmi + #@BUILD_PLUGIN_IPVS_TRUE@LoadPlugin ipvs + #@BUILD_PLUGIN_IRQ_TRUE@LoadPlugin irq ++#@BUILD_PLUGIN_IWINFO_TRUE@LoadPlugin iwinfo + #@BUILD_PLUGIN_JAVA_TRUE@LoadPlugin java + #@BUILD_PLUGIN_LIBVIRT_TRUE@LoadPlugin libvirt + @BUILD_PLUGIN_LOAD_TRUE@@BUILD_PLUGIN_LOAD_TRUE@LoadPlugin load +@@ -376,6 +377,12 @@ FQDNLookup true + # IgnoreSelected true + # + ++# ++# Interface "ath0" ++# Interface "ra0" ++# Interface "wlan0" ++# ++ + # + # JVMArg "-verbose:jni" + # JVMArg "-Djava.class.path=@prefix@/share/collectd/java/collectd-api.jar" +--- a/src/collectd.conf.pod ++++ b/src/collectd.conf.pod +@@ -1478,6 +1478,27 @@ and all other interrupts are collected. + + =back + ++=head2 Plugin C ++ ++=over 4 ++ ++=item B I ++ ++Select this interface. By default all detected wireless interfaces will be ++collected. For a more detailed description see B below. ++ ++=item B I|I ++ ++If no configuration if given, the B-plugin will collect data from all ++detected wireless interfaces. You can use the B-option to pick the ++interfaces you're interested in. Sometimes, however, it's easier/preferred to ++collect all interfaces I a few ones. This option enables you to do ++that: By setting B to I the effect of B is ++inverted: All selected interfaces are ignored and all other interfaces are ++collected. ++ ++=back ++ + =head2 Plugin C + + The I plugin makes it possible to write extensions for collectd in Java. +--- /dev/null ++++ b/src/iwinfo.c +@@ -0,0 +1,150 @@ ++/** ++ * collectd - src/iwinfo.c ++ * Copyright (C) 2011 Jo-Philipp Wich ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; only version 2 of the License is applicable. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with this program; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ **/ ++ ++#include "collectd.h" ++#include "common.h" ++#include "plugin.h" ++#include "utils_ignorelist.h" ++ ++#include ++#include ++ ++#define PROCNETDEV "/proc/net/dev" ++ ++static const char *config_keys[] = { ++ "Interface", ++ "IgnoreSelected" ++}; ++static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); ++ ++static ignorelist_t *ignorelist = NULL; ++ ++static int iwinfo_config(const char *key, const char *value) ++{ ++ if (ignorelist == NULL) ++ ignorelist = ignorelist_create(1); ++ ++ if (ignorelist == NULL) ++ return 1; ++ ++ if (strcasecmp(key, "Interface") == 0) ++ ignorelist_add(ignorelist, value); ++ else if (strcasecmp(key, "IgnoreSelected") == 0) ++ ignorelist_set_invert(ignorelist, IS_TRUE(value) ? 0 : 1); ++ else ++ return -1; ++ ++ return 0; ++} ++ ++static void iwinfo_submit(const char *ifname, const char *type, int value) ++{ ++ value_t values[1]; ++ value_list_t vl = VALUE_LIST_INIT; ++ ++ values[0].gauge = value; ++ ++ vl.values = values; ++ vl.values_len = 1; ++ ++ sstrncpy(vl.host, hostname_g, sizeof(vl.host)); ++ sstrncpy(vl.plugin, "iwinfo", sizeof(vl.plugin)); ++ sstrncpy(vl.plugin_instance, ifname, sizeof(vl.plugin_instance)); ++ sstrncpy(vl.type, type, sizeof(vl.type)); ++ /*sstrncpy(vl.type_instance, "", sizeof(vl.type_instance));*/ ++ ++ plugin_dispatch_values(&vl); ++} ++ ++static void iwinfo_process(const char *ifname) ++{ ++ int val; ++ char buf[IWINFO_BUFSIZE]; ++ const struct iwinfo_ops *iw = iwinfo_backend(ifname); ++ ++ /* does appear to be a wifi iface */ ++ if (iw) ++ { ++ if (iw->bitrate(ifname, &val)) ++ val = 0; ++ iwinfo_submit(ifname, "bitrate", val * 1000); ++ ++ if (iw->signal(ifname, &val)) ++ val = 0; ++ iwinfo_submit(ifname, "signal_power", val); ++ ++ if (iw->noise(ifname, &val)) ++ val = 0; ++ iwinfo_submit(ifname, "signal_noise", val); ++ ++ if (iw->quality(ifname, &val)) ++ val = 0; ++ iwinfo_submit(ifname, "signal_quality", val); ++ ++ if (iw->assoclist(ifname, buf, &val)) ++ val = 0; ++ iwinfo_submit(ifname, "stations", ++ val / sizeof(struct iwinfo_assoclist_entry)); ++ } ++ ++ iwinfo_finish(); ++} ++ ++static int iwinfo_read(void) ++{ ++ char line[1024]; ++ char ifname[128]; ++ FILE *f; ++ ++ f = fopen(PROCNETDEV, "r"); ++ if (f == NULL) ++ { ++ char err[1024]; ++ WARNING("iwinfo: Unable to open " PROCNETDEV ": %s", ++ sstrerror(errno, err, sizeof(err))); ++ return -1; ++ } ++ ++ while (fgets(line, sizeof(line), f)) ++ { ++ if (!strchr(line, ':')) ++ continue; ++ ++ if (!sscanf(line, " %127[^:]", ifname)) ++ continue; ++ ++ if (ignorelist_match(ignorelist, ifname)) ++ continue; ++ ++ if (strstr(ifname, "mon.") || strstr(ifname, ".sta") || ++ strstr(ifname, "tmp.") || strstr(ifname, "wifi")) ++ continue; ++ ++ iwinfo_process(ifname); ++ } ++ ++ fclose(f); ++ ++ return 0; ++} ++ ++void module_register(void) ++{ ++ plugin_register_config("iwinfo", iwinfo_config, config_keys, config_keys_num); ++ plugin_register_read("iwinfo", iwinfo_read); ++} +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -453,6 +453,15 @@ collectd_LDADD += "-dlopen" irq.la + collectd_DEPENDENCIES += irq.la + endif + ++if BUILD_PLUGIN_IWINFO ++pkglib_LTLIBRARIES += iwinfo.la ++iwinfo_la_SOURCES = iwinfo.c ++iwinfo_la_LDFLAGS = -module -avoid-version ++iwinfo_la_LIBADD = -liwinfo ++collectd_LDADD += "-dlopen" iwinfo.la ++collectd_DEPENDENCIES += iwinfo.la ++endif ++ + if BUILD_PLUGIN_JAVA + pkglib_LTLIBRARIES += java.la + java_la_SOURCES = java.c +--- a/src/types.db ++++ b/src/types.db +@@ -171,3 +171,4 @@ voltage value:GAUGE:U:U + vs_memory value:GAUGE:0:9223372036854775807 + vs_processes value:GAUGE:0:65535 + vs_threads value:GAUGE:0:65535 ++stations value:GAUGE:0:256 diff --git a/utils/collectd/patches/920-fix-ping-droprate.patch b/utils/collectd/patches/920-fix-ping-droprate.patch new file mode 100644 index 0000000000..f74329905a --- /dev/null +++ b/utils/collectd/patches/920-fix-ping-droprate.patch @@ -0,0 +1,11 @@ +--- a/src/ping.c ++++ b/src/ping.c +@@ -651,7 +651,7 @@ static int ping_read (void) /* {{{ */ + / ((double) (pkg_recv * (pkg_recv - 1)))); + + /* Calculate drop rate. */ +- droprate = ((double) (pkg_sent - pkg_recv)) / ((double) pkg_sent); ++ droprate = ((double) (pkg_sent - pkg_recv)) * 100 / ((double) pkg_sent); + + submit (hl->host, "ping", latency_average); + submit (hl->host, "ping_stddev", latency_stddev);