node: bump to new version

This commit is contained in:
LEAN-ESX 2019-12-09 05:53:58 -08:00
parent 579667e8d1
commit 25a870e788
56 changed files with 1143 additions and 347 deletions

View File

@ -8,11 +8,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=node
PKG_VERSION:=v8.10.0
PKG_RELEASE:=3
PKG_VERSION:=v8.16.1
PKG_RELEASE:=1
PKG_SOURCE:=node-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION}
PKG_HASH:=b72d4e71618d6bcbd039b487b51fa7543631a4ac3331d7caf69bdf55b5b2901a
PKG_SOURCE_URL:=https://nodejs.org/dist/${PKG_VERSION}
PKG_HASH:=d8c190acdf2d967faf49c22df883d31a8d4e249d67852dae3c2d8a0f756b0512
HOST_BUILD_DEPENDS:=python/host
PKG_BUILD_DEPENDS:=python/host
@ -26,6 +26,7 @@ PKG_BUILD_PARALLEL:=1
PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>, Adrian Panella <ianchi74@outlook.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_CPE_ID:=cpe:/a:nodejs:node.js
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
@ -35,8 +36,10 @@ define Package/node
CATEGORY:=Languages
SUBMENU:=Node.js
TITLE:=Node.js is a platform built on Chrome's JavaScript runtime
URL:=http://nodejs.org/
DEPENDS:=@(HAS_FPU||KERNEL_MIPS_FPU_EMULATOR) +libstdcpp +libopenssl +zlib +USE_UCLIBC:libpthread +USE_UCLIBC:librt +NODEJS_ICU:icu
URL:=https://nodejs.org/
DEPENDS:=@(HAS_FPU||KERNEL_MIPS_FPU_EMULATOR) @!arc @!armeb \
+libstdcpp +libopenssl +zlib +libnghttp2 +libuv +libhttp-parser \
+NODEJS_ICU:icu
endef
define Package/node/description
@ -50,7 +53,7 @@ define Package/node-npm
CATEGORY:=Languages
SUBMENU:=Node.js
TITLE:=NPM stands for Node Package Manager
URL:=http://npmjs.com/
URL:=https://npmjs.com/
DEPENDS:=+node
endef
@ -59,13 +62,13 @@ define Package/node-npm/description
endef
define Package/node/config
menu "Module Selection"
if PACKAGE_node
config NODEJS_ICU
bool "enable i18n features"
default n
endmenu
endif
endef
NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
@ -85,6 +88,9 @@ CONFIGURE_ARGS:= \
--without-snapshot \
--shared-zlib \
--shared-openssl \
--shared-nghttp2 \
--shared-libuv \
--shared-http-parser \
--with-intl=$(if $(CONFIG_NODEJS_ICU),system-icu,none) \
$(if $(findstring mips,$(NODEJS_CPU)), \
$(if $(CONFIG_SOFT_FLOAT),--with-mips-float-abi=soft)) \
@ -97,7 +103,7 @@ CONFIGURE_ARGS:= \
HOST_CONFIGURE_VARS:=
HOST_CONFIGURE_ARGS:= \
--dest-os=linux \
--dest-os=$(if $(findstring Darwin,$(HOST_OS)),mac,linux) \
--without-snapshot \
--prefix=$(STAGING_DIR_HOSTPKG)

View File

@ -1,6 +1,6 @@
--- a/lib/module.js
+++ b/lib/module.js
@@ -714,7 +714,8 @@
@@ -715,7 +715,8 @@
} else {
prefixDir = path.resolve(process.execPath, '..', '..');
}

View File

@ -1,25 +0,0 @@
From 34825d50db18631a92902af3f51ddd27aa074c90 Mon Sep 17 00:00:00 2001
From: Jeroen Roovers <jer-gentoo@users.noreply.github.com>
Date: Fri, 13 Apr 2018 05:54:42 +0200
Subject: [PATCH 2/2] Include cmath ...
... instead of using the C implementations of isnan and isinf
---
src/node_crypto.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index 7c0f65a5735..0aa4adbd467 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -44,9 +44,9 @@
#include "StartComAndWoSignData.inc"
#include <algorithm>
+#include <cmath>
#include <errno.h>
#include <limits.h> // INT_MAX
-#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <vector>

View File

