summaryrefslogtreecommitdiffstats
path: root/collectors
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-10-26 08:29:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-10-26 08:29:53 +0000
commitd608b19e0d3b3f4d84fcfcdd72bb7e64c86b6f01 (patch)
tree8c283d1c81d718e64d87d9a2d1132c89f3915939 /collectors
parentReleasing debian version 1.18.0-1. (diff)
downloadnetdata-d608b19e0d3b3f4d84fcfcdd72bb7e64c86b6f01.tar.xz
netdata-d608b19e0d3b3f4d84fcfcdd72bb7e64c86b6f01.zip
Merging upstream version 1.18.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors')
-rw-r--r--collectors/apps.plugin/apps_plugin.c2
-rw-r--r--collectors/freebsd.plugin/freebsd_getifaddrs.c2
-rw-r--r--collectors/freebsd.plugin/freebsd_sysctl.c2
-rw-r--r--collectors/freeipmi.plugin/freeipmi_plugin.c2
-rw-r--r--collectors/plugins.d/plugins_d.c7
-rw-r--r--collectors/python.d.plugin/megacli/megacli.chart.py4
-rw-r--r--collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py2
-rw-r--r--collectors/python.d.plugin/python_modules/bases/FrameworkServices/SocketService.py18
-rw-r--r--collectors/python.d.plugin/springboot/README.md2
-rw-r--r--collectors/python.d.plugin/unbound/unbound.chart.py92
-rw-r--r--collectors/slabinfo.plugin/README.md6
-rw-r--r--collectors/statsd.plugin/statsd.c2
-rw-r--r--collectors/tc.plugin/plugin_tc.c3
13 files changed, 93 insertions, 51 deletions
diff --git a/collectors/apps.plugin/apps_plugin.c b/collectors/apps.plugin/apps_plugin.c
index 4dcbd38b7..93159406e 100644
--- a/collectors/apps.plugin/apps_plugin.c
+++ b/collectors/apps.plugin/apps_plugin.c
@@ -2569,7 +2569,7 @@ static int collect_data_for_all_processes(void) {
size_t new_procbase_size;
- int mib[3] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL };
+ int mib[3] = { CTL_KERN, KERN_PROC, KERN_PROC_PROC };
if (unlikely(sysctl(mib, 3, NULL, &new_procbase_size, NULL, 0))) {
error("sysctl error: Can't get processes data size");
return 0;
diff --git a/collectors/freebsd.plugin/freebsd_getifaddrs.c b/collectors/freebsd.plugin/freebsd_getifaddrs.c
index 7e2293e43..72fa908ce 100644
--- a/collectors/freebsd.plugin/freebsd_getifaddrs.c
+++ b/collectors/freebsd.plugin/freebsd_getifaddrs.c
@@ -144,7 +144,7 @@ int do_getifaddrs(int update_every, usec_t dt) {
(void)dt;
#define DEFAULT_EXLUDED_INTERFACES "lo*"
-#define DEFAULT_PHYSICAL_INTERFACES "igb* ix* cxl* em* ixl* ixlv* bge* ixgbe* vtnet*"
+#define DEFAULT_PHYSICAL_INTERFACES "igb* ix* cxl* em* ixl* ixlv* bge* ixgbe* vtnet* vmx*"
#define CONFIG_SECTION_GETIFADDRS "plugin:freebsd:getifaddrs"
static int enable_new_interfaces = -1;
diff --git a/collectors/freebsd.plugin/freebsd_sysctl.c b/collectors/freebsd.plugin/freebsd_sysctl.c
index 271547ab3..bd9226631 100644
--- a/collectors/freebsd.plugin/freebsd_sysctl.c
+++ b/collectors/freebsd.plugin/freebsd_sysctl.c
@@ -470,7 +470,7 @@ int do_dev_cpu_temperature(int update_every, usec_t dt) {
pcpu_temperature = reallocz(pcpu_temperature, sizeof(int) * number_of_cpus);
mib = reallocz(mib, sizeof(int) * number_of_cpus * 4);
if (unlikely(number_of_cpus > old_number_of_cpus))
- memset(&mib[old_number_of_cpus * 4], 0, 4 * (number_of_cpus - old_number_of_cpus));
+ memset(&mib[old_number_of_cpus * 4], 0, sizeof(int) * (number_of_cpus - old_number_of_cpus) * 4);
}
for (i = 0; i < number_of_cpus; i++) {
if (unlikely(!(mib[i * 4])))
diff --git a/collectors/freeipmi.plugin/freeipmi_plugin.c b/collectors/freeipmi.plugin/freeipmi_plugin.c
index ba1fbffae..74274ea21 100644
--- a/collectors/freeipmi.plugin/freeipmi_plugin.c
+++ b/collectors/freeipmi.plugin/freeipmi_plugin.c
@@ -1790,7 +1790,7 @@ int main (int argc, char **argv) {
errno = 0;
- if(freq > netdata_update_every)
+ if(freq >= netdata_update_every)
netdata_update_every = freq;
else if(freq)
diff --git a/collectors/plugins.d/plugins_d.c b/collectors/plugins.d/plugins_d.c
index 85b670df8..edbdb5730 100644
--- a/collectors/plugins.d/plugins_d.c
+++ b/collectors/plugins.d/plugins_d.c
@@ -647,7 +647,7 @@ static void pluginsd_worker_thread_cleanup(void *arg) {
if (cd->pid) {
siginfo_t info;
info("killing child process pid %d", cd->pid);
- if (killpid(cd->pid, SIGTERM) != -1) {
+ if (killpid(cd->pid) != -1) {
info("waiting for child process pid %d to exit...", cd->pid);
waitid(P_PID, (id_t) cd->pid, &info, WEXITED);
}
@@ -738,7 +738,7 @@ void *pluginsd_worker_thread(void *arg) {
info("connected to '%s' running on pid %d", cd->fullfilename, cd->pid);
count = pluginsd_process(localhost, cd, fp, 0);
error("'%s' (pid %d) disconnected after %zu successful data collections (ENDs).", cd->fullfilename, cd->pid, count);
- killpid(cd->pid, SIGTERM);
+ killpid(cd->pid);
int worker_ret_code = mypclose(fp, cd->pid);
@@ -779,6 +779,9 @@ void *pluginsd_main(void *ptr) {
int scan_frequency = (int) config_get_number(CONFIG_SECTION_PLUGINS, "check for new plugins every", 60);
if(scan_frequency < 1) scan_frequency = 1;
+ // disable some plugins by default
+ config_get_boolean(CONFIG_SECTION_PLUGINS, "slabinfo", CONFIG_BOOLEAN_NO);
+
// store the errno for each plugins directory
// so that we don't log broken directories on each loop
int directory_errors[PLUGINSD_MAX_DIRECTORIES] = { 0 };
diff --git a/collectors/python.d.plugin/megacli/megacli.chart.py b/collectors/python.d.plugin/megacli/megacli.chart.py
index 3805a100e..4872eab80 100644
--- a/collectors/python.d.plugin/megacli/megacli.chart.py
+++ b/collectors/python.d.plugin/megacli/megacli.chart.py
@@ -163,8 +163,8 @@ class Battery:
class Megacli:
def __init__(self):
self.s = find_binary('sudo')
- self.m = find_binary('megacli')
- self.sudo_check = [self.s, '-n', '-v']
+ self.m = find_binary('megacli') or find_binary('MegaCli') # Binary on FreeBSD is MegaCli
+ self.sudo_check = [self.s, '-n', '-l']
self.disk_info = [self.s, '-n', self.m, '-LDPDInfo', '-aAll', '-NoLog']
self.battery_info = [self.s, '-n', self.m, '-AdpBbuCmd', '-a0', '-NoLog']
diff --git a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py
index 088bf119e..4dfd226b0 100644
--- a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py
+++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py
@@ -230,7 +230,7 @@ class SimpleService(PythonDLimitedLogger, object):
continue
elif self.charts.cleanup and chart.penalty >= self.charts.cleanup:
chart.obsolete()
- self.error("chart '{0}' was suppressed due to non updating".format(chart.name))
+ self.info("chart '{0}' was suppressed due to non updating".format(chart.name))
continue
ok = chart.update(data, interval)
diff --git a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SocketService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SocketService.py
index 3b94fcdf2..337bf57d8 100644
--- a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SocketService.py
+++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SocketService.py
@@ -14,6 +14,12 @@ except ImportError:
else:
_TLS_SUPPORT = True
+if _TLS_SUPPORT:
+ try:
+ PROTOCOL_TLS = ssl.PROTOCOL_TLS
+ except AttributeError:
+ PROTOCOL_TLS = ssl.PROTOCOL_SSLv23
+
from bases.FrameworkServices.SimpleService import SimpleService
@@ -80,15 +86,18 @@ class SocketService(SimpleService):
if self.tls:
try:
self.debug('Encapsulating socket with TLS')
+ self.debug('Using keyfile: {0}, certfile: {1}, cert_reqs: {2}, ssl_version: {3}'.format(
+ self.key, self.cert, ssl.CERT_NONE, PROTOCOL_TLS
+ ))
self._sock = ssl.wrap_socket(self._sock,
keyfile=self.key,
certfile=self.cert,
server_side=False,
cert_reqs=ssl.CERT_NONE,
- ssl_version=ssl.PROTOCOL_TLS,
+ ssl_version=PROTOCOL_TLS,
)
- except (socket.error, ssl.SSLError) as error:
- self.error('failed to wrap socket : {0}'.format(error))
+ except (socket.error, ssl.SSLError, IOError, OSError) as error:
+ self.error('failed to wrap socket : {0}'.format(repr(error)))
self._disconnect()
self.__socket_config = None
return False
@@ -167,7 +176,8 @@ class SocketService(SimpleService):
if self._connect2socket(res):
break
- except Exception:
+ except Exception as error:
+ self.error('unhandled exception during connect : {0}'.format(repr(error)))
self._sock = None
self.__socket_config = None
diff --git a/collectors/python.d.plugin/springboot/README.md b/collectors/python.d.plugin/springboot/README.md
index 75cfa22ee..37b4dd7cb 100644
--- a/collectors/python.d.plugin/springboot/README.md
+++ b/collectors/python.d.plugin/springboot/README.md
@@ -63,7 +63,7 @@ public class HeapPoolMetrics implements PublicMetrics {
}
```
-Please refer [Spring Boot Actuator: Production-ready features](https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready.html) and [81. Actuator - Part IX. ‘How-to’ guides](https://docs.spring.io/spring-boot/docs/current/reference/html/howto-actuator.html) for more information.
+Please refer [Spring Boot Actuator: Production-ready Features](https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready) and [81. Actuator - Part IX. ‘How-to’ guides](https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto-actuator) for more information.
## Charts
diff --git a/collectors/python.d.plugin/unbound/unbound.chart.py b/collectors/python.d.plugin/unbound/unbound.chart.py
index 6e5a22c58..590de4c98 100644
--- a/collectors/python.d.plugin/unbound/unbound.chart.py
+++ b/collectors/python.d.plugin/unbound/unbound.chart.py
@@ -32,10 +32,10 @@ CHARTS = {
]
},
'recursion': {
- 'options': [None, 'Recursion Timings', 'seconds', 'Unbound', 'unbound.recursion', 'line'],
+ 'options': [None, 'Recursion Timings', 'milliseconds', 'Unbound', 'unbound.recursion', 'line'],
'lines': [
- ['recursive_avg', 'average', 'absolute', 1, PRECISION],
- ['recursive_med', 'median', 'absolute', 1, PRECISION]
+ ['recursive_avg', 'average', 'absolute', 1, 1],
+ ['recursive_med', 'median', 'absolute', 1, 1]
]
},
'reqlist': {
@@ -83,11 +83,11 @@ PER_THREAD_CHARTS = {
]
},
'_recursion': {
- 'options': [None, '{longname} Recursion Timings', 'seconds', 'Recursive Timings',
+ 'options': [None, '{longname} Recursion Timings', 'milliseconds', 'Recursive Timings',
'unbound.threads.recursion', 'line'],
'lines': [
- ['{shortname}_recursive_avg', 'average', 'absolute', 1, PRECISION],
- ['{shortname}_recursive_med', 'median', 'absolute', 1, PRECISION]
+ ['{shortname}_recursive_avg', 'average', 'absolute', 1, 1],
+ ['{shortname}_recursive_med', 'median', 'absolute', 1, 1]
]
},
'_reqlist': {
@@ -103,7 +103,6 @@ PER_THREAD_CHARTS = {
}
}
-
# This maps the Unbound stat names to our names and precision requiremnets.
STAT_MAP = {
'total.num.queries_ip_ratelimited': ('ratelimit', 1),
@@ -118,6 +117,7 @@ STAT_MAP = {
'total.requestlist.exceeded': ('reqlist_exceeded', 1),
'total.requestlist.current.all': ('reqlist_current', 1),
'total.requestlist.current.user': ('reqlist_user', 1),
+ # Unbound reports recursion timings as fractional seconds, but we want to show them as milliseconds.
'total.recursion.time.avg': ('recursive_avg', PRECISION),
'total.recursion.time.median': ('recursive_med', PRECISION),
'msg.cache.count': ('cache_message', 1),
@@ -142,11 +142,16 @@ PER_THREAD_STAT_MAP = {
'{shortname}.requestlist.exceeded': ('{shortname}_reqlist_exceeded', 1),
'{shortname}.requestlist.current.all': ('{shortname}_reqlist_current', 1),
'{shortname}.requestlist.current.user': ('{shortname}_reqlist_user', 1),
+ # Unbound reports recursion timings as fractional seconds, but we want to show them as milliseconds.
'{shortname}.recursion.time.avg': ('{shortname}_recursive_avg', PRECISION),
'{shortname}.recursion.time.median': ('{shortname}_recursive_med', PRECISION)
}
+def is_readable(name):
+ return os.access(name, os.R_OK)
+
+
# Used to actually generate per-thread charts.
def _get_perthread_info(thread):
sname = 'thread{0}'.format(thread)
@@ -203,25 +208,8 @@ class Service(SocketService):
self.debug('Using certificate: {0}'.format(self.cert))
def _auto_config(self):
- if self.ubconf and os.access(self.ubconf, os.R_OK):
- self.debug('Unbound config: {0}'.format(self.ubconf))
- conf = dict()
- try:
- conf = load_config(self.ubconf)
- except Exception as error:
- self.error("error on loading '{0}' : {1}".format(self.ubconf, error))
- if self.ext is None:
- if 'extended-statistics' in conf['server']:
- self.ext = conf['server']['extended-statistics']
- if 'remote-control' in conf:
- if conf['remote-control'].get('control-use-cert', False):
- self.key = self.key or conf['remote-control'].get('control-key-file')
- self.cert = self.cert or conf['remote-control'].get('control-cert-file')
- self.port = self.port or conf['remote-control'].get('control-port')
- else:
- self.unix_socket = self.unix_socket or conf['remote-control'].get('control-interface')
- else:
- self.debug('Unbound configuration not found.')
+ self.load_unbound_config()
+
if not self.key:
self.key = '/etc/unbound/unbound_control.key'
if not self.cert:
@@ -229,6 +217,38 @@ class Service(SocketService):
if not self.port:
self.port = 8953
+ def load_unbound_config(self):
+ if not (self.ubconf and is_readable(self.ubconf)):
+ self.debug('Unbound configuration not found.')
+ return
+
+ self.debug('Loading Unbound config: {0}'.format(self.ubconf))
+
+ try:
+ conf = load_config(self.ubconf)
+ except Exception as error:
+ self.error("error on loading '{0}' : {1}".format(self.ubconf, error))
+ return
+
+ srv = conf.get('server')
+ if self.ext is None:
+ if srv and 'extended-statistics' in srv:
+ self.ext = srv['extended-statistics']
+
+ rc = conf.get('remote-control')
+ if not (rc and isinstance(rc, dict)):
+ return
+
+ if rc.get('control-use-cert', False):
+ self.key = self.key or rc.get('control-key-file')
+ self.cert = self.cert or rc.get('control-cert-file')
+ self.port = self.port or rc.get('control-port')
+ else:
+ ci = rc.get('control-interface', str())
+ is_socket = '/' in ci
+ if is_socket:
+ self.unix_socket = ci
+
def _generate_perthread_charts(self):
tmporder = list()
for thread in range(0, self.threads):
@@ -239,6 +259,14 @@ class Service(SocketService):
self.order.extend(sorted(tmporder))
def check(self):
+ if not is_readable(self.key):
+ self.error("ssl key '{0}' is not readable".format(self.key))
+ return False
+
+ if not is_readable(self.cert):
+ self.error("ssl certificate '{0}' is not readable".format(self.certificate))
+ return False
+
# Check if authentication is working.
self._connect()
result = bool(self._sock)
@@ -268,12 +296,6 @@ class Service(SocketService):
self.request = tmp
return result
- @staticmethod
- def _check_raw_data(data):
- # The server will close the connection when it's done sending
- # data, so just keep looping until that happens.
- return False
-
def _get_data(self):
raw = self._get_raw_data()
data = dict()
@@ -288,3 +310,9 @@ class Service(SocketService):
else:
self.warning('Received no data from socket.')
return data
+
+ @staticmethod
+ def _check_raw_data(data):
+ # The server will close the connection when it's done sending
+ # data, so just keep looping until that happens.
+ return False
diff --git a/collectors/slabinfo.plugin/README.md b/collectors/slabinfo.plugin/README.md
index e21802397..444cd8e38 100644
--- a/collectors/slabinfo.plugin/README.md
+++ b/collectors/slabinfo.plugin/README.md
@@ -4,10 +4,12 @@ SLAB is a cache mechanism used by the Kernel to avoid fragmentation.
Each internal structure (process, file descriptor, inode...) is stored within a SLAB.
-
## configuring Netdata for slabinfo
-There is currently no configuration needed.
+The plugin is disabled by default because it collects and displays a huge amount of metrics.
+To enable it set `slabinfo = yes` in the `plugins` section of the `netdata.conf` configuration file.
+
+There is currently no configuration needed for the plugin itself.
As `/proc/slabinfo` is only readable by root, this plugin is setuid root.
diff --git a/collectors/statsd.plugin/statsd.c b/collectors/statsd.plugin/statsd.c
index 78f0e9807..7468f2746 100644
--- a/collectors/statsd.plugin/statsd.c
+++ b/collectors/statsd.plugin/statsd.c
@@ -2222,7 +2222,7 @@ void *statsd_main(void *ptr) {
// ----------------------------------------------------------------------------------------------------------------
// statsd setup
- if(!statsd.enabled) return NULL;
+ if(!statsd.enabled) goto cleanup;
statsd_listen_sockets_setup();
if(!statsd.sockets.opened) {
diff --git a/collectors/tc.plugin/plugin_tc.c b/collectors/tc.plugin/plugin_tc.c
index 50383f4ce..9245b0857 100644
--- a/collectors/tc.plugin/plugin_tc.c
+++ b/collectors/tc.plugin/plugin_tc.c
@@ -851,12 +851,11 @@ static void tc_main_cleanup(void *ptr) {
if(tc_child_pid) {
info("TC: killing with SIGTERM tc-qos-helper process %d", tc_child_pid);
- if(killpid(tc_child_pid, SIGTERM) != -1) {
+ if(killpid(tc_child_pid) != -1) {
siginfo_t info;
info("TC: waiting for tc plugin child process pid %d to exit...", tc_child_pid);
waitid(P_PID, (id_t) tc_child_pid, &info, WEXITED);
- // info("TC: finished tc plugin child process pid %d.", tc_child_pid);
}
tc_child_pid = 0;