From 453c67c303f6aa63853e10593120d7abfe3da322 Mon Sep 17 00:00:00 2001 From: "Costa Tsaousis (ktsaou)" Date: Thu, 9 Mar 2017 23:12:23 +0200 Subject: [PATCH] more information about metrics streaming; setting to cleanup orphan hosts on the master moved to netdata.conf --- conf.d/stream.conf | 45 ++++++++++++++++++++++++++++++++------------- src/rrdpush.c | 2 +- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/conf.d/stream.conf b/conf.d/stream.conf index 9386f900..0ebdccb8 100644 --- a/conf.d/stream.conf +++ b/conf.d/stream.conf @@ -7,37 +7,49 @@ # You can generate API keys, with the linux command: uuidgen # # ----------------------------------------------------------------------------- -# 1. SLAVE NETDATA - THE ONE THAT WILL BE SENDING METRICS +# 1. ON SLAVE NETDATA - THE ONE THAT WILL BE SENDING METRICS [stream] + # Enable this on slaves, to have them send metrics. enabled = no - # where to send metrics to? - # A space separated list of [PROTOCOL:]HOST[%INTERFACE][:PORT] is accepted. + # The destination to send metrics to. + # A space separated list of: + # [PROTOCOL:]HOST[%INTERFACE][:PORT] # The first available will get the metrics. # PROTOCOL = tcp or udp (only tcp is supported by masters) # HOST = an IPv4, IPv6 IP, or a hostname. # IPv6 IPs should be given with brackets [ip:address] # INTERFACE = the network interface to use # PORT = the port number or service name (/etc/services) - # This communication is not HTTP (cannot be proxied). + # This communication is not HTTP (cannot be proxied by web proxies). destination = # The API_KEY to use (as the sender) api key = - # other options (uncomment and set) + # The timeout to connect and send metrics + timeout seconds = 60 - # timeout seconds = 60 - # default port = 19999 - # buffer size bytes = 1048576 - # reconnect delay seconds = 5 - # initial clock resync iterations = 60 - # free orphan hosts after seconds = 3600 + # If the destination line above does specify a port, use this + default port = 19999 + + # The buffer to use for sending metrics. + # 1MB by default is good for 2-3 seconds of data, so increase this + # if you expect latencies. + buffer size bytes = 1048576 + + # If the connection fails, or it disconnects, + # retry after that many seconds. + reconnect delay seconds = 5 + + # Attempt to sync the clock the of the master with the clock of the + # slave for that many iterations, when starting. + initial clock resync iterations = 60 # ----------------------------------------------------------------------------- -# 2. MASTER NETDATA - THE ONE THAT WILL BE RECEIVING METRICS +# 2. ON MASTER NETDATA - THE ONE THAT WILL BE RECEIVING METRICS # # You can have one API key per slave, or the same API key for all slaves. # @@ -95,13 +107,20 @@ # ----------------------------------------------------------------------------- +# 3. ON MASTER NETDATA - THE ONE THAT WILL BE RECEIVING METRICS +# +# THIS IS OPTIONAL - YOU DON'T NEED IT BY DEFAULT +# It only exists to give you finer control of the master settings for each +# slave host, when the same API key is used by many netdata slaves / proxies. +# # Each netdata has a unique GUID - generated the first time netdata starts. # You can find it at /var/lib/netdata/registry/netdata.public.unique.id -# The host sending data will have one. If it is static and you can find it, +# The host sending data will have one. If the host is not ephemeral, # you can give settings for each specific host here. [MACHINE_GUID] # enable this host: yes | no + # When disabled, the master will not receive metrics for this host. # THIS IS NOT A SECURITY MECHANISM - AN ATTACKER CAN SET ANY OTHER GUID. # Use only the API key for security. enabled = no diff --git a/src/rrdpush.c b/src/rrdpush.c index f5f54d39..5b626410 100644 --- a/src/rrdpush.c +++ b/src/rrdpush.c @@ -33,7 +33,7 @@ int rrdpush_init() { default_rrdpush_enabled = appconfig_get_boolean(&stream_config, CONFIG_SECTION_STREAM, "enabled", default_rrdpush_enabled); default_rrdpush_destination = appconfig_get(&stream_config, CONFIG_SECTION_STREAM, "destination", ""); default_rrdpush_api_key = appconfig_get(&stream_config, CONFIG_SECTION_STREAM, "api key", ""); - rrdhost_free_orphan_time = appconfig_get_number(&stream_config, CONFIG_SECTION_STREAM, "free orphan hosts after seconds", rrdhost_free_orphan_time); + rrdhost_free_orphan_time = config_get_number(CONFIG_SECTION_GLOBAL, "cleanup orphan hosts after seconds", rrdhost_free_orphan_time); if(default_rrdpush_enabled && (!default_rrdpush_destination || !*default_rrdpush_destination || !default_rrdpush_api_key || !*default_rrdpush_api_key)) { error("STREAM [send]: cannot enable sending thread - information is missing."); -- 2.39.2