@ -0,0 +1,96 @@
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index c3779c0..611fb43 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -43,6 +43,11 @@
#include <string.h>
#include <vector>
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#define X509_get0_notBefore X509_get_notBefore
+#define X509_get0_notAfter X509_get_notAfter
+#endif
+
#define THROW_AND_RETURN_IF_NOT_STRING_OR_BUFFER(val, prefix) \
do { \
if (!Buffer::HasInstance(val) && !val->IsString()) { \
@@ -536,6 +541,7 @@ void SecureContext::Init(const FunctionCallbackInfo<Value>& args) {
method = SSLv23_server_method();
} else if (strcmp(*sslmethod, "SSLv23_client_method") == 0) {
method = SSLv23_client_method();
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
} else if (strcmp(*sslmethod, "TLSv1_method") == 0) {
method = TLSv1_method();
} else if (strcmp(*sslmethod, "TLSv1_server_method") == 0) {
@@ -554,6 +560,14 @@ void SecureContext::Init(const FunctionCallbackInfo<Value>& args) {
method = TLSv1_2_server_method();
} else if (strcmp(*sslmethod, "TLSv1_2_client_method") == 0) {
method = TLSv1_2_client_method();
+#else
+ } else if (strcmp(*sslmethod, "TLS_method") == 0) {
+ method = TLS_method();
+ } else if (strcmp(*sslmethod, "TLS_server_method") == 0) {
+ method = TLS_server_method();
+ } else if (strcmp(*sslmethod, "TLS_client_method") == 0) {
+ method = TLS_client_method();
+#endif
} else {
return env->ThrowError("Unknown method");
}
@@ -1799,7 +1813,7 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
rsa = nullptr;
}
- ASN1_TIME_print(bio, X509_get_notBefore(cert));
+ ASN1_TIME_print(bio, X509_get0_notBefore(cert));
BIO_get_mem_ptr(bio, &mem);
info->Set(context, env->valid_from_string(),
String::NewFromUtf8(env->isolate(), mem->data,
@@ -1807,7 +1821,7 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
mem->length)).FromJust();
(void) BIO_reset(bio);
- ASN1_TIME_print(bio, X509_get_notAfter(cert));
+ ASN1_TIME_print(bio, X509_get0_notAfter(cert));
BIO_get_mem_ptr(bio, &mem);
info->Set(context, env->valid_to_string(),
String::NewFromUtf8(env->isolate(), mem->data,
@@ -6191,8 +6205,12 @@ void TimingSafeEqual(const FunctionCallbackInfo<Value>& args) {
}
void InitCryptoOnce() {
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_load_error_strings();
OPENSSL_no_config();
+#else
+ OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL);
+#endif
// --openssl-config=...
if (!openssl_config.empty()) {
@@ -6214,10 +6232,10 @@ void InitCryptoOnce() {
}
}
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_library_init();
OpenSSL_add_all_algorithms();
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
crypto_lock_init();
CRYPTO_set_locking_callback(crypto_lock_cb);
CRYPTO_THREADID_set_callback(crypto_threadid_cb);
diff --git a/src/node_crypto.h b/src/node_crypto.h
index 58f5b72..875a787 100644
--- a/src/node_crypto.h
+++ b/src/node_crypto.h
@@ -37,6 +37,9 @@
#include "v8.h"
#include <openssl/ssl.h>
+#include <openssl/bn.h>
+#include <openssl/rsa.h>
+#include <openssl/dh.h>
#include <openssl/ec.h>
#include <openssl/ecdh.h>
#ifndef OPENSSL_NO_ENGINE

View File

@ -0,0 +1,16 @@
--- a/deps/v8/src/libsampler/sampler.cc
+++ b/deps/v8/src/libsampler/sampler.cc
@@ -456,8 +456,12 @@
reinterpret_cast<void*>(ucontext->uc_mcontext.regs->gpr[PT_R1]);
state->fp =
reinterpret_cast<void*>(ucontext->uc_mcontext.regs->gpr[PT_R31]);
-#else
+#elif V8_TARGET_ARCH_32_BIT
// Some C libraries, notably Musl, define the regs member as a void pointer
+ state->pc = reinterpret_cast<void*>(ucontext->uc_mcontext.gregs[32]);
+ state->sp = reinterpret_cast<void*>(ucontext->uc_mcontext.gregs[1]);
+ state->fp = reinterpret_cast<void*>(ucontext->uc_mcontext.gregs[31]);
+#else
state->pc = reinterpret_cast<void*>(ucontext->uc_mcontext.gp_regs[32]);
state->sp = reinterpret_cast<void*>(ucontext->uc_mcontext.gp_regs[1]);
state->fp = reinterpret_cast<void*>(ucontext->uc_mcontext.gp_regs[31]);

View File

@ -0,0 +1,30 @@
--- a/configure
+++ b/configure
@@ -60,7 +60,7 @@
valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
'android', 'aix')
-valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc',
+valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64', 'mips64el', 'ppc',
'ppc64', 'x32','x64', 'x86', 'x86_64', 's390', 's390x')
valid_arm_float_abi = ('soft', 'softfp', 'hard')
valid_arm_fpu = ('vfp', 'vfpv3', 'vfpv3-d16', 'neon')
@@ -795,6 +795,9 @@
if rtn == 'mipsel' and '_LP64' in k:
rtn = 'mips64el'
+ if rtn == 'mips' and '_LP64' in k:
+ rtn = 'mips64'
+
return rtn
@@ -877,7 +880,7 @@
if target_arch == 'arm':
configure_arm(o)
- elif target_arch in ('mips', 'mipsel', 'mips64el'):
+ elif target_arch in ('mips', 'mipsel', 'mips64', 'mips64el'):
configure_mips(o)
if flavor == 'aix':

View File

@ -0,0 +1,11 @@
--- a/tools/gyp/pylib/gyp/generator/make.py
+++ b/tools/gyp/pylib/gyp/generator/make.py
@@ -174,7 +174,7 @@
LINK_COMMANDS_MAC = """\
quiet_cmd_alink = LIBTOOL-STATIC $@
-cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^)
+cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool /usr/bin/libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^)
quiet_cmd_link = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)

View File

@ -8,19 +8,20 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libhttp-parser
PKG_VERSION:=2.8.0
PKG_RELEASE=1
PKG_MAINTAINER:=Ramanathan Sivagurunathan <ramzthecoder@gmail.com>
PKG_VERSION:=2.9.2
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/nodejs/http-parser/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=5199500e352584852c95c13423edc5f0cb329297c81dd69c3c8f52a75496da08
PKG_BUILD_DIR:=$(BUILD_DIR)/http-parser-$(PKG_VERSION)
PKG_MAINTAINER:=Ramanathan Sivagurunathan <ramzthecoder@gmail.com>, Hirokazu MORIKAWA <morikw2@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE-MIT
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_MIRROR_HASH:=83acea397da4cdb9192c27abbd53a9eb8e5a9e1bcea2873b499f7ccc0d68f518
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=git://github.com/nodejs/http-parser.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
@ -32,34 +33,27 @@ define Package/libhttp-parser
endef
define Package/libhttp-parser/description
A parser for HTTP messages written in C. It parses both requests and responses.
The parser is designed to be used in performance HTTP applications.
It does not make any syscalls nor allocations, it does not buffer data,
it can be interrupted at anytime. Depending on your architecture,
it only requires about 40 bytes of data per message stream
A parser for HTTP messages written in C. It parses both requests and responses.
The parser is designed to be used in performance HTTP applications.
It does not make any syscalls nor allocations, it does not buffer data,
it can be interrupted at anytime. Depending on your architecture,
it only requires about 40 bytes of data per message stream
(in a web server that is per connection).
endef
define Build/Compile
$(call Build/Compile/Default, library)
endef
MAKE_FLAGS+=library \
PREFIX=/usr
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DATA) $(PKG_BUILD_DIR)/http_parser.h $(1)/usr/include/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/http_parser.h $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libhttp_parser.so.* $(1)/usr/lib/
( cd $(1)/usr/lib ; \
ln -s libhttp_parser.so.$(PKG_VERSION) libhttp_parser.so ; \
ln -s libhttp_parser.so.$(PKG_VERSION) libhttp_parser.so.2.8 )
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libhttp_parser.so* $(1)/usr/lib/
endef
define Package/libhttp-parser/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libhttp_parser.so.* $(1)/usr/lib/
( cd $(1)/usr/lib ; \
ln -s libhttp_parser.so.$(PKG_VERSION) libhttp_parser.so ; \
ln -s libhttp_parser.so.$(PKG_VERSION) libhttp_parser.so.2.8 )
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libhttp_parser.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libhttp-parser))

View File

@ -0,0 +1,51 @@
--- a/Makefile
+++ b/Makefile
@@ -25,11 +25,7 @@
SOMAJOR = 2
SOMINOR = 9
SOREV = 2
-ifeq (darwin,$(PLATFORM))
-SOEXT ?= dylib
-SONAME ?= $(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOEXT)
-LIBNAME ?= $(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOREV).$(SOEXT)
-else ifeq (wine,$(PLATFORM))
+ifeq (wine,$(PLATFORM))
CC = winegcc
BINEXT = .exe.so
HELPER = wine
@@ -65,12 +61,8 @@
LIBDIR = $(PREFIX)/lib
INCLUDEDIR = $(PREFIX)/include
-ifeq (darwin,$(PLATFORM))
-LDFLAGS_LIB += -Wl,-install_name,$(LIBDIR)/$(SONAME)
-else
# TODO(bnoordhuis) The native SunOS linker expects -h rather than -soname...
LDFLAGS_LIB += -Wl,-soname=$(SONAME)
-endif
test: test_g test_fast
$(HELPER) ./test_g$(BINEXT)
@@ -131,14 +123,18 @@
ctags $^
install: library
- $(INSTALL) -D http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
- $(INSTALL) -D $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
+ $(INSTALL) -d $(DESTDIR)$(INCLUDEDIR)
+ $(INSTALL) -d $(DESTDIR)$(LIBDIR)
+ $(INSTALL) http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
+ $(INSTALL) $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
ln -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
ln -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SOLIBNAME).$(SOEXT)
install-strip: library
- $(INSTALL) -D http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
- $(INSTALL) -D -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
+ $(INSTALL) -d $(DESTDIR)$(INCLUDEDIR)
+ $(INSTALL) -d $(DESTDIR)$(LIBDIR)
+ $(INSTALL) http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
+ $(INSTALL) -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
ln -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
ln -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SOLIBNAME).$(SOEXT)

View File

@ -8,17 +8,18 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=collectd
PKG_VERSION:=5.8.0
PKG_RELEASE:=5
PKG_VERSION:=5.10.0
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://collectd.org/files/ \
https://github.com/collectd/collectd/releases/download/collectd-$(PKG_VERSION)
PKG_HASH:=b06ff476bbf05533cb97ae6749262cc3c76c9969f032bd8496690084ddeb15c9
PKG_HASH:=a03359f563023e744c2dc743008a00a848f4cd506e072621d86b6d8313c0375b
PKG_FIXUP:=autoreconf
PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>, Hannu Nyman <hannu.nyman@iki.fi>
PKG_CPE_ID:=cpe:/a:collectd:collectd
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
@ -26,6 +27,7 @@ PKG_USE_MIPS16:=0
COLLECTD_PLUGINS_DISABLED:= \
amqp \
ampq1 \
apple_sensors \
aquaero \
barometer \
@ -39,11 +41,11 @@ COLLECTD_PLUGINS_DISABLED:= \
dpdkevents \
dpdkstat \
drbd \
ethstat \
fhcount \
genericjmx \
gmond \
gps \
gpu_nvidia \
grpc \
hddtemp \
hugepages \
@ -54,7 +56,6 @@ COLLECTD_PLUGINS_DISABLED:= \
ipvs \
java \
log_logstash \
lua \
lvm \
lpar \
madwifi \
@ -77,12 +78,13 @@ COLLECTD_PLUGINS_DISABLED:= \
oracle \
ovs_events \
ovs_stats \
pcie_errors \
perl \
pf \
pinba \
procevent \
python \
redis \
routeros \
rrdcached \
serial \
sigrok \
@ -91,6 +93,7 @@ COLLECTD_PLUGINS_DISABLED:= \
statsd \
swap \
synproxy \
sysevent \
tape \
tokyotyrant \
turbostat \
@ -105,6 +108,8 @@ COLLECTD_PLUGINS_DISABLED:= \
write_redis \
write_riemann \
write_sensu \
write_stackdriver \
write_syslog \
write_tsdb \
xencpu \
xmms \
@ -129,6 +134,7 @@ COLLECTD_PLUGINS_SELECTED:= \
dns \
email \
entropy \
ethstat \
exec \
filecount \
fscache \
@ -138,6 +144,7 @@ COLLECTD_PLUGINS_SELECTED:= \
iwinfo \
load \
logfile \
lua \
match_empty_counter \
match_hashed \
match_regex \
@ -160,6 +167,7 @@ COLLECTD_PLUGINS_SELECTED:= \
powerdns \
processes \
protocols \
routeros \
rrdtool \
sensors \
snmp \
@ -171,6 +179,7 @@ COLLECTD_PLUGINS_SELECTED:= \
teamspeak2 \
ted \
thermal \
threshold \
unixsock \
uptime \
users \
@ -184,6 +193,8 @@ PKG_CONFIG_DEPENDS:= \
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel.mk
# collectd-mod-mysql needs iconv
include $(INCLUDE_DIR)/nls.mk
define Package/collectd/Default
SECTION:=utils
@ -194,7 +205,12 @@ endef
define Package/collectd
$(call Package/collectd/Default)
DEPENDS:= +libpthread +zlib +libltdl +libip4tc
DEPENDS:= +libpthread \
+zlib \
+libltdl \
+libip4tc \
+jshn \
+PACKAGE_collectd-mod-lua:liblua
MENU:=1
endef
@ -211,10 +227,6 @@ define Package/collectd/config
select PACKAGE_collectd-mod-network
endef
ifneq ($(CONFIG_avr32),)
TARGET_CFLAGS += -fsigned-char
endif
# common configure args
CONFIGURE_ARGS+= \
--disable-werror \
@ -228,7 +240,12 @@ CONFIGURE_ARGS+= \
CONFIGURE_VARS+= \
CFLAGS="$$$$CFLAGS $(FPIC)" \
LDFLAGS="$$$$LDFLAGS -lm -lz" \
KERNEL_DIR="$(LINUX_DIR)" \
KERNEL_DIR="$(LINUX_DIR)"
ifneq ($(CONFIG_PACKAGE_collectd-mod-lua),)
CONFIGURE_VARS+= \
LDFLAGS="$$$$LDFLAGS -llua"
endif
ifneq ($(CONFIG_PACKAGE_COLLECTD_ENCRYPTED_NETWORK),)
CONFIGURE_ARGS+= \
@ -291,18 +308,21 @@ endif
define Package/collectd/conffiles
/etc/collectd.conf
/etc/config/collectd
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
$(INSTALL_DIR) $(1)/etc/collectd/conf.d
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) files/collectd.uci $(1)/etc/config/collectd
endef
# 1: plugin name
@ -326,6 +346,11 @@ define BuildPlugin
$(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
$$(1)/usr/lib/collectd/ ; \
done
if [ -f ./files/usr/share/collectd/plugin/$(1).json ]; then \
$(INSTALL_DIR) $$(1)/usr/share/collectd/plugin ; \
$(INSTALL_DATA) ./files/usr/share/collectd/plugin/$(1).json \
$$(1)/usr/share/collectd/plugin/$(1).json ; \
fi
endef
$$(eval $$(call BuildPackage,collectd-mod-$(1)))
@ -343,7 +368,7 @@ $(eval $(call BuildPlugin,chrony,chrony status input,chrony,))
$(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,cpufreq,CPU Freq input,cpufreq,@(TARGET_x86||TARGET_x86_64||TARGET_mvebu||TARGET_ipq806x||TARGET_armvirt))) # Only enable on x86 mvebu ipq806x armvirt
$(eval $(call BuildPlugin,cpufreq,CPU Freq input,cpufreq,@(TARGET_x86||TARGET_x86_64||TARGET_mvebu||TARGET_ipq806x||TARGET_armvirt||TARGET_ipq40xx||TARGET_brcm2708_bcm2709))) # Only enable on targets with CPUs supporting frequency scaling
$(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))
@ -352,6 +377,7 @@ $(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,entropy,Entropy amount input,entropy,))
$(eval $(call BuildPlugin,ethstat,Ethernet adapter statistics input,ethstat,))
$(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,))
@ -361,6 +387,7 @@ $(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,lua,lua input/output,lua,+PACKAGE_collectd-mod-lua:liblua))
$(eval $(call BuildPlugin,match-empty-counter,empty-counter match,match_empty_counter,))
$(eval $(call BuildPlugin,match-hashed,hashed match,match_hashed,))
$(eval $(call BuildPlugin,match-regex,regex match,match_regex,))
@ -381,8 +408,9 @@ $(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,processes,process status input,processes,+PACKAGE_collectd-mod-processes:libmnl))
$(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
$(eval $(call BuildPlugin,routeros,MikroTik RouterOS input,routeros,+PACKAGE_collectd-mod-routeros:librouteros))
$(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))
$(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
@ -391,9 +419,10 @@ $(eval $(call BuildPlugin,tail,tail input,tail,))
$(eval $(call BuildPlugin,tail-csv,tail CSV input,tail_csv,))
$(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,ted,The Energy Detective input,ted,))
$(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
$(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
$(eval $(call BuildPlugin,threshold,Notifications and thresholds,threshold,))
$(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,))

View File

@ -1,39 +0,0 @@
# Config file for collectd. More info: https://collectd.org/
# Note: Luci statistics will generate a new config and overwrite this file.
#Hostname "localhost"
#FQDNLookup true
BaseDir "/var/run/collectd"
Include "/etc/collectd/conf.d"
PIDFile "/var/run/collectd.pid"
PluginDir "/usr/lib/collectd"
TypesDB "/usr/share/collectd/types.db"
Interval 30
ReadThreads 2
LoadPlugin interface
LoadPlugin load
#LoadPlugin ping
LoadPlugin rrdtool
<Plugin rrdtool>
DataDir "/tmp/rrd"
RRARows 100
RRASingle true
RRATimespan 3600
RRATimespan 86400
RRATimespan 604800
RRATimespan 2678400
RRATimespan 31622400
</Plugin>
<Plugin interface>
IgnoreSelected false
Interface "br-lan"
</Plugin>
#<Plugin ping>
# Host "host.foo.bar"
# Interval 30
# TTL 127
#</Plugin>

View File

@ -5,11 +5,352 @@ START=80
STOP=10
USE_PROCD=1
COLLECTD_CONF="/tmp/collectd.conf"
LOG="logger -t collectd[$$] -p"
NICEPRIO=5
CONFIG_STRING=""
process_exec() {
printf "<Plugin exec>\n" >> "$COLLECTD_CONF"
config_foreach process_exec_sections exec_input "Exec"
config_foreach process_exec_sections exec_notify "NotificationExec"
printf "</Plugin>\n\n" >> "$COLLECTD_CONF"
}
process_exec_sections() {
local cfg="$1"
local section="$2"
local cmdline cmduser cmdgroup
config_get cmdline "$cfg" cmdline
[ -z "$cmdline" ] && {
$LOG notice "No cmdline option in config $cfg defined"
return 0
}
config_get cmduser "$cfg" cmduser
[ -z "$cmduser" ] && {
$LOG notice "No cmduser option in config $cfg defined"
return 0
}
config_get cmdgroup "$cfg" cmdgroup
if [ -z "$cmdgroup" ]; then
printf "\\t%s \"%s\" \"%s\"\n" "${section}" "${cmduser}" "${cmdline}" >> "$COLLECTD_CONF"
else
printf "\\t%s \"%s:%s\" \"%s\"\n" "${section}" "${cmduser}" "${cmdgroup}" "${cmdline}" >> "$COLLECTD_CONF"
fi
}
process_curl() {
printf "<Plugin curl>\n" >> "$COLLECTD_CONF"
config_foreach process_curl_page curl_page
printf "</Plugin>\n\n" >> "$COLLECTD_CONF"
}
process_curl_page() {
local cfg="$1"
local name url
config_get name "$cfg" name
[ -z "$name" ] && {
$LOG notice "No name option in config $cfg defined"
return 0
}
config_get url "$cfg" url
[ -z "$url" ] && {
$LOG notice "No URL option in config $cfg defined"
return 0
}
printf "\\t<Page \"%s\">\n" "${name}" >> "$COLLECTD_CONF"
printf "\\t\\tURL \"%s\"\n" "${url}" >> "$COLLECTD_CONF"
printf "\\t\\tMeasureResponseTime true\n" >> "$COLLECTD_CONF"
printf "\\t</Page>\n" >> "$COLLECTD_CONF"
}
process_network() {
local cfg="$1"
local TimeToLive Forward CacheFlush
printf "<Plugin network>\n" >> "$COLLECTD_CONF"
config_foreach process_network_sections network_listen "listen"
config_foreach process_network_sections network_server "server"
config_get TimeToLive "$cfg" TimeToLive
[ -z "$TimeToLive" ] || {
printf "\\tTimeToLive %s\n" "${TimeToLive}" >> "$COLLECTD_CONF"
}
config_get CacheFlush "$cfg" CacheFlush
[ -z "$CacheFlush" ] || {
printf "\\tCacheFlush %s\n" "${CacheFlush}" >> "$COLLECTD_CONF"
}
config_get_bool Forward "$cfg" Forward
if [ "$value" = "0" ]; then
printf "\\tForward false\n" >> "$COLLECTD_CONF"
else
printf "\\tForward true\n" >> "$COLLECTD_CONF"
fi
printf "</Plugin>\n\n" >> "$COLLECTD_CONF"
}
process_network_sections() {
local cfg="$1"
local section="$2"
local host port output
config_get host "$cfg" host
[ -z "$host" ] && {
$LOG notice "No host option in config $cfg defined"
return 0
}
if [ "$section" = "server" ]; then
output="Server \"$host\""
else
output="Listen \"$host\""
fi
config_get port "$cfg" port
if [ -z "$port" ]; then
printf "\\t%s\n" "${output}" >> "$COLLECTD_CONF"
else
printf "\\t%s \"%s\"\n" "${output}" "${port}" >> "$COLLECTD_CONF"
fi
}
process_iptables() {
local cfg="$1"
printf "<Plugin iptables>\n" >> "$COLLECTD_CONF"
config_foreach process_iptables_sections iptables_match
printf "</Plugin>\n\n" >> "$COLLECTD_CONF"
}
process_iptables_sections() {
local cfg="$1"
local table chain
config_get table "$cfg" table
[ -z "$table" ] && {
$LOG notice "No table option in config $cfg defined"
return 0
}
config_get chain "$cfg" chain
[ -z "$chain" ] && {
$LOG notice "No chain option in config $cfg defined"
return 0
}
config_get index "$cfg" index
[ -z "$index" ] && {
$LOG notice "No index option in config $cfg defined"
return 0
}
config_get name "$cfg" name
if [ -z "$name" ]; then
printf "\\tChain %s %s %s\n" "${table}" "${chain}" "${index}" >> "$COLLECTD_CONF"
else
printf "\\tChain %s %s %s \"%s\"\n" "${table}" "${chain}" "${index}" "${name}">> "$COLLECTD_CONF"
fi
}
CONFIG_LIST=""
add_list_option() {
local value="$1"
local option="$2"
local indent="$3"
CONFIG_LIST="${CONFIG_LIST}${indent}${option} \"$value\"\n"
}
process_generic() {
local cfg="$1"
local indent="$2"
local json="$3"
local config=""
. /usr/share/libubox/jshn.sh
json_init
json_load_file "$json"
json_select string 1>/dev/null 2>&1
if [ $? -eq 0 ]; then
json_get_keys keys
for key in ${keys}; do
json_get_var option "$key"
config_get value "$cfg" "$option" ""
[ -z "$value" ] || {
config="${config}${indent}${option} \"${value}\"\n"
}
done
json_select ..
fi
json_select bool 1>/dev/null 2>&1
if [ $? -eq 0 ]; then
json_get_keys keys
for key in ${keys}; do
json_get_var option "$key"
config_get_bool value "$cfg" "$option"
if [ "$value" = "0" ]; then
config="${config}${indent}${option} false\n"
fi
if [ "$value" = "1" ]; then
config="${config}${indent}${option} true\n"
fi
done
json_select ..
fi
json_select list 1>/dev/null 2>&1
if [ $? -eq 0 ]; then
json_get_keys keys
for key in ${keys}; do
json_get_var option "$key"
CONFIG_LIST=""
config_list_foreach "$cfg" "$option" add_list_option "$option" "$indent"
config="${config}${CONFIG_LIST}"
done
json_select ..
fi
[ -z "$config" ] || {
printf "%s<Plugin %s>\n" "${CONFIG_STRING}" "$cfg" >> "$COLLECTD_CONF"
echo -e "${config}" >> "$COLLECTD_CONF"
printf "%s</Plugin>\n" "${CONFIG_STRING}" >> "$COLLECTD_CONF"
}
printf "\n" >> "$COLLECTD_CONF"
}
process_plugins() {
local cfg="$1"
local enable keys key option value
config_get enable "$cfg" enable 0
[ "$enable" = "1" ] || return 0
[ -f "/usr/lib/collectd/$cfg.so" ] || {
$LOG notice "Plugin collectd-mod-$cfg not installed"
return 0
}
[ -f "/usr/share/collectd/plugin/$cfg.json" ] || {
$LOG notice "Configuration definition file for $cfg not found"
return 0
}
printf "LoadPlugin %s\n" "$cfg" >> "$COLLECTD_CONF"
case "$cfg" in
exec)
CONFIG_STRING=""
process_exec
;;
curl)
CONFIG_STRING=""
process_curl
;;
network)
CONFIG_STRING=""
process_network "$cfg"
;;
iptables)
CONFIG_STRING=""
process_iptables
;;
*)
CONFIG_STRING=""
process_generic "$cfg" "\\t" "/usr/share/collectd/plugin/$cfg.json"
;;
esac
}
process_config() {
local alt_config_file BaseDir Include PIDFile PluginDir TypesDB
local Interval ReadThreads Hostname
rm -f "$COLLECTD_CONF"
[ -f /etc/config/collectd ] || {
$LOG notice "UCI config not found"
return 0
}
config_load collectd
config_get alt_config_file globals alt_config_file
# If "alt_config_file" specified, use that instead
[ -n "$alt_config_file" ] && [ -f "$alt_config_file" ] && {
rm -f "$COLLECTD_CONF"
ln -s "$alt_config_file" "$COLLECTD_CONF"
return 0
}
# GOBAL CONFIG
config_get BaseDir globals BaseDir "/var/run/collectd"
printf "BaseDir \"%s\"\n" "$BaseDir" >> "$COLLECTD_CONF"
config_get Include globals Include "/tmp/collectd.d"
printf "Include \"%s\"\n" "$Include" >> "$COLLECTD_CONF"
mkdir -p "$Include"
config_get PIDFile globals PIDFile "/var/run/collectd.pid"
printf "PIDFile \"%s\"\n" "$PIDFile" >> "$COLLECTD_CONF"
config_get PluginDir globals PluginDir "/usr/lib/collectd"
printf "PluginDir \"%s\"\n" "$PluginDir" >> "$COLLECTD_CONF"
config_get TypesDB globals TypesDB "/usr/share/collectd/types.db"
printf "TypesDB \"%s\"\n" "$TypesDB" >> "$COLLECTD_CONF"
config_get Interval globals Interval 30
printf "Interval \"%s\"\n" "$Interval" >> "$COLLECTD_CONF"
config_get ReadThreads globals ReadThreads 2
printf "ReadThreads \"%s\"\n" "$ReadThreads" >> "$COLLECTD_CONF"
config_get Hostname globals Hostname "$(uname -n)"
printf "Hostname \"%s\"\n" "$Hostname" >> "$COLLECTD_CONF"
printf "\n" >> "$COLLECTD_CONF"
# PLUGIN CONFIG
config_foreach process_plugins plugin
}
service_triggers()
{
procd_add_reload_trigger "collectd"
}
start_service() {
mkdir -m 0755 -p /var/lib/collectd
process_config
procd_open_instance
procd_set_param command /usr/sbin/collectd -f
procd_set_param command /usr/sbin/collectd
procd_append_param command -C "$COLLECTD_CONF"
procd_append_param command -f # don't daemonize
procd_set_param nice "$NICEPRIO"
procd_set_param stderr 1
procd_set_param respawn
procd_close_instance
}
reload_service() {
restart "$@"
}

View File

@ -0,0 +1,195 @@
config globals 'globals'
option alt_config_file "/etc/collectd.conf"
# option BaseDir '/var/run/collectd'
# option Include '/tmp/collectd.d'
# option PIDFile '/var/run/collectd.pid'
# option PluginDir '/usr/lib/collectd'
# option TypesDB '/usr/share/collectd/types.db'
# option Interval '30'
# option ReadThreads '2'
#config plugin 'apcups'
# option enable '0'
# option Host 'localhost'
# option Port '3551'
#config plugin 'conntrack'
# option enable '0'
#config plugin 'contextswitch'
# option enable '0'
#config plugin 'cpu'
# option enable '0'
#config plugin 'cpufreq'
# option enable '0'
#config plugin 'csv'
# option enable '0'
# option StoreRates '0'
# option DataDir '/tmp'
#config plugin 'curl'
# option enable '0'
#config curl_page
# option name 'test'
# option url 'http://finance.google.com/finance?q=NYSE%3AAMD%22'
#config plugin 'df'
# option enable '0'
# list Device '/dev/mtdblock/4'
# list MountPoint '/jffs'
# list FSType 'tmpfs'
# option IgnoreSelected '0'
#config plugin 'disk'
# option enable '0'
# list Disk 'hda1'
# list Disk 'hdb'
# option IgnoreSelected '0'
#config plugin 'dns'
# option enable '0'
# list Interface 'br-lan'
# list IgnoreSource '127.0.0.1'
#config plugin 'email'
# option enable '0'
# option SocketFile '/var/run/collectd/email.sock'
# option SocketGroup 'nogroup'
#config plugin 'entropy'
# option enable '0'
#config plugin 'exec'
# option enable '0'
#config exec_input
# option cmdline '/usr/bin/stat-dhcpusers'
# option cmduser 'nobody'
# option cmdgroup 'nogroup'
#config exec_notify
# option cmdline '/usr/bin/stat-dhcpusers'
# option cmduser 'nobody'
# option cmdgroup 'nogroup'
#config plugin 'interface'
# option enable '1'
# list Interface 'br-lan'
# option IgnoreSelected '0'
#config plugin 'iptables'
# option enable '1'
#config iptables_match
# option table 'nat'
# option chain 'zone_wan_postrouting'
# option index '1'
# option name 'WLAN-Clients traffic'
#config plugin 'irq'
# option enable '0'
# list Irq '2'
# list Irq '3'
# list Irq '4'
# list Irq '7'
#config plugin 'iwinfo'
# option enable '0'
#config plugin 'load'
# option enable '0'
#config plugin 'lua'
# option BasePath '/usr/share/collectd-mod-lua'
# list Script 'script1.lua'
# list Script 'script2.lua
#config plugin 'memory'
# option enable '0'
#config plugin 'netlink'
# option enable '0'
# option IgnoreSelected '0'
# list VerboseInterface 'br-lan'
# list QDisc 'br-lan'
#config plugin 'network'
# option enable '1'
# option TimeToLive '128'
# option Forward '1'
# option CacheFlush '86400'
#config network_listen
# option host '0.0.0.0'
# option port '25826'
#config network_server
# option host '1.1.1.1'
# option port '25826'
#config plugin 'nut'
# option enable '0'
# option UPS 'myupsname'
#config plugin 'olsrd'
# option enable '0'
# option Port '2006'
# option Host '127.0.0.1'
#config plugin 'openvpn'
# option enable '0'
# option StatusFile '/var/run/openvpn/openvpn.status'
# option CollectIndividualUsers '1'
# optoin CollectUserCount '1'
# optoin CollectCompression '1'
# option ImprovedNamingSchema '0'
#config plugin 'ping'
# option enable '0'
# option TTL '127'
# option Interval '30'
# list Host '127.0.0.1'
#config plugin 'processes'
# option enable '0'
# list Process 'uhttpd'
# list Process 'dnsmasq'
# list Process 'dropbear'
#config plugin 'rrdtool'
# option enable '0'
# option DataDir '/tmp/rrd'
# option RRARows '100'
# option RRASingle '1'
# list RRATimespan '3600'
# list RRATimespan '86400'
# list RRATimespan '604800'
# list RRATimespan '2678400'
# list RRATimespan '31622400'
#config plugin 'sensors'
# option enable '0'
#config plugin 'tcpconns'
# option enable '0'
# list ListeningPort '0'
# list LocalPort '22'
# list LocalPort '80'
#config plugin 'thermal'
# option enable '0'
# option IgnoreSelected '0'
# list Device ''
#config plugin 'unixsock'
# option enable '0'
# option SocketFile '/var/run/collectd/query.sock'
# option SocketGroup 'nogroup'
#config plugin 'uptime'
# option enable '0'

View File

@ -0,0 +1,6 @@
{
"string": [
"Host",
"Port"
]
}

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,7 @@
{
"bool": [
"ValuesPercentage",
"ReportByCpu",
"ReportByState"
]
}

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,8 @@
{
"string": [
"DataDir"
],
"bool": [
"StoreRates"
]
}

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,10 @@
{
"bool": [
"IgnoreSelected"
],
"list": [
"Device",
"MountPoint",
"FSType"
]
}

View File

@ -0,0 +1,8 @@
{
"bool": [
"IgnoreSelected"
],
"list": [
"Disk"
]
}

View File

@ -0,0 +1,6 @@
{
"list": [
"Interface",
"IgnoreSource"
]
}

View File

@ -0,0 +1,8 @@
{
"string": [
"SocketFile",
"SocketGroup",
"SocketPerms",
"MaxConns"
]
}

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,8 @@
{
"bool": [
"IgnoreSelected"
],
"list": [
"Interface"
]
}

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,8 @@
{
"bool": [
"IgnoreSelected"
],
"list": [
"Irq"
]
}

View File

@ -0,0 +1,8 @@
{
"bool": [
"IgnoreSelected"
],
"list": [
"Interface"
]
}

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,9 @@
{
"string": [
"LogLevel",
"File"
],
"bool": [
"Timestamp"
]
}

View File

@ -0,0 +1,8 @@
{
"string": [
"BasePath"
],
"list": [
"Script"
]
}

View File

@ -0,0 +1,6 @@
{
"bool": [
"ValuesPercentage",
"ValuesAbsolute"
]
}

View File

@ -0,0 +1,12 @@
{
"bool": [
"IgnoreSelected"
],
"list": [
"Interface",
"VerboseInterface",
"QDisc",
"Classe",
"Filter"
]
}

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,5 @@
{
"string": [
"UPS"
]
}

View File

@ -0,0 +1,9 @@
{
"string": [
"Host",
"Port",
"CollectLinks",
"CollectRoutes",
"CollectTopology"
]
}

View File

@ -0,0 +1,11 @@
{
"string": [
"StatusFile"
],
"bool": [
"CollectIndividualUsers",
"CollectUserCount",
"CollectCompression",
"ImprovedNamingSchema"
]
}

View File

@ -0,0 +1,9 @@
{
"string": [
"TTL",
"Interval"
],
"list": [
"Host"
]
}

View File

@ -0,0 +1,5 @@
{
"list": [
"Process"
]
}

View File

@ -0,0 +1,17 @@
{
"string": [
"DataDir",
"StepSize",
"HeartBeat",
"RRARows",
"XFF",
"CacheFlush",
"CacheTimeout"
],
"bool": [
"RRASingle"
],
"list": [
"RRATimespan"
]
}

View File

@ -0,0 +1,8 @@
{
"bool": [
"IgnoreSelected"
],
"list": [
"Sensor"
]
}

View File

@ -0,0 +1,9 @@
{
"bool": [
"ListeningPorts"
],
"list": [
"LocalPort",
"RemotePort"
]
}

View File

@ -0,0 +1,8 @@
{
"bool": [
"IgnoreSelected"
],
"list": [
"Device"
]
}

View File

@ -0,0 +1,7 @@
{
"string": [
"SocketFile",
"SocketGroup",
"SocketPerms"
]
}

View File

@ -0,0 +1,2 @@
{
}

View File

@ -1,179 +0,0 @@
From 6028f89df95b12219d735b277863f83e9f5ee9e9 Mon Sep 17 00:00:00 2001
From: PJ Bostley <pbostley@gmail.com>
Date: Sat, 20 Jan 2018 16:39:36 -0700
Subject: [PATCH 1/2] Adding support for CDAB endian 32-bit modbus polls
---
src/modbus.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 56 insertions(+), 5 deletions(-)
diff --git a/src/modbus.c b/src/modbus.c
index 31f0c2da81..daa3c028f5 100644
--- a/src/modbus.c
+++ b/src/modbus.c
@@ -76,9 +76,13 @@
enum mb_register_type_e /* {{{ */
{ REG_TYPE_INT16,
REG_TYPE_INT32,
+ REG_TYPE_INT32_CDAB,
REG_TYPE_UINT16,
REG_TYPE_UINT32,
- REG_TYPE_FLOAT }; /* }}} */
+ REG_TYPE_UINT32_CDAB,
+ REG_TYPE_FLOAT,
+ REG_TYPE_FLOAT_CDAB }; /* }}} */
+
enum mb_mreg_type_e /* {{{ */
{ MREG_HOLDING,
MREG_INPUT }; /* }}} */
@@ -425,7 +429,9 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */
if ((ds->ds[0].type != DS_TYPE_GAUGE) &&
(data->register_type != REG_TYPE_INT32) &&
- (data->register_type != REG_TYPE_UINT32)) {
+ (data->register_type != REG_TYPE_INT32_CDAB) &&
+ (data->register_type != REG_TYPE_UINT32) &&
+ (data->register_type != REG_TYPE_UINT32_CDAB)) {
NOTICE(
"Modbus plugin: The data source of type \"%s\" is %s, not gauge. "
"This will most likely result in problems, because the register type "
@@ -434,8 +440,11 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */
}
if ((data->register_type == REG_TYPE_INT32) ||
+ (data->register_type == REG_TYPE_INT32_CDAB) ||
(data->register_type == REG_TYPE_UINT32) ||
- (data->register_type == REG_TYPE_FLOAT))
+ (data->register_type == REG_TYPE_UINT32_CDAB) ||
+ (data->register_type == REG_TYPE_FLOAT) ||
+ (data->register_type == REG_TYPE_FLOAT_CDAB))
values_num = 2;
else
values_num = 1;
@@ -496,8 +505,8 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */
}
if (status != values_num) {
ERROR("Modbus plugin: modbus read function (%s/%s) failed. "
- " status = %i, values_num = %i. Giving up.",
- host->host, host->node, status, values_num);
+ " status = %i, start_addr = %i, values_num = %i. Giving up.",
+ host->host, host->node, status, data->register_base, values_num);
#if LEGACY_LIBMODBUS
modbus_close(&host->connection);
#else
@@ -521,6 +530,17 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */
"Returned float value is %g",
(double)float_value);
+ CAST_TO_VALUE_T(ds, vt, float_value);
+ mb_submit(host, slave, data, vt);
+ } else if (data->register_type == REG_TYPE_FLOAT_CDAB) {
+ float float_value;
+ value_t vt;
+
+ float_value = mb_register_to_float(values[1], values[0]);
+ DEBUG("Modbus plugin: mb_read_data: "
+ "Returned float value is %g",
+ (double)float_value);
+
CAST_TO_VALUE_T(ds, vt, float_value);
mb_submit(host, slave, data, vt);
} else if (data->register_type == REG_TYPE_INT32) {
@@ -535,6 +555,20 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */
"Returned int32 value is %" PRIi32,
v.i32);
+ CAST_TO_VALUE_T(ds, vt, v.i32);
+ mb_submit(host, slave, data, vt);
+ } else if (data->register_type == REG_TYPE_INT32_CDAB) {
+ union {
+ uint32_t u32;
+ int32_t i32;
+ } v;
+ value_t vt;
+
+ v.u32 = (((uint32_t)values[1]) << 16) | ((uint32_t)values[0]);
+ DEBUG("Modbus plugin: mb_read_data: "
+ "Returned int32 value is %" PRIi32,
+ v.i32);
+
CAST_TO_VALUE_T(ds, vt, v.i32);
mb_submit(host, slave, data, vt);
} else if (data->register_type == REG_TYPE_INT16) {
@@ -561,6 +595,17 @@ static int mb_read_data(mb_host_t *host, mb_slave_t *slave, /* {{{ */
"Returned uint32 value is %" PRIu32,
v32);
+ CAST_TO_VALUE_T(ds, vt, v32);
+ mb_submit(host, slave, data, vt);
+ } else if (data->register_type == REG_TYPE_UINT32_CDAB) {
+ uint32_t v32;
+ value_t vt;
+
+ v32 = (((uint32_t)values[1]) << 16) | ((uint32_t)values[0]);
+ DEBUG("Modbus plugin: mb_read_data: "
+ "Returned uint32 value is %" PRIu32,
+ v32);
+
CAST_TO_VALUE_T(ds, vt, v32);
mb_submit(host, slave, data, vt);
} else /* if (data->register_type == REG_TYPE_UINT16) */
@@ -702,12 +747,18 @@ static int mb_config_add_data(oconfig_item_t *ci) /* {{{ */
data.register_type = REG_TYPE_INT16;
else if (strcasecmp("Int32", tmp) == 0)
data.register_type = REG_TYPE_INT32;
+ else if (strcasecmp("Int32LE", tmp) == 0)
+ data.register_type = REG_TYPE_INT32_CDAB;
else if (strcasecmp("Uint16", tmp) == 0)
data.register_type = REG_TYPE_UINT16;
else if (strcasecmp("Uint32", tmp) == 0)
data.register_type = REG_TYPE_UINT32;
+ else if (strcasecmp("Uint32LE", tmp) == 0)
+ data.register_type = REG_TYPE_UINT32_CDAB;
else if (strcasecmp("Float", tmp) == 0)
data.register_type = REG_TYPE_FLOAT;
+ else if (strcasecmp("FloatLE", tmp) == 0)
+ data.register_type = REG_TYPE_FLOAT_CDAB;
else {
ERROR("Modbus plugin: The register type \"%s\" is unknown.", tmp);
status = -1;
From 67afd2685892e69ababb489f48b9033ab5908f4d Mon Sep 17 00:00:00 2001
From: PJ Bostley <pbostley@gmail.com>
Date: Tue, 23 Jan 2018 15:33:23 -0700
Subject: [PATCH 2/2] Adding documentation for the Modbus little endian modes
where 32 bit values have thier registers swapped
---
src/collectd.conf.pod | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index dfd785a2c8..e9715126e6 100644
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
@@ -4128,11 +4128,19 @@ Configures the base register to read from the device. If the option
B<RegisterType> has been set to B<Uint32> or B<Float>, this and the next
register will be read (the register number is increased by one).
-=item B<RegisterType> B<Int16>|B<Int32>|B<Uint16>|B<Uint32>|B<Float>
-
-Specifies what kind of data is returned by the device. If the type is B<Int32>,
-B<Uint32> or B<Float>, two 16E<nbsp>bit registers will be read and the data is
-combined into one value. Defaults to B<Uint16>.
+=item B<RegisterType> B<Int16>|B<Int32>|B<Uint16>|B<Uint32>|B<Float>|B<Int32LE>|B<Uint32LE>|B<FloatLE>
+
+Specifies what kind of data is returned by the device. This defaults to
+B<Uint16>. If the type is B<Int32>, B<Int32LE>, B<Uint32>, B<Uint32LE>,
+B<Float> or B<FloatLE>, two 16E<nbsp>bit registers at B<RegisterBase>
+and B<RegisterBase+1> will be read and the data is combined into one
+32E<nbsp>value. For B<Int32>, B<Uint32> and B<Float> the most significant
+16E<nbsp>bits are in the register at B<RegisterBase> and the least
+significant 16E<nbsp>bits are in the register at B<RegisterBase+1>.
+For B<Int32LE>, B<Uint32LE>, or B<Float32LE>, the high and low order
+registers are swapped with the most significant 16E<nbsp>bits in
+the B<RegisterBase+1> and the least significant 16E<nbsp>bits in
+B<RegisterBase>.
=item B<RegisterCmd> B<ReadHolding>|B<ReadInput>

View File

@ -17,7 +17,7 @@
/* consolidation_functions = */ NULL,
/* consolidation_functions_num = */ 0,
@@ -950,6 +953,12 @@ static int rrd_config(const char *key, c
@@ -944,6 +947,12 @@ static int rrd_config(const char *key, c
/* compar = */ rrd_compare_numeric);
free(value_copy);
@ -30,8 +30,8 @@
} else if (strcasecmp("XFF", key) == 0) {
double tmp = atof(value);
if ((tmp < 0.0) || (tmp >= 1.0)) {
--- a/src/utils_rrdcreate.c
+++ b/src/utils_rrdcreate.c
--- a/src/utils/rrdcreate/rrdcreate.c
+++ b/src/utils/rrdcreate/rrdcreate.c
@@ -180,6 +180,9 @@ static int rra_get(char ***ret, const va
rts_num = rra_timespans_num;
}
@ -42,8 +42,8 @@
rra_max = rts_num * rra_types_num;
assert(rra_max > 0);
--- a/src/utils_rrdcreate.h
+++ b/src/utils_rrdcreate.h
--- a/src/utils/rrdcreate/rrdcreate.h
+++ b/src/utils/rrdcreate/rrdcreate.h
@@ -40,6 +40,8 @@ struct rrdcreate_config_s {
int *timespans;
size_t timespans_num;

View File

@ -1,6 +1,6 @@
--- a/src/daemon/plugin.c
+++ b/src/daemon/plugin.c
@@ -1099,7 +1099,7 @@ static int plugin_insert_read(read_func_
@@ -1092,7 +1092,7 @@ static int plugin_insert_read(read_func_
int status;
llentry_t *le;

View File

@ -0,0 +1,61 @@
Adjust the reaction to a polling interval timestamp that references
to a past time.
Past timestamps can happen when ntpd adjusts router's time after network
connectivity is obtained after boot. Collectd shows warnings for each plugin
as it tries to enter new values with the same timestamp as the previous one.
This patch adjusts the next polling time to be now+2 seconds for the main
loop and for the plugin-specific read loops. That avoids the warnings, but
does not overreact in case there are shorter polling intervals or the time
gets adjusted for other reasons.
Additionally some debug statements are added, but they are visible only
when --enable-debug configure option is used in Makefile.
--- a/src/daemon/collectd.c
+++ b/src/daemon/collectd.c
@@ -274,20 +274,23 @@ static int do_loop(void) {
update_kstat();
#endif
+ DEBUG("do_loop before plugin_read_all: now = %.3f", CDTIME_T_TO_DOUBLE(cdtime()));
/* Issue all plugins */
plugin_read_all();
cdtime_t now = cdtime();
+ DEBUG("do_loop after plugin_read_all: now = %.3f, wait_until= %.3f", CDTIME_T_TO_DOUBLE(now), CDTIME_T_TO_DOUBLE(wait_until));
if (now >= wait_until) {
- WARNING("Not sleeping because the next interval is "
+ WARNING("Sleeping only 2s because the next interval is "
"%.3f seconds in the past!",
CDTIME_T_TO_DOUBLE(now - wait_until));
- wait_until = now + interval;
- continue;
+ wait_until = now + DOUBLE_TO_CDTIME_T(2);
+ DEBUG("do_loop: wait_until adjusted to now+2 = %.3f", CDTIME_T_TO_DOUBLE(wait_until));
}
struct timespec ts_wait = CDTIME_T_TO_TIMESPEC(wait_until - now);
wait_until = wait_until + interval;
+ DEBUG("do_loop ends: wait_until set to %.3f", CDTIME_T_TO_DOUBLE(wait_until));
while ((loop == 0) && (nanosleep(&ts_wait, &ts_wait) != 0)) {
if (errno != EINTR) {
--- a/src/daemon/plugin.c
+++ b/src/daemon/plugin.c
@@ -585,10 +585,11 @@ static void *plugin_read_thread(void __a
/* Check, if `rf_next_read' is in the past. */
if (rf->rf_next_read < now) {
- /* `rf_next_read' is in the past. Insert `now'
+ /* `rf_next_read' is in the past. Insert `now'+2s
* so this value doesn't trail off into the
* past too much. */
- rf->rf_next_read = now;
+ rf->rf_next_read = now + DOUBLE_TO_CDTIME_T(2);
+ DEBUG("plugin_read_thread: Next read is in the past. Adjusted to now+2s");
}
DEBUG("plugin_read_thread: Next read of the `%s' plugin at %.3f.",

View File

@ -1,6 +1,6 @@
--- a/src/olsrd.c
+++ b/src/olsrd.c
@@ -585,7 +585,7 @@ static int olsrd_read(void) /* {{{ */
@@ -582,7 +582,7 @@ static int olsrd_read(void) /* {{{ */
if (fh == NULL)
return -1;

View File

@ -18,7 +18,7 @@ Reversed patch to be applied:
--- a/configure.ac
+++ b/configure.ac
@@ -3327,9 +3327,9 @@ if test "x$with_libmodbus" = "xyes"; the
@@ -3389,9 +3389,9 @@ if test "x$with_libmodbus" = "xyes"; the
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
@ -33,8 +33,8 @@ Reversed patch to be applied:
--- a/src/modbus.c
+++ b/src/modbus.c
@@ -26,7 +26,7 @@
#include "configfile.h"
#include "plugin.h"
#include "utils/common/common.h"
-#include <modbus.h>
+#include <modbus/modbus.h>

View File

@ -1,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
@@ -526,11 +526,7 @@ if test "x$ac_system" = "xLinux"; then
@@ -532,11 +532,7 @@ if test "x$ac_system" = "xLinux"; then
[have_cpuid_h="no (cpuid.h not found)"]
)

View File

@ -1,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
@@ -710,6 +710,11 @@ AC_CACHE_CHECK([whether clock_boottime a
@@ -712,6 +712,11 @@ AC_CACHE_CHECK([whether clock_boottime a
]
)
@ -12,7 +12,7 @@
#
# Checks for typedefs, structures, and compiler characteristics.
@@ -6127,6 +6132,7 @@ plugin_ipc="no"
@@ -6397,6 +6402,7 @@ plugin_ipc="no"
plugin_ipmi="no"
plugin_ipvs="no"
plugin_irq="no"
@ -20,15 +20,15 @@
plugin_load="no"
plugin_log_logstash="no"
plugin_mcelog="no"
@@ -6538,6 +6544,7 @@ AC_PLUGIN([ipmi], [$plugi
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([load], [$plugin_load], [System load])
AC_PLUGIN([log_logstash], [$plugin_log_logstash], [Logstash json_event compatible logging])
@@ -6899,6 +6906,7 @@ AC_MSG_RESULT([ libyajl . . . . . . .
@@ -6841,6 +6847,7 @@ AC_PLUGIN([ipmi], [$plugi
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([load], [$plugin_load], [System load])
AC_PLUGIN([log_logstash], [$plugin_log_logstash], [Logstash json_event compatible logging])
@@ -7212,6 +7219,7 @@ AC_MSG_RESULT([ libyajl . . . . . . .
AC_MSG_RESULT([ oracle . . . . . . . $with_oracle])
AC_MSG_RESULT([ protobuf-c . . . . . $have_protoc_c])
AC_MSG_RESULT([ protoc 3 . . . . . . $have_protoc3])
@ -36,7 +36,7 @@
AC_MSG_RESULT()
AC_MSG_RESULT([ Features:])
AC_MSG_RESULT([ daemon mode . . . . . $enable_daemon])
@@ -6957,6 +6965,7 @@ AC_MSG_RESULT([ ipmi . . . . . . . .
@@ -7274,6 +7282,7 @@ AC_MSG_RESULT([ ipmi . . . . . . . .
AC_MSG_RESULT([ iptables . . . . . . $enable_iptables])
AC_MSG_RESULT([ ipvs . . . . . . . . $enable_ipvs])
AC_MSG_RESULT([ irq . . . . . . . . . $enable_irq])
@ -46,7 +46,7 @@
AC_MSG_RESULT([ logfile . . . . . . . $enable_logfile])
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
@@ -137,6 +137,7 @@
@@ -140,6 +140,7 @@
#@BUILD_PLUGIN_IPTABLES_TRUE@LoadPlugin iptables
#@BUILD_PLUGIN_IPVS_TRUE@LoadPlugin ipvs
#@BUILD_PLUGIN_IRQ_TRUE@LoadPlugin irq
@ -54,7 +54,7 @@
#@BUILD_PLUGIN_JAVA_TRUE@LoadPlugin java
@BUILD_PLUGIN_LOAD_TRUE@@BUILD_PLUGIN_LOAD_TRUE@LoadPlugin load
#@BUILD_PLUGIN_LPAR_TRUE@LoadPlugin lpar
@@ -720,6 +721,12 @@
@@ -775,6 +776,12 @@
# IgnoreSelected true
#</Plugin>
@ -69,7 +69,7 @@
# JVMArg "-Djava.class.path=@prefix@/share/collectd/java/collectd-api.jar"
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
@@ -3503,6 +3503,27 @@ and all other interrupts are collected.
@@ -3873,6 +3873,27 @@ and all other interrupts are collected.
=back
@ -119,9 +119,9 @@
+ **/
+
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
+#include "utils_ignorelist.h"
+#include "utils/common/common.h"
+#include "utils/ignorelist/ignorelist.h"
+
+#include <stdint.h>
+#include <iwinfo.h>
@ -252,17 +252,17 @@
+}
--- a/src/types.db
+++ b/src/types.db
@@ -269,6 +269,7 @@ voltage_threshold value:GAUGE:U:U,
vs_memory value:GAUGE:0:9223372036854775807
vs_processes value:GAUGE:0:65535
vs_threads value:GAUGE:0:65535
@@ -240,6 +240,7 @@ snr value:GAUGE:0:U
spam_check value:GAUGE:0:U
spam_score value:GAUGE:U:U
spl value:GAUGE:U:U
+stations value:GAUGE:0:256
#
# Legacy types
swap value:GAUGE:0:1099511627776
swap_io value:DERIVE:0:U
sysevent value:GAUGE:0:1
--- a/Makefile.am
+++ b/Makefile.am
@@ -983,6 +983,14 @@ irq_la_LDFLAGS = $(PLUGIN_LDFLAGS)
@@ -1165,6 +1165,14 @@ irq_la_LDFLAGS = $(PLUGIN_LDFLAGS)
irq_la_LIBADD = libignorelist.la
endif

View File

@ -1,11 +0,0 @@
--- a/src/ping.c
+++ b/src/ping.c
@@ -635,7 +635,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);