diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:19:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:20:17 +0000 |
commit | a64a253794ac64cb40befee54db53bde17dd0d49 (patch) | |
tree | c1024acc5f6e508814b944d99f112259bb28b1be /database/rrdhost.c | |
parent | New upstream version 1.10.0+dfsg (diff) | |
download | netdata-a64a253794ac64cb40befee54db53bde17dd0d49.tar.xz netdata-a64a253794ac64cb40befee54db53bde17dd0d49.zip |
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | database/rrdhost.c (renamed from src/rrdhost.c) | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/rrdhost.c b/database/rrdhost.c index e62e61ae8..43aa2daa2 100644 --- a/src/rrdhost.c +++ b/database/rrdhost.c @@ -1,5 +1,7 @@ -#define NETDATA_RRD_INTERNALS 1 -#include "common.h" +// SPDX-License-Identifier: GPL-3.0-or-later + +#define NETDATA_RRD_INTERNALS +#include "rrd.h" RRDHOST *localhost = NULL; size_t rrd_hosts_available = 0; @@ -116,10 +118,11 @@ RRDHOST *rrdhost_create(const char *hostname, int update_every, long entries, RRD_MEMORY_MODE memory_mode, - int health_enabled, - int rrdpush_enabled, + unsigned int health_enabled, + unsigned int rrdpush_enabled, char *rrdpush_destination, char *rrdpush_api_key, + char *rrdpush_send_charts_matching, int is_localhost ) { debug(D_RRDHOST, "Host '%s': adding with guid '%s'", hostname, guid); @@ -132,9 +135,10 @@ RRDHOST *rrdhost_create(const char *hostname, host->rrd_history_entries = align_entries_to_pagesize(memory_mode, entries); host->rrd_memory_mode = memory_mode; host->health_enabled = (memory_mode == RRD_MEMORY_MODE_NONE)? 0 : health_enabled; - host->rrdpush_send_enabled = (rrdpush_enabled && rrdpush_destination && *rrdpush_destination && rrdpush_api_key && *rrdpush_api_key); + host->rrdpush_send_enabled = (rrdpush_enabled && rrdpush_destination && *rrdpush_destination && rrdpush_api_key && *rrdpush_api_key) ? 1 : 0; host->rrdpush_send_destination = (host->rrdpush_send_enabled)?strdupz(rrdpush_destination):NULL; host->rrdpush_send_api_key = (host->rrdpush_send_enabled)?strdupz(rrdpush_api_key):NULL; + host->rrdpush_send_charts_matching = simple_pattern_create(rrdpush_send_charts_matching, NULL, SIMPLE_PATTERN_EXACT); host->rrdpush_sender_pipe[0] = -1; host->rrdpush_sender_pipe[1] = -1; @@ -227,7 +231,7 @@ RRDHOST *rrdhost_create(const char *hostname, snprintfz(filename, FILENAME_MAX, "%s/alarm-notify.sh", netdata_configured_plugins_dir); host->health_default_exec = strdupz(config_get(CONFIG_SECTION_HEALTH, "script to execute on alarm", filename)); - host->health_default_recipient = strdup("root"); + host->health_default_recipient = strdupz("root"); // ------------------------------------------------------------------------ @@ -238,7 +242,7 @@ RRDHOST *rrdhost_create(const char *hostname, health_alarm_log_open(host); rrdhost_wrlock(host); - health_readdir(host, health_config_dir()); + health_readdir(host, health_user_config_dir(), health_stock_config_dir(), NULL); rrdhost_unlock(host); } @@ -323,10 +327,11 @@ RRDHOST *rrdhost_find_or_create( , int update_every , long history , RRD_MEMORY_MODE mode - , int health_enabled - , int rrdpush_enabled + , unsigned int health_enabled + , unsigned int rrdpush_enabled , char *rrdpush_destination , char *rrdpush_api_key + , char *rrdpush_send_charts_matching ) { debug(D_RRDHOST, "Searching for host '%s' with guid '%s'", hostname, guid); @@ -349,6 +354,7 @@ RRDHOST *rrdhost_find_or_create( , rrdpush_enabled , rrdpush_destination , rrdpush_api_key + , rrdpush_send_charts_matching , 0 ); } @@ -461,6 +467,7 @@ void rrd_init(char *hostname) { , default_rrdpush_enabled , default_rrdpush_destination , default_rrdpush_api_key + , default_rrdpush_send_charts_matching , 1 ); rrd_unlock(); @@ -574,6 +581,7 @@ void rrdhost_free(RRDHOST *host) { freez(host->health_log_filename); freez(host->hostname); freez(host->registry_hostname); + simple_pattern_free(host->rrdpush_send_charts_matching); rrdhost_unlock(host); netdata_rwlock_destroy(&host->health_log.alarm_log_rwlock); netdata_rwlock_destroy(&host->rrdhost_rwlock); |