summaryrefslogtreecommitdiffstats
path: root/database/rrdhost.c
diff options
context:
space:
mode:
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 e62e61ae..43aa2daa 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);