mirror of
https://github.com/netdata/netdata.git
synced 2025-04-13 17:19:11 +00:00
Rename log Macros (debug) (#15322)
This commit is contained in:
parent
f00b398016
commit
f672f4a955
73 changed files with 677 additions and 676 deletions
aclk
collectors
cgroups.plugin
ebpf.plugin
freebsd.plugin
macos.plugin
plugins.d
proc.plugin
statsd.plugin
tc.plugin
daemon
database
exporting
health
libnetdata
registry
streaming
tests/profile
web
api
server
|
@ -110,7 +110,7 @@ static int load_private_key()
|
|||
netdata_log_error("Claimed agent cannot establish ACLK - unable to load private key '%s' failed.", filename);
|
||||
return 1;
|
||||
}
|
||||
debug(D_ACLK, "Claimed agent loaded private key len=%ld bytes", bytes_read);
|
||||
netdata_log_debug(D_ACLK, "Claimed agent loaded private key len=%ld bytes", bytes_read);
|
||||
|
||||
BIO *key_bio = BIO_new_mem_buf(private_key, -1);
|
||||
if (key_bio==NULL) {
|
||||
|
@ -240,7 +240,7 @@ void aclk_mqtt_wss_log_cb(mqtt_wss_log_type_t log_type, const char* str)
|
|||
netdata_log_info("%s", str);
|
||||
return;
|
||||
case MQTT_WSS_LOG_DEBUG:
|
||||
debug(D_ACLK, "%s", str);
|
||||
netdata_log_debug(D_ACLK, "%s", str);
|
||||
return;
|
||||
default:
|
||||
netdata_log_error("Unknown log type from mqtt_wss");
|
||||
|
@ -252,7 +252,7 @@ static void msg_callback(const char *topic, const void *msg, size_t msglen, int
|
|||
UNUSED(qos);
|
||||
aclk_rcvd_cloud_msgs++;
|
||||
|
||||
debug(D_ACLK, "Got Message From Broker Topic \"%s\" QOS %d", topic, qos);
|
||||
netdata_log_debug(D_ACLK, "Got Message From Broker Topic \"%s\" QOS %d", topic, qos);
|
||||
|
||||
if (aclk_shared_state.mqtt_shutdown_msg_id > 0) {
|
||||
netdata_log_error("Link is shutting down. Ignoring incoming message.");
|
||||
|
|
|
@ -286,10 +286,10 @@ static void aclk_query_process_msg(struct aclk_query_thread *query_thr, aclk_que
|
|||
|
||||
worker_is_busy(query->type);
|
||||
if (query->type == HTTP_API_V2) {
|
||||
debug(D_ACLK, "Processing Queued Message of type: \"http_api_request_v2\"");
|
||||
netdata_log_debug(D_ACLK, "Processing Queued Message of type: \"http_api_request_v2\"");
|
||||
http_api_v2(query_thr, query);
|
||||
} else {
|
||||
debug(D_ACLK, "Processing Queued Message of type: \"%s\"", query->data.bin_payload.msg_name);
|
||||
netdata_log_debug(D_ACLK, "Processing Queued Message of type: \"%s\"", query->data.bin_payload.msg_name);
|
||||
send_bin_msg(query_thr, query);
|
||||
}
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ int aclk_handle_cloud_cmd_message(char *payload)
|
|||
return 1;
|
||||
}
|
||||
|
||||
debug(D_ACLK, "ACLK incoming 'cmd' message (%s)", payload);
|
||||
netdata_log_debug(D_ACLK, "ACLK incoming 'cmd' message (%s)", payload);
|
||||
|
||||
int rc = json_parse(payload, &cloud_to_agent, cloud_to_agent_parse);
|
||||
|
||||
|
@ -250,7 +250,7 @@ int create_node_instance_result(const char *msg, size_t msg_len)
|
|||
return 1;
|
||||
}
|
||||
|
||||
debug(D_ACLK, "CreateNodeInstanceResult: guid:%s nodeid:%s", res.machine_guid, res.node_id);
|
||||
netdata_log_debug(D_ACLK, "CreateNodeInstanceResult: guid:%s nodeid:%s", res.machine_guid, res.node_id);
|
||||
|
||||
uuid_t host_id, node_id;
|
||||
if (uuid_parse(res.machine_guid, host_id)) {
|
||||
|
@ -529,7 +529,7 @@ void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t
|
|||
ACLK_STATS_UNLOCK;
|
||||
}
|
||||
new_cloud_rx_msg_t *msg_descriptor = find_rx_handler_by_hash(simple_hash(message_type));
|
||||
debug(D_ACLK, "Got message named '%s' from cloud", message_type);
|
||||
netdata_log_debug(D_ACLK, "Got message named '%s' from cloud", message_type);
|
||||
if (unlikely(!msg_descriptor)) {
|
||||
netdata_log_error("Do not know how to handle message of type '%s'. Ignoring", message_type);
|
||||
if (aclk_stats_enabled) {
|
||||
|
|
|
@ -219,7 +219,7 @@ static int topic_cache_add_topic(struct json_object *json, struct aclk_topic *to
|
|||
}
|
||||
topic->topic_id = topic_name_to_id(json_object_get_string(json_object_iter_peek_value(&it)));
|
||||
if (topic->topic_id == ACLK_TOPICID_UNKNOWN) {
|
||||
debug(D_ACLK, "topic dictionary has unknown topic name \"%s\"", json_object_get_string(json_object_iter_peek_value(&it)));
|
||||
netdata_log_debug(D_ACLK, "topic dictionary has unknown topic name \"%s\"", json_object_get_string(json_object_iter_peek_value(&it)));
|
||||
}
|
||||
json_object_iter_next(&it);
|
||||
continue;
|
||||
|
|
|
@ -427,10 +427,12 @@ void read_cgroup_plugin_configuration() {
|
|||
|
||||
//TODO: can there be more than 1 cgroup2 mount point?
|
||||
mi = mountinfo_find_by_filesystem_super_option(root, "cgroup2", "rw"); //there is no cgroup2 specific super option - for now use 'rw' option
|
||||
if(mi) debug(D_CGROUP, "found unified cgroup root using super options, with path: '%s'", mi->mount_point);
|
||||
if(mi)
|
||||
netdata_log_debug(D_CGROUP, "found unified cgroup root using super options, with path: '%s'", mi->mount_point);
|
||||
if(!mi) {
|
||||
mi = mountinfo_find_by_filesystem_mount_source(root, "cgroup2", "cgroup");
|
||||
if(mi) debug(D_CGROUP, "found unified cgroup root using mountsource info, with path: '%s'", mi->mount_point);
|
||||
if(mi)
|
||||
netdata_log_debug(D_CGROUP, "found unified cgroup root using mountsource info, with path: '%s'", mi->mount_point);
|
||||
}
|
||||
if(!mi) {
|
||||
collector_error("CGROUP: cannot find cgroup2 mountinfo. Assuming default: /sys/fs/cgroup");
|
||||
|
@ -439,7 +441,7 @@ void read_cgroup_plugin_configuration() {
|
|||
else s = mi->mount_point;
|
||||
set_cgroup_base_path(filename, s);
|
||||
cgroup_unified_base = config_get("plugin:cgroups", "path to unified cgroups", filename);
|
||||
debug(D_CGROUP, "using cgroup root: '%s'", cgroup_unified_base);
|
||||
netdata_log_debug(D_CGROUP, "using cgroup root: '%s'", cgroup_unified_base);
|
||||
}
|
||||
|
||||
cgroup_root_max = (int)config_get_number("plugin:cgroups", "max cgroups to allow", cgroup_root_max);
|
||||
|
@ -982,13 +984,13 @@ static int k8s_get_container_first_proc_comm(const char *id, char *comm) {
|
|||
|
||||
ff = procfile_reopen(ff, filename, NULL, CGROUP_PROCFILE_FLAG);
|
||||
if (unlikely(!ff)) {
|
||||
debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot open file '%s'.", filename);
|
||||
netdata_log_debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot open file '%s'.", filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ff = procfile_readall(ff);
|
||||
if (unlikely(!ff)) {
|
||||
debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot read file '%s'.", filename);
|
||||
netdata_log_debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot read file '%s'.", filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1006,13 +1008,13 @@ static int k8s_get_container_first_proc_comm(const char *id, char *comm) {
|
|||
|
||||
ff = procfile_reopen(ff, filename, NULL, PROCFILE_FLAG_DEFAULT);
|
||||
if (unlikely(!ff)) {
|
||||
debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot open file '%s'.", filename);
|
||||
netdata_log_debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot open file '%s'.", filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
ff = procfile_readall(ff);
|
||||
if (unlikely(!ff)) {
|
||||
debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot read file '%s'.", filename);
|
||||
netdata_log_debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot read file '%s'.", filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1612,7 +1614,7 @@ memory_next:
|
|||
}
|
||||
|
||||
static inline void read_cgroup(struct cgroup *cg) {
|
||||
debug(D_CGROUP, "reading metrics for cgroups '%s'", cg->id);
|
||||
netdata_log_debug(D_CGROUP, "reading metrics for cgroups '%s'", cg->id);
|
||||
if(!(cg->options & CGROUP_OPTIONS_IS_UNIFIED)) {
|
||||
cgroup_read_cpuacct_stat(&cg->cpuacct_stat);
|
||||
cgroup_read_cpuacct_usage(&cg->cpuacct_usage);
|
||||
|
@ -1640,7 +1642,7 @@ static inline void read_cgroup(struct cgroup *cg) {
|
|||
}
|
||||
|
||||
static inline void read_all_discovered_cgroups(struct cgroup *root) {
|
||||
debug(D_CGROUP, "reading metrics for all cgroups");
|
||||
netdata_log_debug(D_CGROUP, "reading metrics for all cgroups");
|
||||
|
||||
struct cgroup *cg;
|
||||
for (cg = root; cg; cg = cg->next) {
|
||||
|
@ -1655,7 +1657,7 @@ static inline void read_all_discovered_cgroups(struct cgroup *root) {
|
|||
|
||||
#define CGROUP_NETWORK_INTERFACE_MAX_LINE 2048
|
||||
static inline void read_cgroup_network_interfaces(struct cgroup *cg) {
|
||||
debug(D_CGROUP, "looking for the network interfaces of cgroup '%s' with chart id '%s' and title '%s'", cg->id, cg->chart_id, cg->chart_title);
|
||||
netdata_log_debug(D_CGROUP, "looking for the network interfaces of cgroup '%s' with chart id '%s' and title '%s'", cg->id, cg->chart_id, cg->chart_title);
|
||||
|
||||
pid_t cgroup_pid;
|
||||
char cgroup_identifier[CGROUP_NETWORK_INTERFACE_MAX_LINE + 1];
|
||||
|
@ -1667,7 +1669,7 @@ static inline void read_cgroup_network_interfaces(struct cgroup *cg) {
|
|||
snprintfz(cgroup_identifier, CGROUP_NETWORK_INTERFACE_MAX_LINE, "%s%s", cgroup_unified_base, cg->id);
|
||||
}
|
||||
|
||||
debug(D_CGROUP, "executing cgroup_identifier %s --cgroup '%s' for cgroup '%s'", cgroups_network_interface_script, cgroup_identifier, cg->id);
|
||||
netdata_log_debug(D_CGROUP, "executing cgroup_identifier %s --cgroup '%s' for cgroup '%s'", cgroups_network_interface_script, cgroup_identifier, cg->id);
|
||||
FILE *fp_child_input, *fp_child_output;
|
||||
(void)netdata_popen_raw_default_flags_and_environment(&cgroup_pid, &fp_child_input, &fp_child_output, cgroups_network_interface_script, "--cgroup", cgroup_identifier);
|
||||
if(!fp_child_output) {
|
||||
|
@ -1713,7 +1715,7 @@ static inline void read_cgroup_network_interfaces(struct cgroup *cg) {
|
|||
}
|
||||
|
||||
netdata_pclose(fp_child_input, fp_child_output, cgroup_pid);
|
||||
// debug(D_CGROUP, "closed cgroup_identifier for cgroup '%s'", cg->id);
|
||||
// netdata_log_debug(D_CGROUP, "closed cgroup_identifier for cgroup '%s'", cg->id);
|
||||
}
|
||||
|
||||
static inline void free_cgroup_network_interfaces(struct cgroup *cg) {
|
||||
|
@ -1793,7 +1795,7 @@ static inline void free_pressure(struct pressure *res) {
|
|||
}
|
||||
|
||||
static inline void cgroup_free(struct cgroup *cg) {
|
||||
debug(D_CGROUP, "Removing cgroup '%s' with chart id '%s' (was %s and %s)", cg->id, cg->chart_id, (cg->enabled)?"enabled":"disabled", (cg->available)?"available":"not available");
|
||||
netdata_log_debug(D_CGROUP, "Removing cgroup '%s' with chart id '%s' (was %s and %s)", cg->id, cg->chart_id, (cg->enabled)?"enabled":"disabled", (cg->available)?"available":"not available");
|
||||
|
||||
if(cg->st_cpu) rrdset_is_obsolete(cg->st_cpu);
|
||||
if(cg->st_cpu_limit) rrdset_is_obsolete(cg->st_cpu_limit);
|
||||
|
@ -1870,8 +1872,8 @@ static inline void discovery_rename_cgroup(struct cgroup *cg) {
|
|||
}
|
||||
cg->pending_renames--;
|
||||
|
||||
debug(D_CGROUP, "looking for the name of cgroup '%s' with chart id '%s' and title '%s'", cg->id, cg->chart_id, cg->chart_title);
|
||||
debug(D_CGROUP, "executing command %s \"%s\" for cgroup '%s'", cgroups_rename_script, cg->intermediate_id, cg->chart_id);
|
||||
netdata_log_debug(D_CGROUP, "looking for the name of cgroup '%s' with chart id '%s' and title '%s'", cg->id, cg->chart_id, cg->chart_title);
|
||||
netdata_log_debug(D_CGROUP, "executing command %s \"%s\" for cgroup '%s'", cgroups_rename_script, cg->intermediate_id, cg->chart_id);
|
||||
pid_t cgroup_pid;
|
||||
|
||||
FILE *fp_child_input, *fp_child_output;
|
||||
|
@ -1984,7 +1986,7 @@ static inline void convert_cgroup_to_systemd_service(struct cgroup *cg) {
|
|||
}
|
||||
|
||||
static inline struct cgroup *discovery_cgroup_add(const char *id) {
|
||||
debug(D_CGROUP, "adding to list, cgroup with id '%s'", id);
|
||||
netdata_log_debug(D_CGROUP, "adding to list, cgroup with id '%s'", id);
|
||||
|
||||
struct cgroup *cg = callocz(1, sizeof(struct cgroup));
|
||||
cg->id = strdupz(id);
|
||||
|
@ -2011,7 +2013,7 @@ static inline struct cgroup *discovery_cgroup_add(const char *id) {
|
|||
}
|
||||
|
||||
static inline struct cgroup *discovery_cgroup_find(const char *id) {
|
||||
debug(D_CGROUP, "searching for cgroup '%s'", id);
|
||||
netdata_log_debug(D_CGROUP, "searching for cgroup '%s'", id);
|
||||
|
||||
uint32_t hash = simple_hash(id);
|
||||
|
||||
|
@ -2021,7 +2023,7 @@ static inline struct cgroup *discovery_cgroup_find(const char *id) {
|
|||
break;
|
||||
}
|
||||
|
||||
debug(D_CGROUP, "cgroup '%s' %s in memory", id, (cg)?"found":"not found");
|
||||
netdata_log_debug(D_CGROUP, "cgroup '%s' %s in memory", id, (cg)?"found":"not found");
|
||||
return cg;
|
||||
}
|
||||
|
||||
|
@ -2029,7 +2031,7 @@ static inline void discovery_find_cgroup_in_dir_callback(const char *dir) {
|
|||
if (!dir || !*dir) {
|
||||
dir = "/";
|
||||
}
|
||||
debug(D_CGROUP, "examining cgroup dir '%s'", dir);
|
||||
netdata_log_debug(D_CGROUP, "examining cgroup dir '%s'", dir);
|
||||
|
||||
struct cgroup *cg = discovery_cgroup_find(dir);
|
||||
if (cg) {
|
||||
|
@ -2058,7 +2060,7 @@ static inline void discovery_find_cgroup_in_dir_callback(const char *dir) {
|
|||
|
||||
static inline int discovery_find_dir_in_subdirs(const char *base, const char *this, void (*callback)(const char *)) {
|
||||
if(!this) this = base;
|
||||
debug(D_CGROUP, "searching for directories in '%s' (base '%s')", this?this:"", base);
|
||||
netdata_log_debug(D_CGROUP, "searching for directories in '%s' (base '%s')", this?this:"", base);
|
||||
|
||||
size_t dirlen = strlen(this), baselen = strlen(base);
|
||||
|
||||
|
@ -2112,7 +2114,7 @@ static inline int discovery_find_dir_in_subdirs(const char *base, const char *th
|
|||
}
|
||||
|
||||
static inline void discovery_mark_all_cgroups_as_unavailable() {
|
||||
debug(D_CGROUP, "marking all cgroups as not available");
|
||||
netdata_log_debug(D_CGROUP, "marking all cgroups as not available");
|
||||
struct cgroup *cg;
|
||||
for (cg = discovered_cgroup_root; cg; cg = cg->discovered_next) {
|
||||
cg->available = 0;
|
||||
|
@ -2126,7 +2128,7 @@ static inline void discovery_update_filenames() {
|
|||
if(unlikely(!cg->available || !cg->enabled || cg->pending_renames))
|
||||
continue;
|
||||
|
||||
debug(D_CGROUP, "checking paths for cgroup '%s'", cg->id);
|
||||
netdata_log_debug(D_CGROUP, "checking paths for cgroup '%s'", cg->id);
|
||||
|
||||
// check for newly added cgroups
|
||||
// and update the filenames they read
|
||||
|
@ -2143,10 +2145,10 @@ static inline void discovery_update_filenames() {
|
|||
cg->filename_cpu_cfs_period = strdupz(filename);
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/cpu.cfs_quota_us", cgroup_cpuacct_base, cg->id);
|
||||
cg->filename_cpu_cfs_quota = strdupz(filename);
|
||||
debug(D_CGROUP, "cpuacct.stat filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_stat.filename);
|
||||
netdata_log_debug(D_CGROUP, "cpuacct.stat filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_stat.filename);
|
||||
}
|
||||
else
|
||||
debug(D_CGROUP, "cpuacct.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "cpuacct.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
|
||||
if(unlikely(cgroup_enable_cpuacct_usage && !cg->cpuacct_usage.filename && !is_cgroup_systemd_service(cg))) {
|
||||
|
@ -2154,20 +2156,20 @@ static inline void discovery_update_filenames() {
|
|||
if(likely(stat(filename, &buf) != -1)) {
|
||||
cg->cpuacct_usage.filename = strdupz(filename);
|
||||
cg->cpuacct_usage.enabled = cgroup_enable_cpuacct_usage;
|
||||
debug(D_CGROUP, "cpuacct.usage_percpu filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_usage.filename);
|
||||
netdata_log_debug(D_CGROUP, "cpuacct.usage_percpu filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_usage.filename);
|
||||
}
|
||||
else
|
||||
debug(D_CGROUP, "cpuacct.usage_percpu file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "cpuacct.usage_percpu file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
if(unlikely(cgroup_enable_cpuacct_cpu_throttling && !cg->cpuacct_cpu_throttling.filename && !is_cgroup_systemd_service(cg))) {
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/cpu.stat", cgroup_cpuacct_base, cg->id);
|
||||
if(likely(stat(filename, &buf) != -1)) {
|
||||
cg->cpuacct_cpu_throttling.filename = strdupz(filename);
|
||||
cg->cpuacct_cpu_throttling.enabled = cgroup_enable_cpuacct_cpu_throttling;
|
||||
debug(D_CGROUP, "cpu.stat filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_cpu_throttling.filename);
|
||||
netdata_log_debug(D_CGROUP, "cpu.stat filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_cpu_throttling.filename);
|
||||
}
|
||||
else
|
||||
debug(D_CGROUP, "cpu.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "cpu.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
if (unlikely(
|
||||
cgroup_enable_cpuacct_cpu_shares && !cg->cpuacct_cpu_shares.filename &&
|
||||
|
@ -2176,10 +2178,10 @@ static inline void discovery_update_filenames() {
|
|||
if (likely(stat(filename, &buf) != -1)) {
|
||||
cg->cpuacct_cpu_shares.filename = strdupz(filename);
|
||||
cg->cpuacct_cpu_shares.enabled = cgroup_enable_cpuacct_cpu_shares;
|
||||
debug(
|
||||
netdata_log_debug(
|
||||
D_CGROUP, "cpu.shares filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_cpu_shares.filename);
|
||||
} else
|
||||
debug(D_CGROUP, "cpu.shares file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "cpu.shares file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
|
||||
if(unlikely((cgroup_enable_detailed_memory || cgroup_used_memory) && !cg->memory.filename_detailed && (cgroup_used_memory || cgroup_enable_systemd_services_detailed_memory || !is_cgroup_systemd_service(cg)))) {
|
||||
|
@ -2187,10 +2189,10 @@ static inline void discovery_update_filenames() {
|
|||
if(likely(stat(filename, &buf) != -1)) {
|
||||
cg->memory.filename_detailed = strdupz(filename);
|
||||
cg->memory.enabled_detailed = (cgroup_enable_detailed_memory == CONFIG_BOOLEAN_YES)?CONFIG_BOOLEAN_YES:CONFIG_BOOLEAN_AUTO;
|
||||
debug(D_CGROUP, "memory.stat filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_detailed);
|
||||
netdata_log_debug(D_CGROUP, "memory.stat filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_detailed);
|
||||
}
|
||||
else
|
||||
debug(D_CGROUP, "memory.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "memory.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
|
||||
if(unlikely(cgroup_enable_memory && !cg->memory.filename_usage_in_bytes)) {
|
||||
|
@ -2198,12 +2200,12 @@ static inline void discovery_update_filenames() {
|
|||
if(likely(stat(filename, &buf) != -1)) {
|
||||
cg->memory.filename_usage_in_bytes = strdupz(filename);
|
||||
cg->memory.enabled_usage_in_bytes = cgroup_enable_memory;
|
||||
debug(D_CGROUP, "memory.usage_in_bytes filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_usage_in_bytes);
|
||||
netdata_log_debug(D_CGROUP, "memory.usage_in_bytes filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_usage_in_bytes);
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/memory.limit_in_bytes", cgroup_memory_base, cg->id);
|
||||
cg->filename_memory_limit = strdupz(filename);
|
||||
}
|
||||
else
|
||||
debug(D_CGROUP, "memory.usage_in_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "memory.usage_in_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
|
||||
if(unlikely(cgroup_enable_swap && !cg->memory.filename_msw_usage_in_bytes)) {
|
||||
|
@ -2213,10 +2215,10 @@ static inline void discovery_update_filenames() {
|
|||
cg->memory.enabled_msw_usage_in_bytes = cgroup_enable_swap;
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/memory.memsw.limit_in_bytes", cgroup_memory_base, cg->id);
|
||||
cg->filename_memoryswap_limit = strdupz(filename);
|
||||
debug(D_CGROUP, "memory.msw_usage_in_bytes filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_msw_usage_in_bytes);
|
||||
netdata_log_debug(D_CGROUP, "memory.msw_usage_in_bytes filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_msw_usage_in_bytes);
|
||||
}
|
||||
else
|
||||
debug(D_CGROUP, "memory.msw_usage_in_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "memory.msw_usage_in_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
|
||||
if(unlikely(cgroup_enable_memory_failcnt && !cg->memory.filename_failcnt)) {
|
||||
|
@ -2224,10 +2226,10 @@ static inline void discovery_update_filenames() {
|
|||
if(likely(stat(filename, &buf) != -1)) {
|
||||
cg->memory.filename_failcnt = strdupz(filename);
|
||||
cg->memory.enabled_failcnt = cgroup_enable_memory_failcnt;
|
||||
debug(D_CGROUP, "memory.failcnt filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_failcnt);
|
||||
netdata_log_debug(D_CGROUP, "memory.failcnt filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_failcnt);
|
||||
}
|
||||
else
|
||||
debug(D_CGROUP, "memory.failcnt file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "memory.failcnt file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
|
||||
if(unlikely(cgroup_enable_blkio_io && !cg->io_service_bytes.filename)) {
|
||||
|
@ -2235,16 +2237,16 @@ static inline void discovery_update_filenames() {
|
|||
if (unlikely(stat(filename, &buf) != -1)) {
|
||||
cg->io_service_bytes.filename = strdupz(filename);
|
||||
cg->io_service_bytes.enabled = cgroup_enable_blkio_io;
|
||||
debug(D_CGROUP, "blkio.io_service_bytes_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_service_bytes_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "blkio.io_service_bytes_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_service_bytes_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/blkio.io_service_bytes", cgroup_blkio_base, cg->id);
|
||||
if (likely(stat(filename, &buf) != -1)) {
|
||||
cg->io_service_bytes.filename = strdupz(filename);
|
||||
cg->io_service_bytes.enabled = cgroup_enable_blkio_io;
|
||||
debug(D_CGROUP, "blkio.io_service_bytes filename for cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_service_bytes filename for cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "blkio.io_service_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_service_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2254,16 +2256,16 @@ static inline void discovery_update_filenames() {
|
|||
if (unlikely(stat(filename, &buf) != -1)) {
|
||||
cg->io_serviced.filename = strdupz(filename);
|
||||
cg->io_serviced.enabled = cgroup_enable_blkio_ops;
|
||||
debug(D_CGROUP, "blkio.io_serviced_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_serviced.filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_serviced_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_serviced.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "blkio.io_serviced_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_serviced_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/blkio.io_serviced", cgroup_blkio_base, cg->id);
|
||||
if (likely(stat(filename, &buf) != -1)) {
|
||||
cg->io_serviced.filename = strdupz(filename);
|
||||
cg->io_serviced.enabled = cgroup_enable_blkio_ops;
|
||||
debug(D_CGROUP, "blkio.io_serviced filename for cgroup '%s': '%s'", cg->id, cg->io_serviced.filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_serviced filename for cgroup '%s': '%s'", cg->id, cg->io_serviced.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "blkio.io_serviced file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_serviced file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2273,17 +2275,17 @@ static inline void discovery_update_filenames() {
|
|||
if (unlikely(stat(filename, &buf) != -1)) {
|
||||
cg->throttle_io_service_bytes.filename = strdupz(filename);
|
||||
cg->throttle_io_service_bytes.enabled = cgroup_enable_blkio_throttle_io;
|
||||
debug(D_CGROUP,"blkio.throttle.io_service_bytes_recursive filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_service_bytes.filename);
|
||||
netdata_log_debug(D_CGROUP,"blkio.throttle.io_service_bytes_recursive filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_service_bytes.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "blkio.throttle.io_service_bytes_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.throttle.io_service_bytes_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
snprintfz(
|
||||
filename, FILENAME_MAX, "%s%s/blkio.throttle.io_service_bytes", cgroup_blkio_base, cg->id);
|
||||
if (likely(stat(filename, &buf) != -1)) {
|
||||
cg->throttle_io_service_bytes.filename = strdupz(filename);
|
||||
cg->throttle_io_service_bytes.enabled = cgroup_enable_blkio_throttle_io;
|
||||
debug(D_CGROUP, "blkio.throttle.io_service_bytes filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_service_bytes.filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.throttle.io_service_bytes filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_service_bytes.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "blkio.throttle.io_service_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.throttle.io_service_bytes file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2293,16 +2295,16 @@ static inline void discovery_update_filenames() {
|
|||
if (unlikely(stat(filename, &buf) != -1)) {
|
||||
cg->throttle_io_serviced.filename = strdupz(filename);
|
||||
cg->throttle_io_serviced.enabled = cgroup_enable_blkio_throttle_ops;
|
||||
debug(D_CGROUP, "blkio.throttle.io_serviced_recursive filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_serviced.filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.throttle.io_serviced_recursive filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_serviced.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "blkio.throttle.io_serviced_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.throttle.io_serviced_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/blkio.throttle.io_serviced", cgroup_blkio_base, cg->id);
|
||||
if (likely(stat(filename, &buf) != -1)) {
|
||||
cg->throttle_io_serviced.filename = strdupz(filename);
|
||||
cg->throttle_io_serviced.enabled = cgroup_enable_blkio_throttle_ops;
|
||||
debug(D_CGROUP, "blkio.throttle.io_serviced filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_serviced.filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.throttle.io_serviced filename for cgroup '%s': '%s'", cg->id, cg->throttle_io_serviced.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "blkio.throttle.io_serviced file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.throttle.io_serviced file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2312,16 +2314,16 @@ static inline void discovery_update_filenames() {
|
|||
if (unlikely(stat(filename, &buf) != -1)) {
|
||||
cg->io_merged.filename = strdupz(filename);
|
||||
cg->io_merged.enabled = cgroup_enable_blkio_merged_ops;
|
||||
debug(D_CGROUP, "blkio.io_merged_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_merged.filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_merged_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_merged.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "blkio.io_merged_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_merged_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/blkio.io_merged", cgroup_blkio_base, cg->id);
|
||||
if (likely(stat(filename, &buf) != -1)) {
|
||||
cg->io_merged.filename = strdupz(filename);
|
||||
cg->io_merged.enabled = cgroup_enable_blkio_merged_ops;
|
||||
debug(D_CGROUP, "blkio.io_merged filename for cgroup '%s': '%s'", cg->id, cg->io_merged.filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_merged filename for cgroup '%s': '%s'", cg->id, cg->io_merged.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "blkio.io_merged file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_merged file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2331,16 +2333,16 @@ static inline void discovery_update_filenames() {
|
|||
if (unlikely(stat(filename, &buf) != -1)) {
|
||||
cg->io_queued.filename = strdupz(filename);
|
||||
cg->io_queued.enabled = cgroup_enable_blkio_queued_ops;
|
||||
debug(D_CGROUP, "blkio.io_queued_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_queued.filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_queued_recursive filename for cgroup '%s': '%s'", cg->id, cg->io_queued.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "blkio.io_queued_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_queued_recursive file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/blkio.io_queued", cgroup_blkio_base, cg->id);
|
||||
if (likely(stat(filename, &buf) != -1)) {
|
||||
cg->io_queued.filename = strdupz(filename);
|
||||
cg->io_queued.enabled = cgroup_enable_blkio_queued_ops;
|
||||
debug(D_CGROUP, "blkio.io_queued filename for cgroup '%s': '%s'", cg->id, cg->io_queued.filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_queued filename for cgroup '%s': '%s'", cg->id, cg->io_queued.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "blkio.io_queued file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "blkio.io_queued file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2351,18 +2353,18 @@ static inline void discovery_update_filenames() {
|
|||
if(likely(stat(filename, &buf) != -1)) {
|
||||
cg->io_service_bytes.filename = strdupz(filename);
|
||||
cg->io_service_bytes.enabled = cgroup_enable_blkio_io;
|
||||
debug(D_CGROUP, "io.stat filename for unified cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
|
||||
netdata_log_debug(D_CGROUP, "io.stat filename for unified cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
|
||||
} else
|
||||
debug(D_CGROUP, "io.stat file for unified cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "io.stat file for unified cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
if (unlikely(cgroup_enable_blkio_ops && !cg->io_serviced.filename)) {
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/io.stat", cgroup_unified_base, cg->id);
|
||||
if (likely(stat(filename, &buf) != -1)) {
|
||||
cg->io_serviced.filename = strdupz(filename);
|
||||
cg->io_serviced.enabled = cgroup_enable_blkio_ops;
|
||||
debug(D_CGROUP, "io.stat filename for unified cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
|
||||
netdata_log_debug(D_CGROUP, "io.stat filename for unified cgroup '%s': '%s'", cg->id, cg->io_service_bytes.filename);
|
||||
} else
|
||||
debug(D_CGROUP, "io.stat file for unified cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "io.stat file for unified cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
if (unlikely(
|
||||
(cgroup_enable_cpuacct_stat || cgroup_enable_cpuacct_cpu_throttling) &&
|
||||
|
@ -2376,19 +2378,19 @@ static inline void discovery_update_filenames() {
|
|||
cg->filename_cpu_cfs_period = NULL;
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/cpu.max", cgroup_unified_base, cg->id);
|
||||
cg->filename_cpu_cfs_quota = strdupz(filename);
|
||||
debug(D_CGROUP, "cpu.stat filename for unified cgroup '%s': '%s'", cg->id, cg->cpuacct_stat.filename);
|
||||
netdata_log_debug(D_CGROUP, "cpu.stat filename for unified cgroup '%s': '%s'", cg->id, cg->cpuacct_stat.filename);
|
||||
}
|
||||
else
|
||||
debug(D_CGROUP, "cpu.stat file for unified cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "cpu.stat file for unified cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
if (unlikely(cgroup_enable_cpuacct_cpu_shares && !cg->cpuacct_cpu_shares.filename)) {
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/cpu.weight", cgroup_unified_base, cg->id);
|
||||
if (likely(stat(filename, &buf) != -1)) {
|
||||
cg->cpuacct_cpu_shares.filename = strdupz(filename);
|
||||
cg->cpuacct_cpu_shares.enabled = cgroup_enable_cpuacct_cpu_shares;
|
||||
debug(D_CGROUP, "cpu.weight filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_cpu_shares.filename);
|
||||
netdata_log_debug(D_CGROUP, "cpu.weight filename for cgroup '%s': '%s'", cg->id, cg->cpuacct_cpu_shares.filename);
|
||||
} else
|
||||
debug(D_CGROUP, "cpu.weight file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "cpu.weight file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
|
||||
if(unlikely((cgroup_enable_detailed_memory || cgroup_used_memory) && !cg->memory.filename_detailed && (cgroup_used_memory || cgroup_enable_systemd_services_detailed_memory || !is_cgroup_systemd_service(cg)))) {
|
||||
|
@ -2396,10 +2398,10 @@ static inline void discovery_update_filenames() {
|
|||
if(likely(stat(filename, &buf) != -1)) {
|
||||
cg->memory.filename_detailed = strdupz(filename);
|
||||
cg->memory.enabled_detailed = (cgroup_enable_detailed_memory == CONFIG_BOOLEAN_YES)?CONFIG_BOOLEAN_YES:CONFIG_BOOLEAN_AUTO;
|
||||
debug(D_CGROUP, "memory.stat filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_detailed);
|
||||
netdata_log_debug(D_CGROUP, "memory.stat filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_detailed);
|
||||
}
|
||||
else
|
||||
debug(D_CGROUP, "memory.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "memory.stat file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
|
||||
if(unlikely(cgroup_enable_memory && !cg->memory.filename_usage_in_bytes)) {
|
||||
|
@ -2407,12 +2409,12 @@ static inline void discovery_update_filenames() {
|
|||
if(likely(stat(filename, &buf) != -1)) {
|
||||
cg->memory.filename_usage_in_bytes = strdupz(filename);
|
||||
cg->memory.enabled_usage_in_bytes = cgroup_enable_memory;
|
||||
debug(D_CGROUP, "memory.current filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_usage_in_bytes);
|
||||
netdata_log_debug(D_CGROUP, "memory.current filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_usage_in_bytes);
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/memory.max", cgroup_unified_base, cg->id);
|
||||
cg->filename_memory_limit = strdupz(filename);
|
||||
}
|
||||
else
|
||||
debug(D_CGROUP, "memory.current file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "memory.current file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
|
||||
if(unlikely(cgroup_enable_swap && !cg->memory.filename_msw_usage_in_bytes)) {
|
||||
|
@ -2422,10 +2424,10 @@ static inline void discovery_update_filenames() {
|
|||
cg->memory.enabled_msw_usage_in_bytes = cgroup_enable_swap;
|
||||
snprintfz(filename, FILENAME_MAX, "%s%s/memory.swap.max", cgroup_unified_base, cg->id);
|
||||
cg->filename_memoryswap_limit = strdupz(filename);
|
||||
debug(D_CGROUP, "memory.swap.current filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_msw_usage_in_bytes);
|
||||
netdata_log_debug(D_CGROUP, "memory.swap.current filename for cgroup '%s': '%s'", cg->id, cg->memory.filename_msw_usage_in_bytes);
|
||||
}
|
||||
else
|
||||
debug(D_CGROUP, "memory.swap file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "memory.swap file for cgroup '%s': '%s' does not exist.", cg->id, filename);
|
||||
}
|
||||
|
||||
if (unlikely(cgroup_enable_pressure_cpu && !cg->cpu_pressure.filename)) {
|
||||
|
@ -2434,9 +2436,9 @@ static inline void discovery_update_filenames() {
|
|||
cg->cpu_pressure.filename = strdupz(filename);
|
||||
cg->cpu_pressure.some.enabled = cgroup_enable_pressure_cpu;
|
||||
cg->cpu_pressure.full.enabled = CONFIG_BOOLEAN_NO;
|
||||
debug(D_CGROUP, "cpu.pressure filename for cgroup '%s': '%s'", cg->id, cg->cpu_pressure.filename);
|
||||
netdata_log_debug(D_CGROUP, "cpu.pressure filename for cgroup '%s': '%s'", cg->id, cg->cpu_pressure.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "cpu.pressure file for cgroup '%s': '%s' does not exist", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "cpu.pressure file for cgroup '%s': '%s' does not exist", cg->id, filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2446,9 +2448,9 @@ static inline void discovery_update_filenames() {
|
|||
cg->io_pressure.filename = strdupz(filename);
|
||||
cg->io_pressure.some.enabled = cgroup_enable_pressure_io_some;
|
||||
cg->io_pressure.full.enabled = cgroup_enable_pressure_io_full;
|
||||
debug(D_CGROUP, "io.pressure filename for cgroup '%s': '%s'", cg->id, cg->io_pressure.filename);
|
||||
netdata_log_debug(D_CGROUP, "io.pressure filename for cgroup '%s': '%s'", cg->id, cg->io_pressure.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "io.pressure file for cgroup '%s': '%s' does not exist", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "io.pressure file for cgroup '%s': '%s' does not exist", cg->id, filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2458,9 +2460,9 @@ static inline void discovery_update_filenames() {
|
|||
cg->memory_pressure.filename = strdupz(filename);
|
||||
cg->memory_pressure.some.enabled = cgroup_enable_pressure_memory_some;
|
||||
cg->memory_pressure.full.enabled = cgroup_enable_pressure_memory_full;
|
||||
debug(D_CGROUP, "memory.pressure filename for cgroup '%s': '%s'", cg->id, cg->memory_pressure.filename);
|
||||
netdata_log_debug(D_CGROUP, "memory.pressure filename for cgroup '%s': '%s'", cg->id, cg->memory_pressure.filename);
|
||||
} else {
|
||||
debug(D_CGROUP, "memory.pressure file for cgroup '%s': '%s' does not exist", cg->id, filename);
|
||||
netdata_log_debug(D_CGROUP, "memory.pressure file for cgroup '%s': '%s' does not exist", cg->id, filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2477,7 +2479,7 @@ static inline void discovery_cleanup_all_cgroups() {
|
|||
struct cgroup *t;
|
||||
for(t = discovered_cgroup_root; t ; t = t->discovered_next) {
|
||||
if(t != cg && t->available && !t->enabled && t->options & CGROUP_OPTIONS_DISABLED_DUPLICATE && t->hash_chart == cg->hash_chart && !strcmp(t->chart_id, cg->chart_id)) {
|
||||
debug(D_CGROUP, "Enabling duplicate of cgroup '%s' with id '%s', because the original with id '%s' stopped.", t->chart_id, t->id, cg->id);
|
||||
netdata_log_debug(D_CGROUP, "Enabling duplicate of cgroup '%s' with id '%s', because the original with id '%s' stopped.", t->chart_id, t->id, cg->id);
|
||||
t->enabled = 1;
|
||||
t->options &= ~CGROUP_OPTIONS_DISABLED_DUPLICATE;
|
||||
break;
|
||||
|
@ -2505,7 +2507,7 @@ static inline void discovery_cleanup_all_cgroups() {
|
|||
}
|
||||
|
||||
static inline void discovery_copy_discovered_cgroups_to_reader() {
|
||||
debug(D_CGROUP, "copy discovered cgroups to the main group list");
|
||||
netdata_log_debug(D_CGROUP, "copy discovered cgroups to the main group list");
|
||||
|
||||
struct cgroup *cg;
|
||||
|
||||
|
@ -2543,7 +2545,7 @@ static inline void discovery_share_cgroups_with_ebpf() {
|
|||
is_cgroup_procs_exist(ptr, cg->id);
|
||||
}
|
||||
|
||||
debug(D_CGROUP, "cgroup shared: NAME=%s, ENABLED=%d", ptr->name, ptr->enabled);
|
||||
netdata_log_debug(D_CGROUP, "cgroup shared: NAME=%s, ENABLED=%d", ptr->name, ptr->enabled);
|
||||
}
|
||||
|
||||
shm_cgroup_ebpf.header->cgroup_root_count = count;
|
||||
|
@ -2633,13 +2635,13 @@ static inline void discovery_process_first_time_seen_cgroup(struct cgroup *cg) {
|
|||
}
|
||||
|
||||
if (cgroup_enable_systemd_services && matches_systemd_services_cgroups(cg->id)) {
|
||||
debug(D_CGROUP, "cgroup '%s' (name '%s') matches 'cgroups to match as systemd services'", cg->id, cg->chart_title);
|
||||
netdata_log_debug(D_CGROUP, "cgroup '%s' (name '%s') matches 'cgroups to match as systemd services'", cg->id, cg->chart_title);
|
||||
convert_cgroup_to_systemd_service(cg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (matches_enabled_cgroup_renames(cg->id)) {
|
||||
debug(D_CGROUP, "cgroup '%s' (name '%s') matches 'run script to rename cgroups matching', will try to rename it", cg->id, cg->chart_title);
|
||||
netdata_log_debug(D_CGROUP, "cgroup '%s' (name '%s') matches 'run script to rename cgroups matching', will try to rename it", cg->id, cg->chart_title);
|
||||
if (is_inside_k8s && k8s_is_container(cg->id)) {
|
||||
// it may take up to a minute for the K8s API to return data for the container
|
||||
// tested on AWS K8s cluster with 100% CPU utilization
|
||||
|
@ -2664,7 +2666,7 @@ static int discovery_is_cgroup_duplicate(struct cgroup *cg) {
|
|||
|
||||
static inline void discovery_process_cgroup(struct cgroup *cg) {
|
||||
if (!cg) {
|
||||
debug(D_CGROUP, "discovery_process_cgroup() received NULL");
|
||||
netdata_log_debug(D_CGROUP, "discovery_process_cgroup() received NULL");
|
||||
return;
|
||||
}
|
||||
if (!cg->available || cg->processed) {
|
||||
|
@ -2700,12 +2702,12 @@ static inline void discovery_process_cgroup(struct cgroup *cg) {
|
|||
}
|
||||
|
||||
if (!(cg->enabled = matches_enabled_cgroup_names(cg->chart_title))) {
|
||||
debug(D_CGROUP, "cgroup '%s' (name '%s') disabled by 'enable by default cgroups names matching'", cg->id, cg->chart_title);
|
||||
netdata_log_debug(D_CGROUP, "cgroup '%s' (name '%s') disabled by 'enable by default cgroups names matching'", cg->id, cg->chart_title);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(cg->enabled = matches_enabled_cgroup_paths(cg->id))) {
|
||||
debug(D_CGROUP, "cgroup '%s' (name '%s') disabled by 'enable by default cgroups matching'", cg->id, cg->chart_title);
|
||||
netdata_log_debug(D_CGROUP, "cgroup '%s' (name '%s') disabled by 'enable by default cgroups matching'", cg->id, cg->chart_title);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2730,7 +2732,7 @@ static inline void discovery_process_cgroup(struct cgroup *cg) {
|
|||
}
|
||||
|
||||
static inline void discovery_find_all_cgroups() {
|
||||
debug(D_CGROUP, "searching for cgroups");
|
||||
netdata_log_debug(D_CGROUP, "searching for cgroups");
|
||||
|
||||
worker_is_busy(WORKER_DISCOVERY_INIT);
|
||||
discovery_mark_all_cgroups_as_unavailable();
|
||||
|
@ -2765,7 +2767,7 @@ static inline void discovery_find_all_cgroups() {
|
|||
worker_is_busy(WORKER_DISCOVERY_SHARE);
|
||||
discovery_share_cgroups_with_ebpf();
|
||||
|
||||
debug(D_CGROUP, "done searching for cgroups");
|
||||
netdata_log_debug(D_CGROUP, "done searching for cgroups");
|
||||
}
|
||||
|
||||
static void cgroup_discovery_cleanup(void *ptr) {
|
||||
|
@ -3587,7 +3589,7 @@ static inline void update_cpu_limits2(struct cgroup *cg) {
|
|||
} else {
|
||||
cg->cpu_cfs_quota = str2ull(procfile_lineword(ff, 0, 0), NULL);
|
||||
}
|
||||
debug(D_CGROUP, "CPU limits values: %llu %llu %llu", cg->cpu_cfs_period, cg->cpuset_cpus, cg->cpu_cfs_quota);
|
||||
netdata_log_debug(D_CGROUP, "CPU limits values: %llu %llu %llu", cg->cpu_cfs_period, cg->cpuset_cpus, cg->cpu_cfs_quota);
|
||||
return;
|
||||
|
||||
cpu_limits2_err:
|
||||
|
@ -3645,7 +3647,7 @@ static inline int update_memory_limits(char **filename, const RRDSETVAR_ACQUIRED
|
|||
}
|
||||
|
||||
void update_cgroup_charts(int update_every) {
|
||||
debug(D_CGROUP, "updating cgroups charts");
|
||||
netdata_log_debug(D_CGROUP, "updating cgroups charts");
|
||||
|
||||
char type[RRD_ID_LENGTH_MAX + 1];
|
||||
char title[CHART_TITLE_MAX + 1];
|
||||
|
@ -4754,7 +4756,7 @@ void update_cgroup_charts(int update_every) {
|
|||
, services_do_queued_ops, services_do_merged_ops
|
||||
);
|
||||
|
||||
debug(D_CGROUP, "done updating cgroups charts");
|
||||
netdata_log_debug(D_CGROUP, "done updating cgroups charts");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
@ -1541,8 +1541,7 @@ uint32_t ebpf_enable_tracepoints(ebpf_tracepoint_t *tps)
|
|||
uint32_t cnt = 0;
|
||||
for (int i = 0; tps[i].class != NULL; i++) {
|
||||
if (ebpf_enable_tracepoint(&tps[i]) == -1) {
|
||||
infoerr("failed to enable tracepoint %s:%s",
|
||||
tps[i].class, tps[i].event);
|
||||
netdata_log_error("Failed to enable tracepoint %s:%s", tps[i].class, tps[i].event);
|
||||
}
|
||||
else {
|
||||
cnt += 1;
|
||||
|
|
|
@ -121,7 +121,7 @@ void *freebsd_main(void *ptr)
|
|||
if (unlikely(!pm->enabled))
|
||||
continue;
|
||||
|
||||
debug(D_PROCNETDEV_LOOP, "FREEBSD calling %s.", pm->name);
|
||||
netdata_log_debug(D_PROCNETDEV_LOOP, "FREEBSD calling %s.", pm->name);
|
||||
|
||||
worker_is_busy(i);
|
||||
pm->enabled = !pm->func(localhost->rrd_update_every, hb_dt);
|
||||
|
|
|
@ -66,7 +66,7 @@ void *macos_main(void *ptr)
|
|||
if (unlikely(!pm->enabled))
|
||||
continue;
|
||||
|
||||
debug(D_PROCNETDEV_LOOP, "macos calling %s.", pm->name);
|
||||
netdata_log_debug(D_PROCNETDEV_LOOP, "macos calling %s.", pm->name);
|
||||
|
||||
worker_is_busy(i);
|
||||
pm->enabled = !pm->func(localhost->rrd_update_every, hb_dt);
|
||||
|
|
|
@ -245,7 +245,7 @@ void *pluginsd_main(void *ptr)
|
|||
if (unlikely(!service_running(SERVICE_COLLECTORS)))
|
||||
break;
|
||||
|
||||
debug(D_PLUGINSD, "examining file '%s'", file->d_name);
|
||||
netdata_log_debug(D_PLUGINSD, "examining file '%s'", file->d_name);
|
||||
|
||||
if (unlikely(strcmp(file->d_name, ".") == 0 || strcmp(file->d_name, "..") == 0))
|
||||
continue;
|
||||
|
@ -254,7 +254,7 @@ void *pluginsd_main(void *ptr)
|
|||
if (unlikely(len <= (int)PLUGINSD_FILE_SUFFIX_LEN))
|
||||
continue;
|
||||
if (unlikely(strcmp(PLUGINSD_FILE_SUFFIX, &file->d_name[len - (int)PLUGINSD_FILE_SUFFIX_LEN]) != 0)) {
|
||||
debug(D_PLUGINSD, "file '%s' does not end in '%s'", file->d_name, PLUGINSD_FILE_SUFFIX);
|
||||
netdata_log_debug(D_PLUGINSD, "file '%s' does not end in '%s'", file->d_name, PLUGINSD_FILE_SUFFIX);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ void *pluginsd_main(void *ptr)
|
|||
int enabled = config_get_boolean(CONFIG_SECTION_PLUGINS, pluginname, automatic_run);
|
||||
|
||||
if (unlikely(!enabled)) {
|
||||
debug(D_PLUGINSD, "plugin '%s' is not enabled", file->d_name);
|
||||
netdata_log_debug(D_PLUGINSD, "plugin '%s' is not enabled", file->d_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ void *pluginsd_main(void *ptr)
|
|||
break;
|
||||
|
||||
if (likely(cd && plugin_is_running(cd))) {
|
||||
debug(D_PLUGINSD, "plugin '%s' is already running", cd->filename);
|
||||
netdata_log_debug(D_PLUGINSD, "plugin '%s' is already running", cd->filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ static inline PARSER_RC pluginsd_set(char **words, size_t num_words, PARSER *par
|
|||
if(!rd) return PLUGINSD_DISABLE_PLUGIN(parser, NULL, NULL);
|
||||
|
||||
if (unlikely(rrdset_flag_check(st, RRDSET_FLAG_DEBUG)))
|
||||
debug(D_PLUGINSD, "PLUGINSD: 'host:%s/chart:%s/dim:%s' SET is setting value to '%s'",
|
||||
netdata_log_debug(D_PLUGINSD, "PLUGINSD: 'host:%s/chart:%s/dim:%s' SET is setting value to '%s'",
|
||||
rrdhost_hostname(host), rrdset_id(st), dimension, value && *value ? value : "UNSET");
|
||||
|
||||
if (value && *value)
|
||||
|
@ -303,7 +303,7 @@ static inline PARSER_RC pluginsd_end(char **words, size_t num_words, PARSER *par
|
|||
if(!st) return PLUGINSD_DISABLE_PLUGIN(parser, NULL, NULL);
|
||||
|
||||
if (unlikely(rrdset_flag_check(st, RRDSET_FLAG_DEBUG)))
|
||||
debug(D_PLUGINSD, "requested an END on chart '%s'", rrdset_id(st));
|
||||
netdata_log_debug(D_PLUGINSD, "requested an END on chart '%s'", rrdset_id(st));
|
||||
|
||||
pluginsd_set_chart_from_parent(parser, NULL, PLUGINSD_KEYWORD_END);
|
||||
parser->user.data_collections_count++;
|
||||
|
@ -517,7 +517,7 @@ static inline PARSER_RC pluginsd_chart(char **words, size_t num_words, PARSER *p
|
|||
if (unlikely(!units))
|
||||
units = "unknown";
|
||||
|
||||
debug(
|
||||
netdata_log_debug(
|
||||
D_PLUGINSD,
|
||||
"creating chart type='%s', id='%s', name='%s', family='%s', context='%s', chart='%s', priority=%d, update_every=%d",
|
||||
type, id, name ? name : "", family ? family : "", context ? context : "", rrdset_type_name(chart_type),
|
||||
|
@ -642,7 +642,7 @@ static inline PARSER_RC pluginsd_dimension(char **words, size_t num_words, PARSE
|
|||
algorithm = "absolute";
|
||||
|
||||
if (unlikely(st && rrdset_flag_check(st, RRDSET_FLAG_DEBUG)))
|
||||
debug(
|
||||
netdata_log_debug(
|
||||
D_PLUGINSD,
|
||||
"creating dimension in chart %s, id='%s', name='%s', algorithm='%s', multiplier=%ld, divisor=%ld, hidden='%s'",
|
||||
rrdset_id(st), id, name ? name : "", rrd_algorithm_name(rrd_algorithm_id(algorithm)), multiplier, divisor,
|
||||
|
@ -1013,7 +1013,7 @@ static inline PARSER_RC pluginsd_variable(char **words, size_t num_words, PARSER
|
|||
}
|
||||
|
||||
static inline PARSER_RC pluginsd_flush(char **words __maybe_unused, size_t num_words __maybe_unused, PARSER *parser) {
|
||||
debug(D_PLUGINSD, "requested a " PLUGINSD_KEYWORD_FLUSH);
|
||||
netdata_log_debug(D_PLUGINSD, "requested a " PLUGINSD_KEYWORD_FLUSH);
|
||||
pluginsd_set_chart_from_parent(parser, NULL, PLUGINSD_KEYWORD_FLUSH);
|
||||
parser->user.replay.start_time = 0;
|
||||
parser->user.replay.end_time = 0;
|
||||
|
@ -1078,7 +1078,7 @@ static inline PARSER_RC pluginsd_overwrite(char **words __maybe_unused, size_t n
|
|||
RRDHOST *host = pluginsd_require_host_from_parent(parser, PLUGINSD_KEYWORD_OVERWRITE);
|
||||
if(!host) return PLUGINSD_DISABLE_PLUGIN(parser, NULL, NULL);
|
||||
|
||||
debug(D_PLUGINSD, "requested to OVERWRITE host labels");
|
||||
netdata_log_debug(D_PLUGINSD, "requested to OVERWRITE host labels");
|
||||
|
||||
if(unlikely(!host->rrdlabels))
|
||||
host->rrdlabels = rrdlabels_create();
|
||||
|
@ -1119,7 +1119,7 @@ static inline PARSER_RC pluginsd_clabel_commit(char **words __maybe_unused, size
|
|||
RRDSET *st = pluginsd_require_chart_from_parent(parser, PLUGINSD_KEYWORD_CLABEL_COMMIT, PLUGINSD_KEYWORD_BEGIN);
|
||||
if(!st) return PLUGINSD_DISABLE_PLUGIN(parser, NULL, NULL);
|
||||
|
||||
debug(D_PLUGINSD, "requested to commit chart labels");
|
||||
netdata_log_debug(D_PLUGINSD, "requested to commit chart labels");
|
||||
|
||||
if(!parser->user.chart_rrdlabels_linked_temporarily) {
|
||||
netdata_log_error("PLUGINSD: 'host:%s' got CLABEL_COMMIT, without a CHART or BEGIN. Ignoring it.", rrdhost_hostname(host));
|
||||
|
|
|
@ -139,7 +139,7 @@ void *proc_main(void *ptr)
|
|||
|
||||
if (config_get_boolean("plugin:proc", "/proc/net/dev", CONFIG_BOOLEAN_YES)) {
|
||||
netdev_thread = mallocz(sizeof(netdata_thread_t));
|
||||
debug(D_SYSTEM, "Starting thread %s.", THREAD_NETDEV_NAME);
|
||||
netdata_log_debug(D_SYSTEM, "Starting thread %s.", THREAD_NETDEV_NAME);
|
||||
netdata_thread_create(
|
||||
netdev_thread, THREAD_NETDEV_NAME, NETDATA_THREAD_OPTION_JOINABLE, netdev_main, netdev_thread);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ void *proc_main(void *ptr)
|
|||
if (unlikely(!pm->enabled))
|
||||
continue;
|
||||
|
||||
debug(D_PROCNETDEV_LOOP, "PROC calling %s.", pm->name);
|
||||
netdata_log_debug(D_PROCNETDEV_LOOP, "PROC calling %s.", pm->name);
|
||||
|
||||
worker_is_busy(i);
|
||||
pm->enabled = !pm->func(localhost->rrd_update_every, hb_dt);
|
||||
|
|
|
@ -370,7 +370,7 @@ static void dictionary_metric_insert_callback(const DICTIONARY_ITEM *item, void
|
|||
STATSD_METRIC *m = (STATSD_METRIC *)value;
|
||||
const char *name = dictionary_acquired_item_name(item);
|
||||
|
||||
debug(D_STATSD, "Creating new %s metric '%s'", index->name, name);
|
||||
netdata_log_debug(D_STATSD, "Creating new %s metric '%s'", index->name, name);
|
||||
|
||||
m->name = name;
|
||||
m->hash = simple_hash(name);
|
||||
|
@ -401,7 +401,7 @@ static void dictionary_metric_delete_callback(const DICTIONARY_ITEM *item, void
|
|||
}
|
||||
|
||||
static inline STATSD_METRIC *statsd_find_or_add_metric(STATSD_INDEX *index, const char *name) {
|
||||
debug(D_STATSD, "searching for metric '%s' under '%s'", name, index->name);
|
||||
netdata_log_debug(D_STATSD, "searching for metric '%s' under '%s'", name, index->name);
|
||||
|
||||
#ifdef STATSD_MULTITHREADED
|
||||
// avoid the write lock of dictionary_set() for existing metrics
|
||||
|
@ -673,7 +673,7 @@ static inline const char *statsd_parse_field_trim(const char *start, char *end)
|
|||
}
|
||||
|
||||
static void statsd_process_metric(const char *name, const char *value, const char *type, const char *sampling, const char *tags) {
|
||||
debug(D_STATSD, "STATSD: raw metric '%s', value '%s', type '%s', sampling '%s', tags '%s'", name?name:"(null)", value?value:"(null)", type?type:"(null)", sampling?sampling:"(null)", tags?tags:"(null)");
|
||||
netdata_log_debug(D_STATSD, "STATSD: raw metric '%s', value '%s', type '%s', sampling '%s', tags '%s'", name?name:"(null)", value?value:"(null)", type?type:"(null)", sampling?sampling:"(null)", tags?tags:"(null)");
|
||||
|
||||
if(unlikely(!name || !*name)) return;
|
||||
if(unlikely(!type || !*type)) type = "m";
|
||||
|
@ -768,7 +768,7 @@ static void statsd_process_metric(const char *name, const char *value, const cha
|
|||
|
||||
static inline size_t statsd_process(char *buffer, size_t size, int require_newlines) {
|
||||
buffer[size] = '\0';
|
||||
debug(D_STATSD, "RECEIVED: %zu bytes: '%s'", size, buffer);
|
||||
netdata_log_debug(D_STATSD, "RECEIVED: %zu bytes: '%s'", size, buffer);
|
||||
|
||||
const char *s = buffer;
|
||||
while(*s) {
|
||||
|
@ -949,7 +949,7 @@ static int statsd_rcv_callback(POLLINFO *pi, short int *events) {
|
|||
}
|
||||
else if (!rc) {
|
||||
// connection closed
|
||||
debug(D_STATSD, "STATSD: client disconnected.");
|
||||
netdata_log_debug(D_STATSD, "STATSD: client disconnected.");
|
||||
ret = -1;
|
||||
}
|
||||
else {
|
||||
|
@ -1231,14 +1231,14 @@ static STATSD_APP_CHART_DIM *add_dimension_to_app_chart(
|
|||
}
|
||||
chart->dimensions_count++;
|
||||
|
||||
debug(D_STATSD, "Added dimension '%s' to chart '%s' of app '%s', for metric '%s', with type %u, multiplier %d, divisor %d",
|
||||
netdata_log_debug(D_STATSD, "Added dimension '%s' to chart '%s' of app '%s', for metric '%s', with type %u, multiplier %d, divisor %d",
|
||||
dim->name, chart->id, app->name, dim->metric, dim->value_type, dim->multiplier, dim->divisor);
|
||||
|
||||
return dim;
|
||||
}
|
||||
|
||||
static int statsd_readfile(const char *filename, STATSD_APP *app, STATSD_APP_CHART *chart, DICTIONARY *dict) {
|
||||
debug(D_STATSD, "STATSD configuration reading file '%s'", filename);
|
||||
netdata_log_debug(D_STATSD, "STATSD configuration reading file '%s'", filename);
|
||||
|
||||
char *buffer = mallocz(STATSD_CONF_LINE_MAX + 1);
|
||||
|
||||
|
@ -1257,11 +1257,11 @@ static int statsd_readfile(const char *filename, STATSD_APP *app, STATSD_APP_CHA
|
|||
|
||||
s = trim(buffer);
|
||||
if (!s || *s == '#') {
|
||||
debug(D_STATSD, "STATSD: ignoring line %zu of file '%s', it is empty.", line, filename);
|
||||
netdata_log_debug(D_STATSD, "STATSD: ignoring line %zu of file '%s', it is empty.", line, filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
debug(D_STATSD, "STATSD: processing line %zu of file '%s': %s", line, filename, buffer);
|
||||
netdata_log_debug(D_STATSD, "STATSD: processing line %zu of file '%s': %s", line, filename, buffer);
|
||||
|
||||
if(*s == 'i' && strncmp(s, "include", 7) == 0) {
|
||||
s = trim(&s[7]);
|
||||
|
@ -1375,7 +1375,7 @@ static int statsd_readfile(const char *filename, STATSD_APP *app, STATSD_APP_CHA
|
|||
continue;
|
||||
}
|
||||
if(!value) {
|
||||
debug(D_CONFIG, "STATSD: ignoring line %zu of file '%s', value is empty.", line, filename);
|
||||
netdata_log_debug(D_CONFIG, "STATSD: ignoring line %zu of file '%s', value is empty.", line, filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1625,7 +1625,7 @@ static inline RRDSET *statsd_private_rrdset_create(
|
|||
}
|
||||
|
||||
static inline void statsd_private_chart_gauge(STATSD_METRIC *m) {
|
||||
debug(D_STATSD, "updating private chart for gauge metric '%s'", m->name);
|
||||
netdata_log_debug(D_STATSD, "updating private chart for gauge metric '%s'", m->name);
|
||||
|
||||
if(unlikely(!m->st || m->options & STATSD_METRIC_OPTION_UPDATED_CHART_METADATA)) {
|
||||
m->options &= ~STATSD_METRIC_OPTION_UPDATED_CHART_METADATA;
|
||||
|
@ -1665,7 +1665,7 @@ static inline void statsd_private_chart_gauge(STATSD_METRIC *m) {
|
|||
}
|
||||
|
||||
static inline void statsd_private_chart_counter_or_meter(STATSD_METRIC *m, const char *dim, const char *family) {
|
||||
debug(D_STATSD, "updating private chart for %s metric '%s'", dim, m->name);
|
||||
netdata_log_debug(D_STATSD, "updating private chart for %s metric '%s'", dim, m->name);
|
||||
|
||||
if(unlikely(!m->st || m->options & STATSD_METRIC_OPTION_UPDATED_CHART_METADATA)) {
|
||||
m->options &= ~STATSD_METRIC_OPTION_UPDATED_CHART_METADATA;
|
||||
|
@ -1705,7 +1705,7 @@ static inline void statsd_private_chart_counter_or_meter(STATSD_METRIC *m, const
|
|||
}
|
||||
|
||||
static inline void statsd_private_chart_set(STATSD_METRIC *m) {
|
||||
debug(D_STATSD, "updating private chart for set metric '%s'", m->name);
|
||||
netdata_log_debug(D_STATSD, "updating private chart for set metric '%s'", m->name);
|
||||
|
||||
if(unlikely(!m->st || m->options & STATSD_METRIC_OPTION_UPDATED_CHART_METADATA)) {
|
||||
m->options &= ~STATSD_METRIC_OPTION_UPDATED_CHART_METADATA;
|
||||
|
@ -1745,7 +1745,7 @@ static inline void statsd_private_chart_set(STATSD_METRIC *m) {
|
|||
}
|
||||
|
||||
static inline void statsd_private_chart_dictionary(STATSD_METRIC *m) {
|
||||
debug(D_STATSD, "updating private chart for dictionary metric '%s'", m->name);
|
||||
netdata_log_debug(D_STATSD, "updating private chart for dictionary metric '%s'", m->name);
|
||||
|
||||
if(unlikely(!m->st || m->options & STATSD_METRIC_OPTION_UPDATED_CHART_METADATA)) {
|
||||
m->options &= ~STATSD_METRIC_OPTION_UPDATED_CHART_METADATA;
|
||||
|
@ -1788,7 +1788,7 @@ static inline void statsd_private_chart_dictionary(STATSD_METRIC *m) {
|
|||
}
|
||||
|
||||
static inline void statsd_private_chart_timer_or_histogram(STATSD_METRIC *m, const char *dim, const char *family, const char *units) {
|
||||
debug(D_STATSD, "updating private chart for %s metric '%s'", dim, m->name);
|
||||
netdata_log_debug(D_STATSD, "updating private chart for %s metric '%s'", dim, m->name);
|
||||
|
||||
if(unlikely(!m->st || m->options & STATSD_METRIC_OPTION_UPDATED_CHART_METADATA)) {
|
||||
m->options &= ~STATSD_METRIC_OPTION_UPDATED_CHART_METADATA;
|
||||
|
@ -1843,7 +1843,7 @@ static inline void statsd_private_chart_timer_or_histogram(STATSD_METRIC *m, con
|
|||
// statsd flush metrics
|
||||
|
||||
static inline void statsd_flush_gauge(STATSD_METRIC *m) {
|
||||
debug(D_STATSD, "flushing gauge metric '%s'", m->name);
|
||||
netdata_log_debug(D_STATSD, "flushing gauge metric '%s'", m->name);
|
||||
|
||||
int updated = 0;
|
||||
if(unlikely(!m->reset && m->count)) {
|
||||
|
@ -1858,7 +1858,7 @@ static inline void statsd_flush_gauge(STATSD_METRIC *m) {
|
|||
}
|
||||
|
||||
static inline void statsd_flush_counter_or_meter(STATSD_METRIC *m, const char *dim, const char *family) {
|
||||
debug(D_STATSD, "flushing %s metric '%s'", dim, m->name);
|
||||
netdata_log_debug(D_STATSD, "flushing %s metric '%s'", dim, m->name);
|
||||
|
||||
int updated = 0;
|
||||
if(unlikely(!m->reset && m->count)) {
|
||||
|
@ -1881,7 +1881,7 @@ static inline void statsd_flush_meter(STATSD_METRIC *m) {
|
|||
}
|
||||
|
||||
static inline void statsd_flush_set(STATSD_METRIC *m) {
|
||||
debug(D_STATSD, "flushing set metric '%s'", m->name);
|
||||
netdata_log_debug(D_STATSD, "flushing set metric '%s'", m->name);
|
||||
|
||||
int updated = 0;
|
||||
if(unlikely(!m->reset && m->count)) {
|
||||
|
@ -1899,7 +1899,7 @@ static inline void statsd_flush_set(STATSD_METRIC *m) {
|
|||
}
|
||||
|
||||
static inline void statsd_flush_dictionary(STATSD_METRIC *m) {
|
||||
debug(D_STATSD, "flushing dictionary metric '%s'", m->name);
|
||||
netdata_log_debug(D_STATSD, "flushing dictionary metric '%s'", m->name);
|
||||
|
||||
int updated = 0;
|
||||
if(unlikely(!m->reset && m->count)) {
|
||||
|
@ -1927,7 +1927,7 @@ static inline void statsd_flush_dictionary(STATSD_METRIC *m) {
|
|||
}
|
||||
|
||||
static inline void statsd_flush_timer_or_histogram(STATSD_METRIC *m, const char *dim, const char *family, const char *units) {
|
||||
debug(D_STATSD, "flushing %s metric '%s'", dim, m->name);
|
||||
netdata_log_debug(D_STATSD, "flushing %s metric '%s'", dim, m->name);
|
||||
|
||||
int updated = 0;
|
||||
if(unlikely(!m->reset && m->count && m->histogram.ext->used > 0)) {
|
||||
|
@ -1952,7 +1952,7 @@ static inline void statsd_flush_timer_or_histogram(STATSD_METRIC *m, const char
|
|||
|
||||
netdata_mutex_unlock(&m->histogram.ext->mutex);
|
||||
|
||||
debug(D_STATSD, "STATSD %s metric %s: min " COLLECTED_NUMBER_FORMAT ", max " COLLECTED_NUMBER_FORMAT ", last " COLLECTED_NUMBER_FORMAT ", pcent " COLLECTED_NUMBER_FORMAT ", median " COLLECTED_NUMBER_FORMAT ", stddev " COLLECTED_NUMBER_FORMAT ", sum " COLLECTED_NUMBER_FORMAT,
|
||||
netdata_log_debug(D_STATSD, "STATSD %s metric %s: min " COLLECTED_NUMBER_FORMAT ", max " COLLECTED_NUMBER_FORMAT ", last " COLLECTED_NUMBER_FORMAT ", pcent " COLLECTED_NUMBER_FORMAT ", median " COLLECTED_NUMBER_FORMAT ", stddev " COLLECTED_NUMBER_FORMAT ", sum " COLLECTED_NUMBER_FORMAT,
|
||||
dim, m->name, m->histogram.ext->last_min, m->histogram.ext->last_max, m->last, m->histogram.ext->last_percentile, m->histogram.ext->last_median, m->histogram.ext->last_stddev, m->histogram.ext->last_sum);
|
||||
|
||||
m->histogram.ext->zeroed = 0;
|
||||
|
@ -2066,7 +2066,7 @@ static inline void link_metric_to_app_dimension(STATSD_APP *app, STATSD_METRIC *
|
|||
|
||||
chart->dimensions_linked_count++;
|
||||
m->options |= STATSD_METRIC_OPTION_USED_IN_APPS;
|
||||
debug(D_STATSD, "metric '%s' of type %u linked with app '%s', chart '%s', dimension '%s', algorithm '%s'", m->name, m->type, app->name, chart->id, dim->name, rrd_algorithm_name(dim->algorithm));
|
||||
netdata_log_debug(D_STATSD, "metric '%s' of type %u linked with app '%s', chart '%s', dimension '%s', algorithm '%s'", m->name, m->type, app->name, chart->id, dim->name, rrd_algorithm_name(dim->algorithm));
|
||||
}
|
||||
|
||||
static inline void check_if_metric_is_for_app(STATSD_INDEX *index, STATSD_METRIC *m) {
|
||||
|
@ -2075,7 +2075,7 @@ static inline void check_if_metric_is_for_app(STATSD_INDEX *index, STATSD_METRIC
|
|||
STATSD_APP *app;
|
||||
for(app = statsd.apps; app ;app = app->next) {
|
||||
if(unlikely(simple_pattern_matches(app->metrics, m->name))) {
|
||||
debug(D_STATSD, "metric '%s' matches app '%s'", m->name, app->name);
|
||||
netdata_log_debug(D_STATSD, "metric '%s' matches app '%s'", m->name, app->name);
|
||||
|
||||
// the metric should get the options from the app
|
||||
|
||||
|
@ -2200,7 +2200,7 @@ static inline RRDDIM *statsd_add_dim_to_app_chart(STATSD_APP *app, STATSD_APP_CH
|
|||
}
|
||||
|
||||
static inline void statsd_update_app_chart(STATSD_APP *app, STATSD_APP_CHART *chart) {
|
||||
debug(D_STATSD, "updating chart '%s' for app '%s'", chart->id, app->name);
|
||||
netdata_log_debug(D_STATSD, "updating chart '%s' for app '%s'", chart->id, app->name);
|
||||
|
||||
if(!chart->st) {
|
||||
chart->st = rrdset_create_custom(
|
||||
|
@ -2232,22 +2232,22 @@ static inline void statsd_update_app_chart(STATSD_APP *app, STATSD_APP_CHART *ch
|
|||
statsd_add_dim_to_app_chart(app, chart, dim);
|
||||
|
||||
if (unlikely(dim->value_ptr)) {
|
||||
debug(D_STATSD, "updating dimension '%s' (%s) of chart '%s' (%s) for app '%s' with value " COLLECTED_NUMBER_FORMAT, dim->name, rrddim_id(dim->rd), chart->id, rrdset_id(chart->st), app->name, *dim->value_ptr);
|
||||
netdata_log_debug(D_STATSD, "updating dimension '%s' (%s) of chart '%s' (%s) for app '%s' with value " COLLECTED_NUMBER_FORMAT, dim->name, rrddim_id(dim->rd), chart->id, rrdset_id(chart->st), app->name, *dim->value_ptr);
|
||||
rrddim_set_by_pointer(chart->st, dim->rd, *dim->value_ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rrdset_done(chart->st);
|
||||
debug(D_STATSD, "completed update of chart '%s' for app '%s'", chart->id, app->name);
|
||||
netdata_log_debug(D_STATSD, "completed update of chart '%s' for app '%s'", chart->id, app->name);
|
||||
}
|
||||
|
||||
static inline void statsd_update_all_app_charts(void) {
|
||||
// debug(D_STATSD, "updating app charts");
|
||||
// netdata_log_debug(D_STATSD, "updating app charts");
|
||||
|
||||
STATSD_APP *app;
|
||||
for(app = statsd.apps; app ;app = app->next) {
|
||||
// debug(D_STATSD, "updating charts for app '%s'", app->name);
|
||||
// netdata_log_debug(D_STATSD, "updating charts for app '%s'", app->name);
|
||||
|
||||
STATSD_APP_CHART *chart;
|
||||
for(chart = app->charts; chart ;chart = chart->next) {
|
||||
|
@ -2257,7 +2257,7 @@ static inline void statsd_update_all_app_charts(void) {
|
|||
}
|
||||
}
|
||||
|
||||
// debug(D_STATSD, "completed update of app charts");
|
||||
// netdata_log_debug(D_STATSD, "completed update of app charts");
|
||||
}
|
||||
|
||||
const char *statsd_metric_type_string(STATSD_METRIC_TYPE type) {
|
||||
|
@ -2290,7 +2290,7 @@ static inline void statsd_flush_index_metrics(STATSD_INDEX *index, void (*flush_
|
|||
|
||||
if(unlikely(!(m->options & STATSD_METRIC_OPTION_PRIVATE_CHART_CHECKED))) {
|
||||
if(unlikely(statsd.private_charts >= statsd.max_private_charts_hard)) {
|
||||
debug(D_STATSD, "STATSD: metric '%s' will not be charted, because the hard limit of the maximum number "
|
||||
netdata_log_debug(D_STATSD, "STATSD: metric '%s' will not be charted, because the hard limit of the maximum number "
|
||||
"of charts has been reached.", m->name);
|
||||
|
||||
collector_info("STATSD: metric '%s' will not be charted, because the hard limit of the maximum number "
|
||||
|
@ -2301,10 +2301,10 @@ static inline void statsd_flush_index_metrics(STATSD_INDEX *index, void (*flush_
|
|||
}
|
||||
else {
|
||||
if (simple_pattern_matches(statsd.charts_for, m->name)) {
|
||||
debug(D_STATSD, "STATSD: metric '%s' will be charted.", m->name);
|
||||
netdata_log_debug(D_STATSD, "STATSD: metric '%s' will be charted.", m->name);
|
||||
m->options |= STATSD_METRIC_OPTION_PRIVATE_CHART_ENABLED;
|
||||
} else {
|
||||
debug(D_STATSD, "STATSD: metric '%s' will not be charted.", m->name);
|
||||
netdata_log_debug(D_STATSD, "STATSD: metric '%s' will not be charted.", m->name);
|
||||
m->options &= ~STATSD_METRIC_OPTION_PRIVATE_CHART_ENABLED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ static inline struct tc_device *tc_device_index_find(const char *id) {
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
static inline void tc_class_free(struct tc_device *n, struct tc_class *c) {
|
||||
debug(D_TC_LOOP, "Removing from device '%s' class '%s', parentid '%s', leafid '%s', unused=%d",
|
||||
netdata_log_debug(D_TC_LOOP, "Removing from device '%s' class '%s', parentid '%s', leafid '%s', unused=%d",
|
||||
string2str(n->id), string2str(c->id), string2str(c->parentid), string2str(c->leafid),
|
||||
c->unupdated);
|
||||
|
||||
|
@ -271,7 +271,7 @@ static inline void tc_device_commit(struct tc_device *d) {
|
|||
dfe_done(c);
|
||||
|
||||
if(unlikely(!d->enabled || (!updated_classes && !updated_qdiscs))) {
|
||||
debug(D_TC_LOOP, "TC: Ignoring TC device '%s'. It is not enabled/updated.", string2str(d->name?d->name:d->id));
|
||||
netdata_log_debug(D_TC_LOOP, "TC: Ignoring TC device '%s'. It is not enabled/updated.", string2str(d->name?d->name:d->id));
|
||||
tc_device_classes_cleanup(d);
|
||||
return;
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ static inline void tc_device_commit(struct tc_device *d) {
|
|||
if(unlikely(!c->updated))
|
||||
continue;
|
||||
|
||||
//debug(D_TC_LOOP, "TC: In device '%s', %s '%s' has leafid: '%s' and parentid '%s'.",
|
||||
//netdata_log_debug(D_TC_LOOP, "TC: In device '%s', %s '%s' has leafid: '%s' and parentid '%s'.",
|
||||
// d->id,
|
||||
// c->isqdisc?"qdisc":"class",
|
||||
// c->id,
|
||||
|
@ -326,7 +326,7 @@ static inline void tc_device_commit(struct tc_device *d) {
|
|||
|
||||
if((x->parentid && c->id == x->parentid) ||
|
||||
(c->leafid && x->parentid && c->leafid == x->parentid)) {
|
||||
// debug(D_TC_LOOP, "TC: In device '%s', %s '%s' (leafid: '%s') has as leaf %s '%s' (parentid: '%s').", d->name?d->name:d->id, c->isqdisc?"qdisc":"class", c->name?c->name:c->id, c->leafid?c->leafid:c->id, x->isqdisc?"qdisc":"class", x->name?x->name:x->id, x->parentid?x->parentid:x->id);
|
||||
// netdata_log_debug(D_TC_LOOP, "TC: In device '%s', %s '%s' (leafid: '%s') has as leaf %s '%s' (parentid: '%s').", d->name?d->name:d->id, c->isqdisc?"qdisc":"class", c->name?c->name:c->id, c->leafid?c->leafid:c->id, x->isqdisc?"qdisc":"class", x->name?x->name:x->id, x->parentid?x->parentid:x->id);
|
||||
c->isleaf = false;
|
||||
x->hasparent = true;
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ static inline void tc_device_commit(struct tc_device *d) {
|
|||
if(unlikely(!c->updated))
|
||||
continue;
|
||||
|
||||
// debug(D_TC_LOOP, "TC: device '%s', %s '%s' isleaf=%d, hasparent=%d", d->id, (c->isqdisc)?"qdisc":"class", c->id, c->isleaf, c->hasparent);
|
||||
// netdata_log_debug(D_TC_LOOP, "TC: device '%s', %s '%s' isleaf=%d, hasparent=%d", d->id, (c->isqdisc)?"qdisc":"class", c->id, c->isleaf, c->hasparent);
|
||||
|
||||
if(unlikely((c->isleaf && c->hasparent) || d->enabled_all_classes_qdiscs)) {
|
||||
c->render = true;
|
||||
|
@ -355,7 +355,7 @@ static inline void tc_device_commit(struct tc_device *d) {
|
|||
//if(unlikely(!c->hasparent)) {
|
||||
// if(root) collector_error("TC: multiple root class/qdisc for device '%s' (old: '%s', new: '%s')", d->id, root->id, c->id);
|
||||
// root = c;
|
||||
// debug(D_TC_LOOP, "TC: found root class/qdisc '%s'", root->id);
|
||||
// netdata_log_debug(D_TC_LOOP, "TC: found root class/qdisc '%s'", root->id);
|
||||
//}
|
||||
}
|
||||
dfe_done(c);
|
||||
|
@ -365,8 +365,8 @@ static inline void tc_device_commit(struct tc_device *d) {
|
|||
|
||||
if(unlikely(debug_flags & D_TC_LOOP)) {
|
||||
dfe_start_read(d->classes, c) {
|
||||
if(c->render) debug(D_TC_LOOP, "TC: final nodes dump for '%s': class %s, OK", string2str(d->name), string2str(c->id));
|
||||
else debug(D_TC_LOOP, "TC: final nodes dump for '%s': class '%s', IGNORE (updated: %d, isleaf: %d, hasparent: %d, parent: '%s')",
|
||||
if(c->render) netdata_log_debug(D_TC_LOOP, "TC: final nodes dump for '%s': class %s, OK", string2str(d->name), string2str(c->id));
|
||||
else netdata_log_debug(D_TC_LOOP, "TC: final nodes dump for '%s': class '%s', IGNORE (updated: %d, isleaf: %d, hasparent: %d, parent: '%s')",
|
||||
string2str(d->name?d->name:d->id), string2str(c->id), c->updated, c->isleaf, c->hasparent, string2str(c->parentid));
|
||||
}
|
||||
dfe_done(c);
|
||||
|
@ -374,12 +374,12 @@ static inline void tc_device_commit(struct tc_device *d) {
|
|||
#endif
|
||||
|
||||
if(unlikely(!active_nodes)) {
|
||||
debug(D_TC_LOOP, "TC: Ignoring TC device '%s'. No useful classes/qdiscs.", string2str(d->name?d->name:d->id));
|
||||
netdata_log_debug(D_TC_LOOP, "TC: Ignoring TC device '%s'. No useful classes/qdiscs.", string2str(d->name?d->name:d->id));
|
||||
tc_device_classes_cleanup(d);
|
||||
return;
|
||||
}
|
||||
|
||||
debug(D_TC_LOOP, "TC: evaluating TC device '%s'. enabled = %d/%d (bytes: %d/%d, packets: %d/%d, dropped: %d/%d, tokens: %d/%d, ctokens: %d/%d, all_classes_qdiscs: %d/%d), classes: (bytes = %llu, packets = %llu, dropped = %llu, tokens = %llu, ctokens = %llu).",
|
||||
netdata_log_debug(D_TC_LOOP, "TC: evaluating TC device '%s'. enabled = %d/%d (bytes: %d/%d, packets: %d/%d, dropped: %d/%d, tokens: %d/%d, ctokens: %d/%d, all_classes_qdiscs: %d/%d), classes: (bytes = %llu, packets = %llu, dropped = %llu, tokens = %llu, ctokens = %llu).",
|
||||
string2str(d->name?d->name:d->id),
|
||||
d->enabled, enable_new_interfaces,
|
||||
d->enabled_bytes, enable_bytes,
|
||||
|
@ -676,7 +676,7 @@ static inline void tc_device_commit(struct tc_device *d) {
|
|||
rrdlabels_add(d->st_ctokens->rrdlabels, "device_group", string2str(d->family?d->family:d->id), RRDLABEL_SRC_AUTO);
|
||||
}
|
||||
else {
|
||||
debug(D_TC_LOOP, "TC: Updating _ctokens chart for device '%s'", string2str(d->name?d->name:d->id));
|
||||
netdata_log_debug(D_TC_LOOP, "TC: Updating _ctokens chart for device '%s'", string2str(d->name?d->name:d->id));
|
||||
|
||||
if(unlikely(d->name_updated)) {
|
||||
char name[RRD_ID_LENGTH_MAX + 1];
|
||||
|
@ -724,7 +724,7 @@ static inline void tc_device_set_class_name(struct tc_device *d, char *id, char
|
|||
}
|
||||
|
||||
if(likely(name && *name && strcmp(string2str(c->id), name) != 0)) {
|
||||
debug(D_TC_LOOP, "TC: Setting device '%s', class '%s' name to '%s'", string2str(d->id), id, name);
|
||||
netdata_log_debug(D_TC_LOOP, "TC: Setting device '%s', class '%s' name to '%s'", string2str(d->id), id, name);
|
||||
c->name = string_strdupz(name);
|
||||
c->name_updated = true;
|
||||
}
|
||||
|
@ -741,7 +741,7 @@ static inline void tc_device_set_device_name(struct tc_device *d, char *name) {
|
|||
}
|
||||
|
||||
if(likely(name && *name && strcmp(string2str(d->id), name) != 0)) {
|
||||
debug(D_TC_LOOP, "TC: Setting device '%s' name to '%s'", string2str(d->id), name);
|
||||
netdata_log_debug(D_TC_LOOP, "TC: Setting device '%s' name to '%s'", string2str(d->id), name);
|
||||
d->name = string_strdupz(name);
|
||||
d->name_updated = true;
|
||||
}
|
||||
|
@ -752,7 +752,7 @@ static inline void tc_device_set_device_family(struct tc_device *d, char *family
|
|||
d->family = NULL;
|
||||
|
||||
if(likely(family && *family && strcmp(string2str(d->id), family) != 0)) {
|
||||
debug(D_TC_LOOP, "TC: Setting device '%s' family to '%s'", string2str(d->id), family);
|
||||
netdata_log_debug(D_TC_LOOP, "TC: Setting device '%s' family to '%s'", string2str(d->id), family);
|
||||
d->family = string_strdupz(family);
|
||||
d->family_updated = true;
|
||||
}
|
||||
|
@ -763,7 +763,7 @@ static inline struct tc_device *tc_device_create(char *id) {
|
|||
struct tc_device *d = tc_device_index_find(id);
|
||||
|
||||
if(!d) {
|
||||
debug(D_TC_LOOP, "TC: Creating device '%s'", id);
|
||||
netdata_log_debug(D_TC_LOOP, "TC: Creating device '%s'", id);
|
||||
|
||||
struct tc_device tmp = {
|
||||
.id = string_strdupz(id),
|
||||
|
@ -779,7 +779,7 @@ static inline struct tc_class *tc_class_add(struct tc_device *n, char *id, bool
|
|||
struct tc_class *c = tc_class_index_find(n, id);
|
||||
|
||||
if(!c) {
|
||||
debug(D_TC_LOOP, "TC: Creating in device '%s', class id '%s', parentid '%s', leafid '%s'",
|
||||
netdata_log_debug(D_TC_LOOP, "TC: Creating in device '%s', class id '%s', parentid '%s', leafid '%s'",
|
||||
string2str(n->id), id, parentid?parentid:"", leafid?leafid:"");
|
||||
|
||||
struct tc_class tmp = {
|
||||
|
@ -936,7 +936,7 @@ void *tc_main(void *ptr) {
|
|||
struct tc_class *class = NULL;
|
||||
|
||||
snprintfz(command, TC_LINE_MAX, "exec %s %d", tc_script, localhost->rrd_update_every);
|
||||
debug(D_TC_LOOP, "executing '%s'", command);
|
||||
netdata_log_debug(D_TC_LOOP, "executing '%s'", command);
|
||||
|
||||
fp_child_output = netdata_popen(command, (pid_t *)&tc_child_pid, &fp_child_input);
|
||||
if(unlikely(!fp_child_output)) {
|
||||
|
@ -949,23 +949,23 @@ void *tc_main(void *ptr) {
|
|||
if(unlikely(!service_running(SERVICE_COLLECTORS))) break;
|
||||
|
||||
buffer[TC_LINE_MAX] = '\0';
|
||||
// debug(D_TC_LOOP, "TC: read '%s'", buffer);
|
||||
// netdata_log_debug(D_TC_LOOP, "TC: read '%s'", buffer);
|
||||
|
||||
tc_split_words(buffer, words, PLUGINSD_MAX_WORDS);
|
||||
|
||||
if(unlikely(!words[0] || !*words[0])) {
|
||||
// debug(D_TC_LOOP, "empty line");
|
||||
// netdata_log_debug(D_TC_LOOP, "empty line");
|
||||
worker_is_idle();
|
||||
continue;
|
||||
}
|
||||
// else debug(D_TC_LOOP, "First word is '%s'", words[0]);
|
||||
// else netdata_log_debug(D_TC_LOOP, "First word is '%s'", words[0]);
|
||||
|
||||
first_hash = simple_hash(words[0]);
|
||||
|
||||
if(unlikely(device && ((first_hash == CLASS_HASH && strcmp(words[0], "class") == 0) || (first_hash == QDISC_HASH && strcmp(words[0], "qdisc") == 0)))) {
|
||||
worker_is_busy(WORKER_TC_CLASS);
|
||||
|
||||
// debug(D_TC_LOOP, "CLASS line on class id='%s', parent='%s', parentid='%s', leaf='%s', leafid='%s'", words[2], words[3], words[4], words[5], words[6]);
|
||||
// netdata_log_debug(D_TC_LOOP, "CLASS line on class id='%s', parent='%s', parentid='%s', leaf='%s', leafid='%s'", words[2], words[3], words[4], words[5], words[6]);
|
||||
|
||||
char *type = words[1]; // the class/qdisc type: htb, fq_codel, etc
|
||||
char *id = words[2]; // the class/qdisc major:minor
|
||||
|
@ -1033,7 +1033,7 @@ void *tc_main(void *ptr) {
|
|||
else if(unlikely(first_hash == END_HASH && strcmp(words[0], "END") == 0)) {
|
||||
worker_is_busy(WORKER_TC_END);
|
||||
|
||||
// debug(D_TC_LOOP, "END line");
|
||||
// netdata_log_debug(D_TC_LOOP, "END line");
|
||||
|
||||
if(likely(device)) {
|
||||
netdata_thread_disable_cancelability();
|
||||
|
@ -1048,7 +1048,7 @@ void *tc_main(void *ptr) {
|
|||
else if(unlikely(first_hash == BEGIN_HASH && strcmp(words[0], "BEGIN") == 0)) {
|
||||
worker_is_busy(WORKER_TC_BEGIN);
|
||||
|
||||
// debug(D_TC_LOOP, "BEGIN line on device '%s'", words[1]);
|
||||
// netdata_log_debug(D_TC_LOOP, "BEGIN line on device '%s'", words[1]);
|
||||
|
||||
if(likely(words[1] && *words[1])) {
|
||||
device = tc_device_create(words[1]);
|
||||
|
@ -1063,7 +1063,7 @@ void *tc_main(void *ptr) {
|
|||
else if(unlikely(device && class && first_hash == SENT_HASH && strcmp(words[0], "Sent") == 0)) {
|
||||
worker_is_busy(WORKER_TC_SENT);
|
||||
|
||||
// debug(D_TC_LOOP, "SENT line '%s'", words[1]);
|
||||
// netdata_log_debug(D_TC_LOOP, "SENT line '%s'", words[1]);
|
||||
if(likely(words[1] && *words[1])) {
|
||||
class->bytes = str2ull(words[1], NULL);
|
||||
class->updated = true;
|
||||
|
@ -1087,7 +1087,7 @@ void *tc_main(void *ptr) {
|
|||
else if(unlikely(device && class && class->updated && first_hash == LENDED_HASH && strcmp(words[0], "lended:") == 0)) {
|
||||
worker_is_busy(WORKER_TC_LENDED);
|
||||
|
||||
// debug(D_TC_LOOP, "LENDED line '%s'", words[1]);
|
||||
// netdata_log_debug(D_TC_LOOP, "LENDED line '%s'", words[1]);
|
||||
//if(likely(words[1] && *words[1]))
|
||||
// class->lended = str2ull(words[1]);
|
||||
|
||||
|
@ -1100,7 +1100,7 @@ void *tc_main(void *ptr) {
|
|||
else if(unlikely(device && class && class->updated && first_hash == TOKENS_HASH && strcmp(words[0], "tokens:") == 0)) {
|
||||
worker_is_busy(WORKER_TC_TOKENS);
|
||||
|
||||
// debug(D_TC_LOOP, "TOKENS line '%s'", words[1]);
|
||||
// netdata_log_debug(D_TC_LOOP, "TOKENS line '%s'", words[1]);
|
||||
if(likely(words[1] && *words[1]))
|
||||
class->tokens = str2ull(words[1], NULL);
|
||||
|
||||
|
@ -1110,21 +1110,21 @@ void *tc_main(void *ptr) {
|
|||
else if(unlikely(device && first_hash == SETDEVICENAME_HASH && strcmp(words[0], "SETDEVICENAME") == 0)) {
|
||||
worker_is_busy(WORKER_TC_SETDEVICENAME);
|
||||
|
||||
// debug(D_TC_LOOP, "SETDEVICENAME line '%s'", words[1]);
|
||||
// netdata_log_debug(D_TC_LOOP, "SETDEVICENAME line '%s'", words[1]);
|
||||
if(likely(words[1] && *words[1]))
|
||||
tc_device_set_device_name(device, words[1]);
|
||||
}
|
||||
else if(unlikely(device && first_hash == SETDEVICEGROUP_HASH && strcmp(words[0], "SETDEVICEGROUP") == 0)) {
|
||||
worker_is_busy(WORKER_TC_SETDEVICEGROUP);
|
||||
|
||||
// debug(D_TC_LOOP, "SETDEVICEGROUP line '%s'", words[1]);
|
||||
// netdata_log_debug(D_TC_LOOP, "SETDEVICEGROUP line '%s'", words[1]);
|
||||
if(likely(words[1] && *words[1]))
|
||||
tc_device_set_device_family(device, words[1]);
|
||||
}
|
||||
else if(unlikely(device && first_hash == SETCLASSNAME_HASH && strcmp(words[0], "SETCLASSNAME") == 0)) {
|
||||
worker_is_busy(WORKER_TC_SETCLASSNAME);
|
||||
|
||||
// debug(D_TC_LOOP, "SETCLASSNAME line '%s' '%s'", words[1], words[2]);
|
||||
// netdata_log_debug(D_TC_LOOP, "SETCLASSNAME line '%s' '%s'", words[1], words[2]);
|
||||
char *id = words[1];
|
||||
char *path = words[2];
|
||||
if(likely(id && *id && path && *path))
|
||||
|
@ -1147,7 +1147,7 @@ void *tc_main(void *ptr) {
|
|||
worker_set_metric(WORKER_TC_CLASSES, number_of_classes);
|
||||
}
|
||||
//else {
|
||||
// debug(D_TC_LOOP, "IGNORED line");
|
||||
// netdata_log_debug(D_TC_LOOP, "IGNORED line");
|
||||
//}
|
||||
|
||||
worker_is_idle();
|
||||
|
|
|
@ -24,45 +24,45 @@ struct array_printer {
|
|||
*/
|
||||
void analytics_log_data(void)
|
||||
{
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_STREAM_ENABLED : [%s]", analytics_data.netdata_config_stream_enabled);
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_MEMORY_MODE : [%s]", analytics_data.netdata_config_memory_mode);
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_EXPORTING_ENABLED : [%s]", analytics_data.netdata_config_exporting_enabled);
|
||||
debug(D_ANALYTICS, "NETDATA_EXPORTING_CONNECTORS : [%s]", analytics_data.netdata_exporting_connectors);
|
||||
debug(D_ANALYTICS, "NETDATA_ALLMETRICS_PROMETHEUS_USED : [%s]", analytics_data.netdata_allmetrics_prometheus_used);
|
||||
debug(D_ANALYTICS, "NETDATA_ALLMETRICS_SHELL_USED : [%s]", analytics_data.netdata_allmetrics_shell_used);
|
||||
debug(D_ANALYTICS, "NETDATA_ALLMETRICS_JSON_USED : [%s]", analytics_data.netdata_allmetrics_json_used);
|
||||
debug(D_ANALYTICS, "NETDATA_DASHBOARD_USED : [%s]", analytics_data.netdata_dashboard_used);
|
||||
debug(D_ANALYTICS, "NETDATA_COLLECTORS : [%s]", analytics_data.netdata_collectors);
|
||||
debug(D_ANALYTICS, "NETDATA_COLLECTORS_COUNT : [%s]", analytics_data.netdata_collectors_count);
|
||||
debug(D_ANALYTICS, "NETDATA_BUILDINFO : [%s]", analytics_data.netdata_buildinfo);
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_PAGE_CACHE_SIZE : [%s]", analytics_data.netdata_config_page_cache_size);
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_MULTIDB_DISK_QUOTA : [%s]", analytics_data.netdata_config_multidb_disk_quota);
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_HTTPS_ENABLED : [%s]", analytics_data.netdata_config_https_enabled);
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_WEB_ENABLED : [%s]", analytics_data.netdata_config_web_enabled);
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_RELEASE_CHANNEL : [%s]", analytics_data.netdata_config_release_channel);
|
||||
debug(D_ANALYTICS, "NETDATA_MIRRORED_HOST_COUNT : [%s]", analytics_data.netdata_mirrored_host_count);
|
||||
debug(D_ANALYTICS, "NETDATA_MIRRORED_HOSTS_REACHABLE : [%s]", analytics_data.netdata_mirrored_hosts_reachable);
|
||||
debug(D_ANALYTICS, "NETDATA_MIRRORED_HOSTS_UNREACHABLE : [%s]", analytics_data.netdata_mirrored_hosts_unreachable);
|
||||
debug(D_ANALYTICS, "NETDATA_NOTIFICATION_METHODS : [%s]", analytics_data.netdata_notification_methods);
|
||||
debug(D_ANALYTICS, "NETDATA_ALARMS_NORMAL : [%s]", analytics_data.netdata_alarms_normal);
|
||||
debug(D_ANALYTICS, "NETDATA_ALARMS_WARNING : [%s]", analytics_data.netdata_alarms_warning);
|
||||
debug(D_ANALYTICS, "NETDATA_ALARMS_CRITICAL : [%s]", analytics_data.netdata_alarms_critical);
|
||||
debug(D_ANALYTICS, "NETDATA_CHARTS_COUNT : [%s]", analytics_data.netdata_charts_count);
|
||||
debug(D_ANALYTICS, "NETDATA_METRICS_COUNT : [%s]", analytics_data.netdata_metrics_count);
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_IS_PARENT : [%s]", analytics_data.netdata_config_is_parent);
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_HOSTS_AVAILABLE : [%s]", analytics_data.netdata_config_hosts_available);
|
||||
debug(D_ANALYTICS, "NETDATA_HOST_CLOUD_AVAILABLE : [%s]", analytics_data.netdata_host_cloud_available);
|
||||
debug(D_ANALYTICS, "NETDATA_HOST_ACLK_AVAILABLE : [%s]", analytics_data.netdata_host_aclk_available);
|
||||
debug(D_ANALYTICS, "NETDATA_HOST_ACLK_PROTOCOL : [%s]", analytics_data.netdata_host_aclk_protocol);
|
||||
debug(D_ANALYTICS, "NETDATA_HOST_ACLK_IMPLEMENTATION : [%s]", analytics_data.netdata_host_aclk_implementation);
|
||||
debug(D_ANALYTICS, "NETDATA_HOST_AGENT_CLAIMED : [%s]", analytics_data.netdata_host_agent_claimed);
|
||||
debug(D_ANALYTICS, "NETDATA_HOST_CLOUD_ENABLED : [%s]", analytics_data.netdata_host_cloud_enabled);
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_HTTPS_AVAILABLE : [%s]", analytics_data.netdata_config_https_available);
|
||||
debug(D_ANALYTICS, "NETDATA_INSTALL_TYPE : [%s]", analytics_data.netdata_install_type);
|
||||
debug(D_ANALYTICS, "NETDATA_PREBUILT_DISTRO : [%s]", analytics_data.netdata_prebuilt_distro);
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_IS_PRIVATE_REGISTRY : [%s]", analytics_data.netdata_config_is_private_registry);
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_USE_PRIVATE_REGISTRY: [%s]", analytics_data.netdata_config_use_private_registry);
|
||||
debug(D_ANALYTICS, "NETDATA_CONFIG_OOM_SCORE : [%s]", analytics_data.netdata_config_oom_score);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_STREAM_ENABLED : [%s]", analytics_data.netdata_config_stream_enabled);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_MEMORY_MODE : [%s]", analytics_data.netdata_config_memory_mode);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_EXPORTING_ENABLED : [%s]", analytics_data.netdata_config_exporting_enabled);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_EXPORTING_CONNECTORS : [%s]", analytics_data.netdata_exporting_connectors);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_ALLMETRICS_PROMETHEUS_USED : [%s]", analytics_data.netdata_allmetrics_prometheus_used);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_ALLMETRICS_SHELL_USED : [%s]", analytics_data.netdata_allmetrics_shell_used);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_ALLMETRICS_JSON_USED : [%s]", analytics_data.netdata_allmetrics_json_used);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_DASHBOARD_USED : [%s]", analytics_data.netdata_dashboard_used);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_COLLECTORS : [%s]", analytics_data.netdata_collectors);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_COLLECTORS_COUNT : [%s]", analytics_data.netdata_collectors_count);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_BUILDINFO : [%s]", analytics_data.netdata_buildinfo);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_PAGE_CACHE_SIZE : [%s]", analytics_data.netdata_config_page_cache_size);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_MULTIDB_DISK_QUOTA : [%s]", analytics_data.netdata_config_multidb_disk_quota);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_HTTPS_ENABLED : [%s]", analytics_data.netdata_config_https_enabled);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_WEB_ENABLED : [%s]", analytics_data.netdata_config_web_enabled);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_RELEASE_CHANNEL : [%s]", analytics_data.netdata_config_release_channel);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_MIRRORED_HOST_COUNT : [%s]", analytics_data.netdata_mirrored_host_count);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_MIRRORED_HOSTS_REACHABLE : [%s]", analytics_data.netdata_mirrored_hosts_reachable);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_MIRRORED_HOSTS_UNREACHABLE : [%s]", analytics_data.netdata_mirrored_hosts_unreachable);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_NOTIFICATION_METHODS : [%s]", analytics_data.netdata_notification_methods);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_ALARMS_NORMAL : [%s]", analytics_data.netdata_alarms_normal);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_ALARMS_WARNING : [%s]", analytics_data.netdata_alarms_warning);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_ALARMS_CRITICAL : [%s]", analytics_data.netdata_alarms_critical);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CHARTS_COUNT : [%s]", analytics_data.netdata_charts_count);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_METRICS_COUNT : [%s]", analytics_data.netdata_metrics_count);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_IS_PARENT : [%s]", analytics_data.netdata_config_is_parent);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_HOSTS_AVAILABLE : [%s]", analytics_data.netdata_config_hosts_available);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_HOST_CLOUD_AVAILABLE : [%s]", analytics_data.netdata_host_cloud_available);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_HOST_ACLK_AVAILABLE : [%s]", analytics_data.netdata_host_aclk_available);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_HOST_ACLK_PROTOCOL : [%s]", analytics_data.netdata_host_aclk_protocol);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_HOST_ACLK_IMPLEMENTATION : [%s]", analytics_data.netdata_host_aclk_implementation);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_HOST_AGENT_CLAIMED : [%s]", analytics_data.netdata_host_agent_claimed);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_HOST_CLOUD_ENABLED : [%s]", analytics_data.netdata_host_cloud_enabled);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_HTTPS_AVAILABLE : [%s]", analytics_data.netdata_config_https_available);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_INSTALL_TYPE : [%s]", analytics_data.netdata_install_type);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_PREBUILT_DISTRO : [%s]", analytics_data.netdata_prebuilt_distro);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_IS_PRIVATE_REGISTRY : [%s]", analytics_data.netdata_config_is_private_registry);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_USE_PRIVATE_REGISTRY: [%s]", analytics_data.netdata_config_use_private_registry);
|
||||
netdata_log_debug(D_ANALYTICS, "NETDATA_CONFIG_OOM_SCORE : [%s]", analytics_data.netdata_config_oom_score);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -323,7 +323,7 @@ void analytics_alarms_notifications(void)
|
|||
|
||||
pid_t command_pid;
|
||||
|
||||
debug(D_ANALYTICS, "Executing %s", script);
|
||||
netdata_log_debug(D_ANALYTICS, "Executing %s", script);
|
||||
|
||||
BUFFER *b = buffer_create(1000, NULL);
|
||||
int cnt = 0;
|
||||
|
@ -561,7 +561,7 @@ void analytics_main_cleanup(void *ptr)
|
|||
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
|
||||
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
|
||||
|
||||
debug(D_ANALYTICS, "Cleaning up...");
|
||||
netdata_log_debug(D_ANALYTICS, "Cleaning up...");
|
||||
analytics_free_data();
|
||||
|
||||
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
|
||||
|
@ -581,7 +581,7 @@ void *analytics_main(void *ptr)
|
|||
heartbeat_init(&hb);
|
||||
usec_t step_ut = USEC_PER_SEC;
|
||||
|
||||
debug(D_ANALYTICS, "Analytics thread starts");
|
||||
netdata_log_debug(D_ANALYTICS, "Analytics thread starts");
|
||||
|
||||
//first delay after agent start
|
||||
while (service_running(SERVICE_ANALYTICS) && likely(sec <= ANALYTICS_INIT_SLEEP_SEC)) {
|
||||
|
|
|
@ -286,7 +286,8 @@ static void process_nice_level(void) {
|
|||
int nice_level = (int)config_get_number(CONFIG_SECTION_GLOBAL, "process nice level", 19);
|
||||
if(nice(nice_level) == -1)
|
||||
netdata_log_error("Cannot set netdata CPU nice level to %d.", nice_level);
|
||||
else debug(D_SYSTEM, "Set netdata nice level to %d.", nice_level);
|
||||
else
|
||||
netdata_log_debug(D_SYSTEM, "Set netdata nice level to %d.", nice_level);
|
||||
#endif // HAVE_NICE
|
||||
};
|
||||
|
||||
|
@ -521,7 +522,8 @@ int become_daemon(int dont_fork, const char *user)
|
|||
if(become_user(user, pidfd) != 0) {
|
||||
netdata_log_error("Cannot become user '%s'. Continuing as we are.", user);
|
||||
}
|
||||
else debug(D_SYSTEM, "Successfully became user '%s'.", user);
|
||||
else
|
||||
netdata_log_debug(D_SYSTEM, "Successfully became user '%s'.", user);
|
||||
}
|
||||
else {
|
||||
prepare_required_directories(getuid(), getgid());
|
||||
|
|
|
@ -611,7 +611,7 @@ void web_server_config_options(void)
|
|||
// killpid kills pid with SIGTERM.
|
||||
int killpid(pid_t pid) {
|
||||
int ret;
|
||||
debug(D_EXIT, "Request to kill pid %d", pid);
|
||||
netdata_log_debug(D_EXIT, "Request to kill pid %d", pid);
|
||||
|
||||
errno = 0;
|
||||
ret = kill(pid, SIGTERM);
|
||||
|
@ -1060,7 +1060,7 @@ static void get_netdata_configured_variables() {
|
|||
}
|
||||
|
||||
netdata_configured_hostname = config_get(CONFIG_SECTION_GLOBAL, "hostname", buf);
|
||||
debug(D_OPTIONS, "hostname set to '%s'", netdata_configured_hostname);
|
||||
netdata_log_debug(D_OPTIONS, "hostname set to '%s'", netdata_configured_hostname);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// get default database update frequency
|
||||
|
@ -1390,7 +1390,7 @@ int main(int argc, char **argv) {
|
|||
return 1;
|
||||
}
|
||||
else {
|
||||
debug(D_OPTIONS, "Configuration loaded from %s.", optarg);
|
||||
netdata_log_debug(D_OPTIONS, "Configuration loaded from %s.", optarg);
|
||||
load_cloud_conf(1);
|
||||
config_loaded = 1;
|
||||
}
|
||||
|
@ -1876,7 +1876,7 @@ int main(int argc, char **argv) {
|
|||
setenv("NETDATA_DEBUG_FLAGS", flags, 1);
|
||||
|
||||
debug_flags = strtoull(flags, NULL, 0);
|
||||
debug(D_OPTIONS, "Debug flags set to '0x%" PRIX64 "'.", debug_flags);
|
||||
netdata_log_debug(D_OPTIONS, "Debug flags set to '0x%" PRIX64 "'.", debug_flags);
|
||||
|
||||
if(debug_flags != 0) {
|
||||
struct rlimit rl = { RLIM_INFINITY, RLIM_INFINITY };
|
||||
|
@ -2089,10 +2089,11 @@ int main(int argc, char **argv) {
|
|||
|
||||
if(st->enabled) {
|
||||
st->thread = mallocz(sizeof(netdata_thread_t));
|
||||
debug(D_SYSTEM, "Starting thread %s.", st->name);
|
||||
netdata_log_debug(D_SYSTEM, "Starting thread %s.", st->name);
|
||||
netdata_thread_create(st->thread, st->name, NETDATA_THREAD_OPTION_DEFAULT, st->start_routine, st);
|
||||
}
|
||||
else debug(D_SYSTEM, "Not starting thread %s.", st->name);
|
||||
else
|
||||
netdata_log_debug(D_SYSTEM, "Not starting thread %s.", st->name);
|
||||
}
|
||||
ml_start_threads();
|
||||
|
||||
|
@ -2122,7 +2123,7 @@ int main(int argc, char **argv) {
|
|||
struct netdata_static_thread *st = &static_threads[i];
|
||||
st->thread = mallocz(sizeof(netdata_thread_t));
|
||||
st->enabled = 1;
|
||||
debug(D_SYSTEM, "Starting thread %s.", st->name);
|
||||
netdata_log_debug(D_SYSTEM, "Starting thread %s.", st->name);
|
||||
netdata_thread_create(st->thread, st->name, NETDATA_THREAD_OPTION_DEFAULT, st->start_routine, st);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ static void service_main_cleanup(void *ptr)
|
|||
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
|
||||
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
|
||||
|
||||
debug(D_SYSTEM, "Cleaning up...");
|
||||
netdata_log_debug(D_SYSTEM, "Cleaning up...");
|
||||
worker_unregister();
|
||||
|
||||
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
|
||||
|
@ -290,7 +290,7 @@ void *service_main(void *ptr)
|
|||
heartbeat_init(&hb);
|
||||
usec_t step = USEC_PER_SEC * SERVICE_HEARTBEAT;
|
||||
|
||||
debug(D_SYSTEM, "Service thread starts");
|
||||
netdata_log_debug(D_SYSTEM, "Service thread starts");
|
||||
|
||||
while (service_running(SERVICE_MAINTENANCE)) {
|
||||
worker_is_idle();
|
||||
|
|
|
@ -125,7 +125,7 @@ static void reap_child(pid_t pid) {
|
|||
siginfo_t i;
|
||||
|
||||
errno = 0;
|
||||
debug(D_CHILDS, "SIGNAL: reap_child(%d)...", pid);
|
||||
netdata_log_debug(D_CHILDS, "SIGNAL: reap_child(%d)...", pid);
|
||||
if (netdata_waitid(P_PID, (id_t)pid, &i, WEXITED|WNOHANG) == -1) {
|
||||
if (errno != ECHILD)
|
||||
netdata_log_error("SIGNAL: waitid(%d): failed to wait for child", pid);
|
||||
|
|
|
@ -9,12 +9,12 @@ static void after_extent_write_journalfile_v1_io(uv_fs_t* req)
|
|||
struct generic_io_descriptor *io_descr = &wal->io_descr;
|
||||
struct rrdengine_instance *ctx = io_descr->ctx;
|
||||
|
||||
debug(D_RRDENGINE, "%s: Journal block was written to disk.", __func__);
|
||||
netdata_log_debug(D_RRDENGINE, "%s: Journal block was written to disk.", __func__);
|
||||
if (req->result < 0) {
|
||||
ctx_io_error(ctx);
|
||||
netdata_log_error("DBENGINE: %s: uv_fs_write: %s", __func__, uv_strerror((int)req->result));
|
||||
} else {
|
||||
debug(D_RRDENGINE, "%s: Journal block was written to disk.", __func__);
|
||||
netdata_log_debug(D_RRDENGINE, "%s: Journal block was written to disk.", __func__);
|
||||
}
|
||||
|
||||
uv_fs_req_cleanup(req);
|
||||
|
@ -740,7 +740,7 @@ static unsigned journalfile_replay_transaction(struct rrdengine_instance *ctx, s
|
|||
*id = 0;
|
||||
jf_header = buf;
|
||||
if (STORE_PADDING == jf_header->type) {
|
||||
debug(D_RRDENGINE, "Skipping padding.");
|
||||
netdata_log_debug(D_RRDENGINE, "Skipping padding.");
|
||||
return 0;
|
||||
}
|
||||
if (sizeof(*jf_header) > max_size) {
|
||||
|
@ -758,14 +758,14 @@ static unsigned journalfile_replay_transaction(struct rrdengine_instance *ctx, s
|
|||
crc = crc32(0L, Z_NULL, 0);
|
||||
crc = crc32(crc, buf, sizeof(*jf_header) + payload_length);
|
||||
ret = crc32cmp(jf_trailer->checksum, crc);
|
||||
debug(D_RRDENGINE, "Transaction %"PRIu64" was read from disk. CRC32 check: %s", *id, ret ? "FAILED" : "SUCCEEDED");
|
||||
netdata_log_debug(D_RRDENGINE, "Transaction %"PRIu64" was read from disk. CRC32 check: %s", *id, ret ? "FAILED" : "SUCCEEDED");
|
||||
if (unlikely(ret)) {
|
||||
netdata_log_error("DBENGINE: transaction %"PRIu64" was read from disk. CRC32 check: FAILED", *id);
|
||||
return size_bytes;
|
||||
}
|
||||
switch (jf_header->type) {
|
||||
case STORE_DATA:
|
||||
debug(D_RRDENGINE, "Replaying transaction %"PRIu64"", jf_header->id);
|
||||
netdata_log_debug(D_RRDENGINE, "Replaying transaction %"PRIu64"", jf_header->id);
|
||||
journalfile_restore_extent_metadata(ctx, journalfile, buf + sizeof(*jf_header), payload_length);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1457,7 +1457,7 @@ void async_cb(uv_async_t *handle)
|
|||
{
|
||||
uv_stop(handle->loop);
|
||||
uv_update_time(handle->loop);
|
||||
debug(D_RRDENGINE, "%s called, active=%d.", __func__, uv_is_active((uv_handle_t *)handle));
|
||||
netdata_log_debug(D_RRDENGINE, "%s called, active=%d.", __func__, uv_is_active((uv_handle_t *)handle));
|
||||
}
|
||||
|
||||
#define TIMER_PERIOD_MS (1000)
|
||||
|
|
|
@ -206,7 +206,7 @@ RRDCALC *rrdcalc_acquired_to_rrdcalc(const RRDCALC_ACQUIRED *rca) {
|
|||
static void rrdcalc_link_to_rrdset(RRDSET *st, RRDCALC *rc) {
|
||||
RRDHOST *host = st->rrdhost;
|
||||
|
||||
debug(D_HEALTH, "Health linking alarm '%s.%s' to chart '%s' of host '%s'", rrdcalc_chart_name(rc), rrdcalc_name(rc), rrdset_id(st), rrdhost_hostname(host));
|
||||
netdata_log_debug(D_HEALTH, "Health linking alarm '%s.%s' to chart '%s' of host '%s'", rrdcalc_chart_name(rc), rrdcalc_name(rc), rrdset_id(st), rrdhost_hostname(host));
|
||||
|
||||
rc->last_status_change_value = rc->value;
|
||||
rc->last_status_change = now_realtime_sec();
|
||||
|
@ -222,13 +222,13 @@ static void rrdcalc_link_to_rrdset(RRDSET *st, RRDCALC *rc) {
|
|||
}
|
||||
|
||||
if(!isnan(rc->green) && isnan(st->green)) {
|
||||
debug(D_HEALTH, "Health alarm '%s.%s' green threshold set from " NETDATA_DOUBLE_FORMAT_AUTO
|
||||
netdata_log_debug(D_HEALTH, "Health alarm '%s.%s' green threshold set from " NETDATA_DOUBLE_FORMAT_AUTO
|
||||
" to " NETDATA_DOUBLE_FORMAT_AUTO ".", rrdset_id(rc->rrdset), rrdcalc_name(rc), rc->rrdset->green, rc->green);
|
||||
st->green = rc->green;
|
||||
}
|
||||
|
||||
if(!isnan(rc->red) && isnan(st->red)) {
|
||||
debug(D_HEALTH, "Health alarm '%s.%s' red threshold set from " NETDATA_DOUBLE_FORMAT_AUTO " to " NETDATA_DOUBLE_FORMAT_AUTO
|
||||
netdata_log_debug(D_HEALTH, "Health alarm '%s.%s' red threshold set from " NETDATA_DOUBLE_FORMAT_AUTO " to " NETDATA_DOUBLE_FORMAT_AUTO
|
||||
".", rrdset_id(rc->rrdset), rrdcalc_name(rc), rc->rrdset->red, rc->red);
|
||||
st->red = rc->red;
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ static void rrdcalc_unlink_from_rrdset(RRDCALC *rc, bool having_ll_wrlock) {
|
|||
RRDSET *st = rc->rrdset;
|
||||
|
||||
if(!st) {
|
||||
debug(D_HEALTH, "Requested to unlink RRDCALC '%s.%s' which is not linked to any RRDSET", rrdcalc_chart_name(rc), rrdcalc_name(rc));
|
||||
netdata_log_debug(D_HEALTH, "Requested to unlink RRDCALC '%s.%s' which is not linked to any RRDSET", rrdcalc_chart_name(rc), rrdcalc_name(rc));
|
||||
netdata_log_error("Requested to unlink RRDCALC '%s.%s' which is not linked to any RRDSET", rrdcalc_chart_name(rc), rrdcalc_name(rc));
|
||||
return;
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ static void rrdcalc_unlink_from_rrdset(RRDCALC *rc, bool having_ll_wrlock) {
|
|||
health_alarm_log_add_entry(host, ae);
|
||||
}
|
||||
|
||||
debug(D_HEALTH, "Health unlinking alarm '%s.%s' from chart '%s' of host '%s'", rrdcalc_chart_name(rc), rrdcalc_name(rc), rrdset_id(st), rrdhost_hostname(host));
|
||||
netdata_log_debug(D_HEALTH, "Health unlinking alarm '%s.%s' from chart '%s' of host '%s'", rrdcalc_chart_name(rc), rrdcalc_name(rc), rrdset_id(st), rrdhost_hostname(host));
|
||||
|
||||
// unlink it
|
||||
|
||||
|
@ -412,7 +412,7 @@ static inline bool rrdcalc_check_if_it_matches_rrdset(RRDCALC *rc, RRDSET *st) {
|
|||
|
||||
void rrdcalc_link_matching_alerts_to_rrdset(RRDSET *st) {
|
||||
RRDHOST *host = st->rrdhost;
|
||||
// debug(D_HEALTH, "find matching alarms for chart '%s'", st->id);
|
||||
// netdata_log_debug(D_HEALTH, "find matching alarms for chart '%s'", st->id);
|
||||
|
||||
RRDCALC *rc;
|
||||
foreach_rrdcalc_in_rrdhost_read(host, rc) {
|
||||
|
@ -557,7 +557,7 @@ static void rrdcalc_rrdhost_insert_callback(const DICTIONARY_ITEM *item __maybe_
|
|||
rc->critical->rrdcalc = rc;
|
||||
}
|
||||
|
||||
debug(D_HEALTH, "Health added alarm '%s.%s': exec '%s', recipient '%s', green " NETDATA_DOUBLE_FORMAT_AUTO
|
||||
netdata_log_debug(D_HEALTH, "Health added alarm '%s.%s': exec '%s', recipient '%s', green " NETDATA_DOUBLE_FORMAT_AUTO
|
||||
", red " NETDATA_DOUBLE_FORMAT_AUTO
|
||||
", lookup: group %d, after %d, before %d, options %u, dimensions '%s', for each dimension '%s', update every %d, calculation '%s', warning '%s', critical '%s', source '%s', delay up %d, delay down %d, delay max %d, delay_multiplier %f, warn_repeat_every %u, crit_repeat_every %u",
|
||||
rrdcalc_chart_name(rc),
|
||||
|
|
|
@ -143,7 +143,7 @@ static void rrdcalctemplate_insert_callback(const DICTIONARY_ITEM *item __maybe_
|
|||
bool *added = added_bool;
|
||||
*added = true;
|
||||
|
||||
debug(D_HEALTH, "Health configuration adding template '%s'"
|
||||
netdata_log_debug(D_HEALTH, "Health configuration adding template '%s'"
|
||||
": context '%s'"
|
||||
", exec '%s'"
|
||||
", recipient '%s'"
|
||||
|
|
|
@ -197,7 +197,7 @@ static void rrddim_delete_callback(const DICTIONARY_ITEM *item __maybe_unused, v
|
|||
|
||||
ml_dimension_delete(rd);
|
||||
|
||||
debug(D_RRD_CALLS, "rrddim_free() %s.%s", rrdset_name(st), rrddim_name(rd));
|
||||
netdata_log_debug(D_RRD_CALLS, "rrddim_free() %s.%s", rrdset_name(st), rrddim_name(rd));
|
||||
|
||||
if (!rrddim_finalize_collection_and_check_retention(rd) && rd->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) {
|
||||
/* This metric has no data and no references */
|
||||
|
@ -318,13 +318,13 @@ static inline RRDDIM *rrddim_index_find(RRDSET *st, const char *id) {
|
|||
// RRDDIM - find a dimension
|
||||
|
||||
inline RRDDIM *rrddim_find(RRDSET *st, const char *id) {
|
||||
debug(D_RRD_CALLS, "rrddim_find() for chart %s, dimension %s", rrdset_name(st), id);
|
||||
netdata_log_debug(D_RRD_CALLS, "rrddim_find() for chart %s, dimension %s", rrdset_name(st), id);
|
||||
|
||||
return rrddim_index_find(st, id);
|
||||
}
|
||||
|
||||
inline RRDDIM_ACQUIRED *rrddim_find_and_acquire(RRDSET *st, const char *id) {
|
||||
debug(D_RRD_CALLS, "rrddim_find_and_acquire() for chart %s, dimension %s", rrdset_name(st), id);
|
||||
netdata_log_debug(D_RRD_CALLS, "rrddim_find_and_acquire() for chart %s, dimension %s", rrdset_name(st), id);
|
||||
|
||||
return (RRDDIM_ACQUIRED *)dictionary_get_and_acquire_item(st->rrddim_root_index, id);
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ inline int rrddim_reset_name(RRDSET *st, RRDDIM *rd, const char *name) {
|
|||
if(unlikely(!name || !*name || !strcmp(rrddim_name(rd), name)))
|
||||
return 0;
|
||||
|
||||
debug(D_RRD_CALLS, "rrddim_reset_name() from %s.%s to %s.%s", rrdset_name(st), rrddim_name(rd), rrdset_name(st), name);
|
||||
netdata_log_debug(D_RRD_CALLS, "rrddim_reset_name() from %s.%s to %s.%s", rrdset_name(st), rrddim_name(rd), rrdset_name(st), name);
|
||||
|
||||
STRING *old = rd->name;
|
||||
rd->name = rrd_string_strdupz(name);
|
||||
|
@ -379,7 +379,7 @@ inline int rrddim_set_algorithm(RRDSET *st, RRDDIM *rd, RRD_ALGORITHM algorithm)
|
|||
if(unlikely(rd->algorithm == algorithm))
|
||||
return 0;
|
||||
|
||||
debug(D_RRD_CALLS, "Updating algorithm of dimension '%s/%s' from %s to %s", rrdset_id(st), rrddim_name(rd), rrd_algorithm_name(rd->algorithm), rrd_algorithm_name(algorithm));
|
||||
netdata_log_debug(D_RRD_CALLS, "Updating algorithm of dimension '%s/%s' from %s to %s", rrdset_id(st), rrddim_name(rd), rrd_algorithm_name(rd->algorithm), rrd_algorithm_name(algorithm));
|
||||
rd->algorithm = algorithm;
|
||||
rrddim_clear_exposed(rd);
|
||||
rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_EXPOSED);
|
||||
|
@ -392,7 +392,7 @@ inline int rrddim_set_multiplier(RRDSET *st, RRDDIM *rd, int32_t multiplier) {
|
|||
if(unlikely(rd->multiplier == multiplier))
|
||||
return 0;
|
||||
|
||||
debug(D_RRD_CALLS, "Updating multiplier of dimension '%s/%s' from %d to %d",
|
||||
netdata_log_debug(D_RRD_CALLS, "Updating multiplier of dimension '%s/%s' from %d to %d",
|
||||
rrdset_id(st), rrddim_name(rd), rd->multiplier, multiplier);
|
||||
rd->multiplier = multiplier;
|
||||
rrddim_clear_exposed(rd);
|
||||
|
@ -406,7 +406,7 @@ inline int rrddim_set_divisor(RRDSET *st, RRDDIM *rd, int32_t divisor) {
|
|||
if(unlikely(rd->divisor == divisor))
|
||||
return 0;
|
||||
|
||||
debug(D_RRD_CALLS, "Updating divisor of dimension '%s/%s' from %d to %d",
|
||||
netdata_log_debug(D_RRD_CALLS, "Updating divisor of dimension '%s/%s' from %d to %d",
|
||||
rrdset_id(st), rrddim_name(rd), rd->divisor, divisor);
|
||||
rd->divisor = divisor;
|
||||
rrddim_clear_exposed(rd);
|
||||
|
@ -493,7 +493,7 @@ void rrddim_free(RRDSET *st, RRDDIM *rd) {
|
|||
// RRDDIM - set dimension options
|
||||
|
||||
int rrddim_hide(RRDSET *st, const char *id) {
|
||||
debug(D_RRD_CALLS, "rrddim_hide() for chart %s, dimension %s", rrdset_name(st), id);
|
||||
netdata_log_debug(D_RRD_CALLS, "rrddim_hide() for chart %s, dimension %s", rrdset_name(st), id);
|
||||
|
||||
RRDHOST *host = st->rrdhost;
|
||||
|
||||
|
@ -513,7 +513,7 @@ int rrddim_hide(RRDSET *st, const char *id) {
|
|||
}
|
||||
|
||||
int rrddim_unhide(RRDSET *st, const char *id) {
|
||||
debug(D_RRD_CALLS, "rrddim_unhide() for chart %s, dimension %s", rrdset_name(st), id);
|
||||
netdata_log_debug(D_RRD_CALLS, "rrddim_unhide() for chart %s, dimension %s", rrdset_name(st), id);
|
||||
|
||||
RRDHOST *host = st->rrdhost;
|
||||
RRDDIM *rd = rrddim_find(st, id);
|
||||
|
@ -533,7 +533,7 @@ int rrddim_unhide(RRDSET *st, const char *id) {
|
|||
}
|
||||
|
||||
inline void rrddim_is_obsolete(RRDSET *st, RRDDIM *rd) {
|
||||
debug(D_RRD_CALLS, "rrddim_is_obsolete() for chart %s, dimension %s", rrdset_name(st), rrddim_name(rd));
|
||||
netdata_log_debug(D_RRD_CALLS, "rrddim_is_obsolete() for chart %s, dimension %s", rrdset_name(st), rrddim_name(rd));
|
||||
|
||||
if(unlikely(rrddim_flag_check(rd, RRDDIM_FLAG_ARCHIVED))) {
|
||||
netdata_log_info("Cannot obsolete already archived dimension %s from chart %s", rrddim_name(rd), rrdset_name(st));
|
||||
|
@ -546,7 +546,7 @@ inline void rrddim_is_obsolete(RRDSET *st, RRDDIM *rd) {
|
|||
}
|
||||
|
||||
inline void rrddim_isnot_obsolete(RRDSET *st __maybe_unused, RRDDIM *rd) {
|
||||
debug(D_RRD_CALLS, "rrddim_isnot_obsolete() for chart %s, dimension %s", rrdset_name(st), rrddim_name(rd));
|
||||
netdata_log_debug(D_RRD_CALLS, "rrddim_isnot_obsolete() for chart %s, dimension %s", rrdset_name(st), rrddim_name(rd));
|
||||
|
||||
rrddim_flag_clear(rd, RRDDIM_FLAG_OBSOLETE);
|
||||
rrdcontext_updated_rrddim_flags(rd);
|
||||
|
@ -563,7 +563,7 @@ inline collected_number rrddim_set_by_pointer(RRDSET *st, RRDDIM *rd, collected_
|
|||
}
|
||||
|
||||
collected_number rrddim_timed_set_by_pointer(RRDSET *st __maybe_unused, RRDDIM *rd, struct timeval collected_time, collected_number value) {
|
||||
debug(D_RRD_CALLS, "rrddim_set_by_pointer() for chart %s, dimension %s, value " COLLECTED_NUMBER_FORMAT, rrdset_name(st), rrddim_name(rd), value);
|
||||
netdata_log_debug(D_RRD_CALLS, "rrddim_set_by_pointer() for chart %s, dimension %s, value " COLLECTED_NUMBER_FORMAT, rrdset_name(st), rrddim_name(rd), value);
|
||||
|
||||
rd->collector.last_collected_time = collected_time;
|
||||
rd->collector.collected_value = value;
|
||||
|
|
|
@ -249,7 +249,7 @@ void rrddimvar_add_and_leave_released(RRDDIM *rd, RRDVAR_TYPE type, const char *
|
|||
void rrddimvar_rename_all(RRDDIM *rd) {
|
||||
RRDSET *st = rd->rrdset;
|
||||
|
||||
debug(D_VARIABLES, "RRDDIMVAR rename for chart id '%s' name '%s', dimension id '%s', name '%s'", rrdset_id(st), rrdset_name(st), rrddim_id(rd), rrddim_name(rd));
|
||||
netdata_log_debug(D_VARIABLES, "RRDDIMVAR rename for chart id '%s' name '%s', dimension id '%s', name '%s'", rrdset_id(st), rrdset_name(st), rrddim_id(rd), rrddim_name(rd));
|
||||
|
||||
RRDDIMVAR *rs;
|
||||
dfe_start_write(st->rrddimvar_root_index, rs) {
|
||||
|
@ -262,7 +262,7 @@ void rrddimvar_rename_all(RRDDIM *rd) {
|
|||
void rrddimvar_delete_all(RRDDIM *rd) {
|
||||
RRDSET *st = rd->rrdset;
|
||||
|
||||
debug(D_VARIABLES, "RRDDIMVAR delete for chart id '%s' name '%s', dimension id '%s', name '%s'", rrdset_id(st), rrdset_name(st), rrddim_id(rd), rrddim_name(rd));
|
||||
netdata_log_debug(D_VARIABLES, "RRDDIMVAR delete for chart id '%s' name '%s', dimension id '%s', name '%s'", rrdset_id(st), rrdset_name(st), rrddim_id(rd), rrddim_name(rd));
|
||||
|
||||
RRDDIMVAR *rs;
|
||||
dfe_start_write(st->rrddimvar_root_index, rs) {
|
||||
|
|
|
@ -80,7 +80,7 @@ static inline void rrdhost_init() {
|
|||
}
|
||||
|
||||
RRDHOST_ACQUIRED *rrdhost_find_and_acquire(const char *machine_guid) {
|
||||
debug(D_RRD_CALLS, "rrdhost_find_and_acquire() host %s", machine_guid);
|
||||
netdata_log_debug(D_RRD_CALLS, "rrdhost_find_and_acquire() host %s", machine_guid);
|
||||
|
||||
return (RRDHOST_ACQUIRED *)dictionary_get_and_acquire_item(rrdhost_root_index, machine_guid);
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ static RRDHOST *rrdhost_create(
|
|||
int is_localhost,
|
||||
bool archived
|
||||
) {
|
||||
debug(D_RRDHOST, "Host '%s': adding with guid '%s'", hostname, guid);
|
||||
netdata_log_debug(D_RRDHOST, "Host '%s': adding with guid '%s'", hostname, guid);
|
||||
|
||||
if(memory_mode == RRD_MEMORY_MODE_DBENGINE && !dbengine_enabled) {
|
||||
netdata_log_error("memory mode 'dbengine' is not enabled, but host '%s' is configured for it. Falling back to 'alloc'",
|
||||
|
@ -724,7 +724,7 @@ RRDHOST *rrdhost_find_or_create(
|
|||
, struct rrdhost_system_info *system_info
|
||||
, bool archived
|
||||
) {
|
||||
debug(D_RRDHOST, "Searching for host '%s' with guid '%s'", hostname, guid);
|
||||
netdata_log_debug(D_RRDHOST, "Searching for host '%s' with guid '%s'", hostname, guid);
|
||||
|
||||
RRDHOST *host = rrdhost_find_by_guid(guid);
|
||||
if (unlikely(host && host->rrd_memory_mode != mode && rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED))) {
|
||||
|
@ -1033,7 +1033,7 @@ int rrd_init(char *hostname, struct rrdhost_system_info *system_info, bool unitt
|
|||
if(!unittest)
|
||||
metadata_sync_init();
|
||||
|
||||
debug(D_RRDHOST, "Initializing localhost with hostname '%s'", hostname);
|
||||
netdata_log_debug(D_RRDHOST, "Initializing localhost with hostname '%s'", hostname);
|
||||
localhost = rrdhost_create(
|
||||
hostname
|
||||
, registry_get_this_machine_hostname()
|
||||
|
@ -1455,7 +1455,7 @@ static void rrdhost_load_kubernetes_labels(void) {
|
|||
return;
|
||||
}
|
||||
|
||||
debug(D_RRDHOST, "Attempting to fetch external labels via %s", label_script);
|
||||
netdata_log_debug(D_RRDHOST, "Attempting to fetch external labels via %s", label_script);
|
||||
|
||||
pid_t pid;
|
||||
FILE *fp_child_input;
|
||||
|
|
|
@ -55,7 +55,7 @@ static STRING *rrdset_fix_name(RRDHOST *host, const char *chart_full_id, const c
|
|||
strncpyz(new_name, sanitized_name, CONFIG_MAX_VALUE);
|
||||
|
||||
if(rrdset_index_find_name(host, new_name)) {
|
||||
debug(D_RRD_CALLS, "RRDSET: chart name '%s' on host '%s' already exists.", new_name, rrdhost_hostname(host));
|
||||
netdata_log_debug(D_RRD_CALLS, "RRDSET: chart name '%s' on host '%s' already exists.", new_name, rrdhost_hostname(host));
|
||||
if(!strcmp(chart_full_id, full_name) && (!current_name || !*current_name)) {
|
||||
unsigned i = 1;
|
||||
|
||||
|
@ -450,7 +450,7 @@ static RRDSET *rrdset_index_find(RRDHOST *host, const char *id) {
|
|||
// RRDSET - find charts
|
||||
|
||||
inline RRDSET *rrdset_find(RRDHOST *host, const char *id) {
|
||||
debug(D_RRD_CALLS, "rrdset_find() for chart '%s' in host '%s'", id, rrdhost_hostname(host));
|
||||
netdata_log_debug(D_RRD_CALLS, "rrdset_find() for chart '%s' in host '%s'", id, rrdhost_hostname(host));
|
||||
RRDSET *st = rrdset_index_find(host, id);
|
||||
|
||||
if(st)
|
||||
|
@ -460,7 +460,7 @@ inline RRDSET *rrdset_find(RRDHOST *host, const char *id) {
|
|||
}
|
||||
|
||||
inline RRDSET *rrdset_find_bytype(RRDHOST *host, const char *type, const char *id) {
|
||||
debug(D_RRD_CALLS, "rrdset_find_bytype() for chart '%s.%s' in host '%s'", type, id, rrdhost_hostname(host));
|
||||
netdata_log_debug(D_RRD_CALLS, "rrdset_find_bytype() for chart '%s.%s' in host '%s'", type, id, rrdhost_hostname(host));
|
||||
|
||||
char buf[RRD_ID_LENGTH_MAX + 1];
|
||||
strncpyz(buf, type, RRD_ID_LENGTH_MAX - 1);
|
||||
|
@ -472,13 +472,13 @@ inline RRDSET *rrdset_find_bytype(RRDHOST *host, const char *type, const char *i
|
|||
}
|
||||
|
||||
inline RRDSET *rrdset_find_byname(RRDHOST *host, const char *name) {
|
||||
debug(D_RRD_CALLS, "rrdset_find_byname() for chart '%s' in host '%s'", name, rrdhost_hostname(host));
|
||||
netdata_log_debug(D_RRD_CALLS, "rrdset_find_byname() for chart '%s' in host '%s'", name, rrdhost_hostname(host));
|
||||
RRDSET *st = rrdset_index_find_name(host, name);
|
||||
return(st);
|
||||
}
|
||||
|
||||
RRDSET_ACQUIRED *rrdset_find_and_acquire(RRDHOST *host, const char *id) {
|
||||
debug(D_RRD_CALLS, "rrdset_find_and_acquire() for host %s, chart %s", rrdhost_hostname(host), id);
|
||||
netdata_log_debug(D_RRD_CALLS, "rrdset_find_and_acquire() for host %s, chart %s", rrdhost_hostname(host), id);
|
||||
|
||||
return (RRDSET_ACQUIRED *)dictionary_get_and_acquire_item(host->rrdset_root_index, id);
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ int rrdset_reset_name(RRDSET *st, const char *name) {
|
|||
|
||||
RRDHOST *host = st->rrdhost;
|
||||
|
||||
debug(D_RRD_CALLS, "rrdset_reset_name() old: '%s', new: '%s'", rrdset_name(st), name);
|
||||
netdata_log_debug(D_RRD_CALLS, "rrdset_reset_name() old: '%s', new: '%s'", rrdset_name(st), name);
|
||||
|
||||
STRING *name_string = rrdset_fix_name(host, rrdset_id(st), rrdset_parts_type(st), string2str(st->name), name);
|
||||
if(!name_string) return 0;
|
||||
|
@ -745,7 +745,7 @@ inline void rrdset_update_heterogeneous_flag(RRDSET *st) {
|
|||
// RRDSET - reset a chart
|
||||
|
||||
void rrdset_reset(RRDSET *st) {
|
||||
debug(D_RRD_CALLS, "rrdset_reset() %s", rrdset_name(st));
|
||||
netdata_log_debug(D_RRD_CALLS, "rrdset_reset() %s", rrdset_name(st));
|
||||
|
||||
st->last_collected_time.tv_sec = 0;
|
||||
st->last_collected_time.tv_usec = 0;
|
||||
|
@ -933,7 +933,7 @@ RRDSET *rrdset_create_custom(
|
|||
// ------------------------------------------------------------------------
|
||||
// allocate it
|
||||
|
||||
debug(D_RRD_CALLS, "Creating RRD_STATS for '%s.%s'.", type, id);
|
||||
netdata_log_debug(D_RRD_CALLS, "Creating RRD_STATS for '%s.%s'.", type, id);
|
||||
|
||||
struct rrdset_constructor tmp = {
|
||||
.host = host,
|
||||
|
@ -1056,7 +1056,7 @@ void rrdset_timed_next(RRDSET *st, struct timeval now, usec_t duration_since_las
|
|||
#endif
|
||||
}
|
||||
|
||||
debug(D_RRD_CALLS, "rrdset_timed_next() for chart %s with duration since last update %llu usec", rrdset_name(st), duration_since_last_update);
|
||||
netdata_log_debug(D_RRD_CALLS, "rrdset_timed_next() for chart %s with duration since last update %llu usec", rrdset_name(st), duration_since_last_update);
|
||||
rrdset_debug(st, "NEXT: %llu microseconds", duration_since_last_update);
|
||||
|
||||
internal_error(discarded && discarded != duration_since_last_update,
|
||||
|
@ -1514,7 +1514,7 @@ void rrdset_timed_done(RRDSET *st, struct timeval now, bool pending_rrdset_next)
|
|||
if (pending_rrdset_next)
|
||||
rrdset_timed_next(st, now, 0ULL);
|
||||
|
||||
debug(D_RRD_CALLS, "rrdset_done() for chart '%s'", rrdset_name(st));
|
||||
netdata_log_debug(D_RRD_CALLS, "rrdset_done() for chart '%s'", rrdset_name(st));
|
||||
|
||||
RRDDIM *rd;
|
||||
|
||||
|
@ -1666,7 +1666,7 @@ void rrdset_timed_done(RRDSET *st, struct timeval now, bool pending_rrdset_next)
|
|||
// if the new is smaller than the old (an overflow, or reset), set the old equal to the new
|
||||
// to reset the calculation (it will give zero as the calculation for this second)
|
||||
if(unlikely(rd->algorithm == RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL && rd->collector.last_collected_value > rd->collector.collected_value)) {
|
||||
debug(D_RRD_STATS, "'%s' / '%s': RESET or OVERFLOW. Last collected value = " COLLECTED_NUMBER_FORMAT ", current = " COLLECTED_NUMBER_FORMAT
|
||||
netdata_log_debug(D_RRD_STATS, "'%s' / '%s': RESET or OVERFLOW. Last collected value = " COLLECTED_NUMBER_FORMAT ", current = " COLLECTED_NUMBER_FORMAT
|
||||
, rrdset_id(st)
|
||||
, rrddim_name(rd)
|
||||
, rd->collector.last_collected_value
|
||||
|
@ -1770,7 +1770,7 @@ void rrdset_timed_done(RRDSET *st, struct timeval now, bool pending_rrdset_next)
|
|||
// It is imperative to set the comparison to uint64_t since type collected_number is signed and
|
||||
// produces wrong results as far as incremental counters are concerned.
|
||||
if(unlikely((uint64_t)rd->collector.last_collected_value > (uint64_t)rd->collector.collected_value)) {
|
||||
debug(D_RRD_STATS, "'%s' / '%s': RESET or OVERFLOW. Last collected value = " COLLECTED_NUMBER_FORMAT ", current = " COLLECTED_NUMBER_FORMAT
|
||||
netdata_log_debug(D_RRD_STATS, "'%s' / '%s': RESET or OVERFLOW. Last collected value = " COLLECTED_NUMBER_FORMAT ", current = " COLLECTED_NUMBER_FORMAT
|
||||
, rrdset_id(st)
|
||||
, rrddim_name(rd)
|
||||
, rd->collector.last_collected_value
|
||||
|
|
|
@ -222,7 +222,7 @@ void rrdsetvar_add_and_leave_released(RRDSET *st, const char *name, RRDVAR_TYPE
|
|||
}
|
||||
|
||||
void rrdsetvar_rename_all(RRDSET *st) {
|
||||
debug(D_VARIABLES, "RRDSETVAR rename for chart id '%s' name '%s'", rrdset_id(st), rrdset_name(st));
|
||||
netdata_log_debug(D_VARIABLES, "RRDSETVAR rename for chart id '%s' name '%s'", rrdset_id(st), rrdset_name(st));
|
||||
|
||||
RRDSETVAR *rs;
|
||||
dfe_start_write(st->rrdsetvar_root_index, rs) {
|
||||
|
|
|
@ -67,7 +67,7 @@ static void aclk_database_enq_cmd(struct aclk_database_cmd *cmd)
|
|||
/* wake up event loop */
|
||||
int rc = uv_async_send(&aclk_sync_config.async);
|
||||
if (unlikely(rc))
|
||||
debug(D_ACLK_SYNC, "Failed to wake up event loop");
|
||||
netdata_log_debug(D_ACLK_SYNC, "Failed to wake up event loop");
|
||||
}
|
||||
|
||||
enum {
|
||||
|
@ -226,14 +226,14 @@ static void sql_delete_aclk_table_list(char *host_guid)
|
|||
uuid_unparse_lower(host_uuid, host_str);
|
||||
uuid_unparse_lower_fix(&host_uuid, uuid_str);
|
||||
|
||||
debug(D_ACLK_SYNC, "Checking if I should delete aclk tables for node %s", host_str);
|
||||
netdata_log_debug(D_ACLK_SYNC, "Checking if I should delete aclk tables for node %s", host_str);
|
||||
|
||||
if (is_host_available(&host_uuid)) {
|
||||
debug(D_ACLK_SYNC, "Host %s exists, not deleting aclk sync tables", host_str);
|
||||
netdata_log_debug(D_ACLK_SYNC, "Host %s exists, not deleting aclk sync tables", host_str);
|
||||
return;
|
||||
}
|
||||
|
||||
debug(D_ACLK_SYNC, "Host %s does NOT exist, can delete aclk sync tables", host_str);
|
||||
netdata_log_debug(D_ACLK_SYNC, "Host %s does NOT exist, can delete aclk sync tables", host_str);
|
||||
|
||||
sqlite3_stmt *res = NULL;
|
||||
BUFFER *sql = buffer_create(ACLK_SYNC_QUERY_SIZE, &netdata_buffers_statistics.buffers_sqlite);
|
||||
|
@ -265,7 +265,7 @@ fail:
|
|||
|
||||
static int sql_check_aclk_table(void *data __maybe_unused, int argc __maybe_unused, char **argv __maybe_unused, char **column __maybe_unused)
|
||||
{
|
||||
debug(D_ACLK_SYNC,"Scheduling aclk sync table check for node %s", (char *) argv[0]);
|
||||
netdata_log_debug(D_ACLK_SYNC,"Scheduling aclk sync table check for node %s", (char *) argv[0]);
|
||||
struct aclk_database_cmd cmd;
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.opcode = ACLK_DATABASE_DELETE_HOST;
|
||||
|
@ -280,7 +280,7 @@ static int sql_check_aclk_table(void *data __maybe_unused, int argc __maybe_unus
|
|||
static void sql_check_aclk_table_list(void)
|
||||
{
|
||||
char *err_msg = NULL;
|
||||
debug(D_ACLK_SYNC,"Cleaning tables for nodes that do not exist");
|
||||
netdata_log_debug(D_ACLK_SYNC,"Cleaning tables for nodes that do not exist");
|
||||
int rc = sqlite3_exec_monitored(db_meta, SQL_SELECT_ACLK_ACTIVE_LIST, sql_check_aclk_table, NULL, &err_msg);
|
||||
if (rc != SQLITE_OK) {
|
||||
error_report("Query failed when trying to check for obsolete ACLK sync tables, %s", err_msg);
|
||||
|
@ -305,7 +305,7 @@ static int sql_maint_aclk_sync_database(void *data __maybe_unused, int argc __ma
|
|||
static void sql_maint_aclk_sync_database_all(void)
|
||||
{
|
||||
char *err_msg = NULL;
|
||||
debug(D_ACLK_SYNC,"Cleaning tables for nodes that do not exist");
|
||||
netdata_log_debug(D_ACLK_SYNC,"Cleaning tables for nodes that do not exist");
|
||||
int rc = sqlite3_exec_monitored(db_meta, SQL_SELECT_ACLK_ALERT_LIST, sql_maint_aclk_sync_database, NULL, &err_msg);
|
||||
if (rc != SQLITE_OK) {
|
||||
error_report("Query failed when trying to check for obsolete ACLK sync tables, %s", err_msg);
|
||||
|
@ -444,7 +444,7 @@ static void aclk_synchronization(void *arg __maybe_unused)
|
|||
sql_process_queue_removed_alerts_to_aclk(cmd.param[0]);
|
||||
break;
|
||||
default:
|
||||
debug(D_ACLK_SYNC, "%s: default.", __func__);
|
||||
netdata_log_debug(D_ACLK_SYNC, "%s: default.", __func__);
|
||||
break;
|
||||
}
|
||||
if (cmd.completion)
|
||||
|
|
|
@ -321,7 +321,7 @@ int init_database_batch(sqlite3 *database, int rebuild, int init_type, const cha
|
|||
int rc;
|
||||
char *err_msg = NULL;
|
||||
for (int i = 0; batch[i]; i++) {
|
||||
debug(D_METADATALOG, "Executing %s", batch[i]);
|
||||
netdata_log_debug(D_METADATALOG, "Executing %s", batch[i]);
|
||||
rc = sqlite3_exec_monitored(database, batch[i], 0, 0, &err_msg);
|
||||
if (rc != SQLITE_OK) {
|
||||
error_report("SQLite error during database %s, rc = %d (%s)", init_type ? "cleanup" : "setup", rc, err_msg);
|
||||
|
|
|
@ -152,17 +152,16 @@ void aws_kinesis_connector_worker(void *instance_p)
|
|||
}
|
||||
char error_message[ERROR_LINE_MAX + 1] = "";
|
||||
|
||||
debug(
|
||||
D_EXPORTING,
|
||||
"EXPORTING: kinesis_put_record(): dest = %s, id = %s, key = %s, stream = %s, partition_key = %s, \
|
||||
buffer = %zu, record = %zu",
|
||||
instance->config.destination,
|
||||
connector_specific_config->auth_key_id,
|
||||
connector_specific_config->secure_key,
|
||||
connector_specific_config->stream_name,
|
||||
partition_key,
|
||||
buffer_len,
|
||||
record_len);
|
||||
netdata_log_debug(D_EXPORTING,
|
||||
"EXPORTING: kinesis_put_record(): dest = %s, id = %s, key = %s, stream = %s, partition_key = %s, \ "
|
||||
" buffer = %zu, record = %zu",
|
||||
instance->config.destination,
|
||||
connector_specific_config->auth_key_id,
|
||||
connector_specific_config->secure_key,
|
||||
connector_specific_config->stream_name,
|
||||
partition_key,
|
||||
buffer_len,
|
||||
record_len);
|
||||
|
||||
kinesis_put_record(
|
||||
connector_specific_data, connector_specific_config->stream_name, partition_key, first_char, record_len);
|
||||
|
|
|
@ -69,18 +69,18 @@ int rrdset_is_exportable(struct instance *instance, RRDSET *st)
|
|||
*flags |= RRDSET_FLAG_EXPORTING_SEND;
|
||||
else {
|
||||
*flags |= RRDSET_FLAG_EXPORTING_IGNORE;
|
||||
debug(D_EXPORTING, "EXPORTING: not sending chart '%s' of host '%s', because it is disabled for exporting.", rrdset_id(st), rrdhost_hostname(host));
|
||||
netdata_log_debug(D_EXPORTING, "EXPORTING: not sending chart '%s' of host '%s', because it is disabled for exporting.", rrdset_id(st), rrdhost_hostname(host));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(unlikely(!rrdset_is_available_for_exporting_and_alarms(st))) {
|
||||
debug(D_EXPORTING, "EXPORTING: not sending chart '%s' of host '%s', because it is not available for exporting.", rrdset_id(st), rrdhost_hostname(host));
|
||||
netdata_log_debug(D_EXPORTING, "EXPORTING: not sending chart '%s' of host '%s', because it is not available for exporting.", rrdset_id(st), rrdhost_hostname(host));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(unlikely(st->rrd_memory_mode == RRD_MEMORY_MODE_NONE && !(EXPORTING_OPTIONS_DATA_SOURCE(instance->config.options) == EXPORTING_SOURCE_DATA_AS_COLLECTED))) {
|
||||
debug(D_EXPORTING, "EXPORTING: not sending chart '%s' of host '%s' because its memory mode is '%s' and the exporting engine requires database access.", rrdset_id(st), rrdhost_hostname(host), rrd_memory_mode_name(host->rrd_memory_mode));
|
||||
netdata_log_debug(D_EXPORTING, "EXPORTING: not sending chart '%s' of host '%s' because its memory mode is '%s' and the exporting engine requires database access.", rrdset_id(st), rrdhost_hostname(host), rrd_memory_mode_name(host->rrd_memory_mode));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ void mongodb_connector_worker(void *instance_p)
|
|||
data_size += insert[i]->len;
|
||||
}
|
||||
|
||||
debug(
|
||||
netdata_log_debug(
|
||||
D_EXPORTING,
|
||||
"EXPORTING: mongodb_insert(): destination = %s, database = %s, collection = %s, data size = %zu",
|
||||
instance->config.destination,
|
||||
|
|
|
@ -107,7 +107,7 @@ NETDATA_DOUBLE exporting_calculate_value_from_stored_data(
|
|||
|
||||
if (unlikely(before < first_t || after > last_t)) {
|
||||
// the chart has not been updated in the wanted timeframe
|
||||
debug(
|
||||
netdata_log_debug(
|
||||
D_EXPORTING,
|
||||
"EXPORTING: %s.%s.%s: aligned timeframe %lu to %lu is outside the chart's database range %lu to %lu",
|
||||
rrdhost_hostname(host),
|
||||
|
@ -142,7 +142,7 @@ NETDATA_DOUBLE exporting_calculate_value_from_stored_data(
|
|||
global_statistics_exporters_query_completed(points_read);
|
||||
|
||||
if (unlikely(!counter)) {
|
||||
debug(
|
||||
netdata_log_debug(
|
||||
D_EXPORTING,
|
||||
"EXPORTING: %s.%s.%s: no values stored in database for range %lu to %lu",
|
||||
rrdhost_hostname(host),
|
||||
|
|
|
@ -41,7 +41,7 @@ inline int can_send_rrdset(struct instance *instance, RRDSET *st, SIMPLE_PATTERN
|
|||
rrdset_flag_set(st, RRDSET_FLAG_EXPORTING_SEND);
|
||||
} else {
|
||||
rrdset_flag_set(st, RRDSET_FLAG_EXPORTING_IGNORE);
|
||||
debug(
|
||||
netdata_log_debug(
|
||||
D_EXPORTING,
|
||||
"EXPORTING: not sending chart '%s' of host '%s', because it is disabled for exporting.",
|
||||
rrdset_id(st),
|
||||
|
@ -51,7 +51,7 @@ inline int can_send_rrdset(struct instance *instance, RRDSET *st, SIMPLE_PATTERN
|
|||
}
|
||||
|
||||
if (unlikely(!rrdset_is_available_for_exporting_and_alarms(st))) {
|
||||
debug(
|
||||
netdata_log_debug(
|
||||
D_EXPORTING,
|
||||
"EXPORTING: not sending chart '%s' of host '%s', because it is not available for exporting.",
|
||||
rrdset_id(st),
|
||||
|
@ -62,7 +62,7 @@ inline int can_send_rrdset(struct instance *instance, RRDSET *st, SIMPLE_PATTERN
|
|||
if (unlikely(
|
||||
st->rrd_memory_mode == RRD_MEMORY_MODE_NONE &&
|
||||
!(EXPORTING_OPTIONS_DATA_SOURCE(instance->config.options) == EXPORTING_SOURCE_DATA_AS_COLLECTED))) {
|
||||
debug(
|
||||
netdata_log_debug(
|
||||
D_EXPORTING,
|
||||
"EXPORTING: not sending chart '%s' of host '%s' because its memory mode is '%s' and the exporting connector requires database access.",
|
||||
rrdset_id(st),
|
||||
|
|
|
@ -244,7 +244,7 @@ int format_dimension_prometheus_remote_write(struct instance *instance, RRDDIM *
|
|||
// we need as-collected / raw data
|
||||
|
||||
if (unlikely(rd->collector.last_collected_time.tv_sec < instance->after)) {
|
||||
debug(
|
||||
netdata_log_debug(
|
||||
D_EXPORTING,
|
||||
"EXPORTING: not sending dimension '%s' of chart '%s' from host '%s', "
|
||||
"its last data collection (%lu) is not within our timeframe (%lu to %lu)",
|
||||
|
|
|
@ -141,7 +141,7 @@ void pubsub_connector_worker(void *instance_p)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
debug(
|
||||
netdata_log_debug(
|
||||
D_EXPORTING, "EXPORTING: pubsub_publish(): project = %s, topic = %s, buffer = %zu",
|
||||
connector_specific_config->project_id, connector_specific_config->topic_id, buffer_len);
|
||||
|
||||
|
|
|
@ -40,12 +40,11 @@ int exporting_discard_response(BUFFER *buffer, struct instance *instance) {
|
|||
}
|
||||
*d = '\0';
|
||||
|
||||
debug(
|
||||
D_EXPORTING,
|
||||
"EXPORTING: received %zu bytes from %s connector instance. Ignoring them. Sample: '%s'",
|
||||
buffer_strlen(buffer),
|
||||
instance->config.name,
|
||||
sample);
|
||||
netdata_log_debug(D_EXPORTING,
|
||||
"EXPORTING: received %zu bytes from %s connector instance. Ignoring them. Sample: '%s'",
|
||||
buffer_strlen(buffer),
|
||||
instance->config.name,
|
||||
sample);
|
||||
#else
|
||||
UNUSED(instance);
|
||||
#endif /* NETDATA_INTERNAL_CHECKS */
|
||||
|
|
|
@ -312,10 +312,10 @@ static void health_silencers_init(void) {
|
|||
* Initialize the health thread.
|
||||
*/
|
||||
void health_init(void) {
|
||||
debug(D_HEALTH, "Health configuration initializing");
|
||||
netdata_log_debug(D_HEALTH, "Health configuration initializing");
|
||||
|
||||
if(!(default_health_enabled = (unsigned int)config_get_boolean(CONFIG_SECTION_HEALTH, "enabled", default_health_enabled))) {
|
||||
debug(D_HEALTH, "Health is disabled.");
|
||||
netdata_log_debug(D_HEALTH, "Health is disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -427,13 +427,13 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) {
|
|||
|
||||
if(unlikely(ae->new_status < RRDCALC_STATUS_CLEAR)) {
|
||||
// do not send notifications for internal statuses
|
||||
debug(D_HEALTH, "Health not sending notification for alarm '%s.%s' status %s (internal statuses)", ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
|
||||
netdata_log_debug(D_HEALTH, "Health not sending notification for alarm '%s.%s' status %s (internal statuses)", ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(unlikely(ae->new_status <= RRDCALC_STATUS_CLEAR && (ae->flags & HEALTH_ENTRY_FLAG_NO_CLEAR_NOTIFICATION))) {
|
||||
// do not send notifications for disabled statuses
|
||||
debug(D_HEALTH, "Health not sending notification for alarm '%s.%s' status %s (it has no-clear-notification enabled)", ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
|
||||
netdata_log_debug(D_HEALTH, "Health not sending notification for alarm '%s.%s' status %s (it has no-clear-notification enabled)", ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
|
||||
log_health("[%s]: Health not sending notification for alarm '%s.%s' status %s (it has no-clear-notification enabled)", rrdhost_hostname(host), ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
|
||||
// mark it as run, so that we will send the same alarm if it happens again
|
||||
goto done;
|
||||
|
@ -450,7 +450,7 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) {
|
|||
// we have executed this alarm notification in the past
|
||||
if(last_executed_status == ae->new_status && !(ae->flags & HEALTH_ENTRY_FLAG_IS_REPEATING)) {
|
||||
// don't send the notification for the same status again
|
||||
debug(D_HEALTH, "Health not sending again notification for alarm '%s.%s' status %s", ae_chart_name(ae), ae_name(ae)
|
||||
netdata_log_debug(D_HEALTH, "Health not sending again notification for alarm '%s.%s' status %s", ae_chart_name(ae), ae_name(ae)
|
||||
, rrdcalc_status2string(ae->new_status));
|
||||
log_health("[%s]: Health not sending again notification for alarm '%s.%s' status %s", rrdhost_hostname(host), ae_chart_name(ae), ae_name(ae)
|
||||
, rrdcalc_status2string(ae->new_status));
|
||||
|
@ -462,7 +462,7 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) {
|
|||
// so, don't send CLEAR notifications
|
||||
if(unlikely(ae->new_status == RRDCALC_STATUS_CLEAR)) {
|
||||
if((!(ae->flags & HEALTH_ENTRY_RUN_ONCE)) || (ae->flags & HEALTH_ENTRY_RUN_ONCE && ae->old_status < RRDCALC_STATUS_RAISED) ) {
|
||||
debug(D_HEALTH, "Health not sending notification for first initialization of alarm '%s.%s' status %s"
|
||||
netdata_log_debug(D_HEALTH, "Health not sending notification for first initialization of alarm '%s.%s' status %s"
|
||||
, ae_chart_name(ae), ae_name(ae), rrdcalc_status2string(ae->new_status));
|
||||
goto done;
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) {
|
|||
ae->flags |= HEALTH_ENTRY_FLAG_EXEC_RUN;
|
||||
ae->exec_run_timestamp = now_realtime_sec(); /* will be updated by real time after spawning */
|
||||
|
||||
debug(D_HEALTH, "executing command '%s'", command_to_run);
|
||||
netdata_log_debug(D_HEALTH, "executing command '%s'", command_to_run);
|
||||
ae->flags |= HEALTH_ENTRY_FLAG_EXEC_IN_PROGRESS;
|
||||
ae->exec_spawn_serial = spawn_enq_cmd(command_to_run);
|
||||
enqueue_alarm_notify_in_progress(ae);
|
||||
|
@ -608,7 +608,7 @@ static inline void health_alarm_wait_for_execution(ALARM_ENTRY *ae) {
|
|||
return;
|
||||
|
||||
spawn_wait_cmd(ae->exec_spawn_serial, &ae->exec_code, &ae->exec_run_timestamp);
|
||||
debug(D_HEALTH, "done executing command - returned with code %d", ae->exec_code);
|
||||
netdata_log_debug(D_HEALTH, "done executing command - returned with code %d", ae->exec_code);
|
||||
ae->flags &= ~HEALTH_ENTRY_FLAG_EXEC_IN_PROGRESS;
|
||||
|
||||
if(ae->exec_code != 0)
|
||||
|
@ -618,7 +618,7 @@ static inline void health_alarm_wait_for_execution(ALARM_ENTRY *ae) {
|
|||
}
|
||||
|
||||
static inline void health_process_notifications(RRDHOST *host, ALARM_ENTRY *ae) {
|
||||
debug(D_HEALTH, "Health alarm '%s.%s' = " NETDATA_DOUBLE_FORMAT_AUTO " - changed status from %s to %s",
|
||||
netdata_log_debug(D_HEALTH, "Health alarm '%s.%s' = " NETDATA_DOUBLE_FORMAT_AUTO " - changed status from %s to %s",
|
||||
ae->chart?ae_chart_name(ae):"NOCHART", ae_name(ae),
|
||||
ae->new_value,
|
||||
rrdcalc_status2string(ae->old_status),
|
||||
|
@ -691,7 +691,7 @@ static inline void health_alarm_log_process(RRDHOST *host) {
|
|||
|
||||
static inline int rrdcalc_isrunnable(RRDCALC *rc, time_t now, time_t *next_run) {
|
||||
if(unlikely(!rc->rrdset)) {
|
||||
debug(D_HEALTH, "Health not running alarm '%s.%s'. It is not linked to a chart.", rrdcalc_chart_name(rc), rrdcalc_name(rc));
|
||||
netdata_log_debug(D_HEALTH, "Health not running alarm '%s.%s'. It is not linked to a chart.", rrdcalc_chart_name(rc), rrdcalc_name(rc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -702,27 +702,27 @@ static inline int rrdcalc_isrunnable(RRDCALC *rc, time_t now, time_t *next_run)
|
|||
*next_run = rc->next_update;
|
||||
}
|
||||
|
||||
debug(D_HEALTH, "Health not examining alarm '%s.%s' yet (will do in %d secs).", rrdcalc_chart_name(rc), rrdcalc_name(rc), (int) (rc->next_update - now));
|
||||
netdata_log_debug(D_HEALTH, "Health not examining alarm '%s.%s' yet (will do in %d secs).", rrdcalc_chart_name(rc), rrdcalc_name(rc), (int) (rc->next_update - now));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(unlikely(!rc->update_every)) {
|
||||
debug(D_HEALTH, "Health not running alarm '%s.%s'. It does not have an update frequency", rrdcalc_chart_name(rc), rrdcalc_name(rc));
|
||||
netdata_log_debug(D_HEALTH, "Health not running alarm '%s.%s'. It does not have an update frequency", rrdcalc_chart_name(rc), rrdcalc_name(rc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(unlikely(rrdset_flag_check(rc->rrdset, RRDSET_FLAG_OBSOLETE))) {
|
||||
debug(D_HEALTH, "Health not running alarm '%s.%s'. The chart has been marked as obsolete", rrdcalc_chart_name(rc), rrdcalc_name(rc));
|
||||
netdata_log_debug(D_HEALTH, "Health not running alarm '%s.%s'. The chart has been marked as obsolete", rrdcalc_chart_name(rc), rrdcalc_name(rc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(unlikely(rrdset_flag_check(rc->rrdset, RRDSET_FLAG_ARCHIVED))) {
|
||||
debug(D_HEALTH, "Health not running alarm '%s.%s'. The chart has been marked as archived", rrdcalc_chart_name(rc), rrdcalc_name(rc));
|
||||
netdata_log_debug(D_HEALTH, "Health not running alarm '%s.%s'. The chart has been marked as archived", rrdcalc_chart_name(rc), rrdcalc_name(rc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(unlikely(!rc->rrdset->last_collected_time.tv_sec || rc->rrdset->counter_done < 2)) {
|
||||
debug(D_HEALTH, "Health not running alarm '%s.%s'. Chart is not fully collected yet.", rrdcalc_chart_name(rc), rrdcalc_name(rc));
|
||||
netdata_log_debug(D_HEALTH, "Health not running alarm '%s.%s'. Chart is not fully collected yet.", rrdcalc_chart_name(rc), rrdcalc_name(rc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -731,7 +731,7 @@ static inline int rrdcalc_isrunnable(RRDCALC *rc, time_t now, time_t *next_run)
|
|||
time_t last = rrdset_last_entry_s(rc->rrdset);
|
||||
|
||||
if(unlikely(now + update_every < first /* || now - update_every > last */)) {
|
||||
debug(D_HEALTH
|
||||
netdata_log_debug(D_HEALTH
|
||||
, "Health not examining alarm '%s.%s' yet (wanted time is out of bounds - we need %lu but got %lu - %lu)."
|
||||
, rrdcalc_chart_name(rc), rrdcalc_name(rc), (unsigned long) now, (unsigned long) first
|
||||
, (unsigned long) last);
|
||||
|
@ -742,7 +742,7 @@ static inline int rrdcalc_isrunnable(RRDCALC *rc, time_t now, time_t *next_run)
|
|||
time_t needed = now + rc->before + rc->after;
|
||||
|
||||
if(needed + update_every < first || needed - update_every > last) {
|
||||
debug(D_HEALTH
|
||||
netdata_log_debug(D_HEALTH
|
||||
, "Health not examining alarm '%s.%s' yet (not enough data yet - we need %lu but got %lu - %lu)."
|
||||
, rrdcalc_chart_name(rc), rrdcalc_name(rc), (unsigned long) needed, (unsigned long) first
|
||||
, (unsigned long) last);
|
||||
|
@ -851,20 +851,20 @@ static void health_sleep(time_t next_run, unsigned int loop __maybe_unused) {
|
|||
time_t now = now_realtime_sec();
|
||||
if(now < next_run) {
|
||||
worker_is_idle();
|
||||
debug(D_HEALTH, "Health monitoring iteration no %u done. Next iteration in %d secs", loop, (int) (next_run - now));
|
||||
netdata_log_debug(D_HEALTH, "Health monitoring iteration no %u done. Next iteration in %d secs", loop, (int) (next_run - now));
|
||||
while (now < next_run && service_running(SERVICE_HEALTH)) {
|
||||
sleep_usec(USEC_PER_SEC);
|
||||
now = now_realtime_sec();
|
||||
}
|
||||
}
|
||||
else {
|
||||
debug(D_HEALTH, "Health monitoring iteration no %u done. Next iteration now", loop);
|
||||
netdata_log_debug(D_HEALTH, "Health monitoring iteration no %u done. Next iteration now", loop);
|
||||
}
|
||||
}
|
||||
|
||||
static SILENCE_TYPE check_silenced(RRDCALC *rc, const char *host, SILENCERS *silencers) {
|
||||
SILENCER *s;
|
||||
debug(D_HEALTH, "Checking if alarm was silenced via the command API. Alarm info name:%s context:%s chart:%s host:%s family:%s",
|
||||
netdata_log_debug(D_HEALTH, "Checking if alarm was silenced via the command API. Alarm info name:%s context:%s chart:%s host:%s family:%s",
|
||||
rrdcalc_name(rc), (rc->rrdset)?rrdset_context(rc->rrdset):"", rrdcalc_chart_name(rc), host, (rc->rrdset)?rrdset_family(rc->rrdset):"");
|
||||
|
||||
for (s = silencers->silencers; s!=NULL; s=s->next){
|
||||
|
@ -875,11 +875,11 @@ static SILENCE_TYPE check_silenced(RRDCALC *rc, const char *host, SILENCERS *sil
|
|||
(!s->charts_pattern || (rc->chart && s->charts_pattern && simple_pattern_matches_string(s->charts_pattern, rc->chart))) &&
|
||||
(!s->families_pattern || (rc->rrdset && rc->rrdset->family && s->families_pattern && simple_pattern_matches_string(s->families_pattern, rc->rrdset->family)))
|
||||
) {
|
||||
debug(D_HEALTH, "Alarm matches command API silence entry %s:%s:%s:%s:%s", s->alarms,s->charts, s->contexts, s->hosts, s->families);
|
||||
netdata_log_debug(D_HEALTH, "Alarm matches command API silence entry %s:%s:%s:%s:%s", s->alarms,s->charts, s->contexts, s->hosts, s->families);
|
||||
if (unlikely(silencers->stype == STYPE_NONE)) {
|
||||
debug(D_HEALTH, "Alarm %s matched a silence entry, but no SILENCE or DISABLE command was issued via the command API. The match has no effect.", rrdcalc_name(rc));
|
||||
netdata_log_debug(D_HEALTH, "Alarm %s matched a silence entry, but no SILENCE or DISABLE command was issued via the command API. The match has no effect.", rrdcalc_name(rc));
|
||||
} else {
|
||||
debug(D_HEALTH, "Alarm %s via the command API - name:%s context:%s chart:%s host:%s family:%s"
|
||||
netdata_log_debug(D_HEALTH, "Alarm %s via the command API - name:%s context:%s chart:%s host:%s family:%s"
|
||||
, (silencers->stype == STYPE_DISABLE_ALARMS)?"Disabled":"Silenced"
|
||||
, rrdcalc_name(rc)
|
||||
, (rc->rrdset)?rrdset_context(rc->rrdset):""
|
||||
|
@ -1031,7 +1031,7 @@ void *health_main(void *ptr) {
|
|||
|
||||
while(service_running(SERVICE_HEALTH)) {
|
||||
loop++;
|
||||
debug(D_HEALTH, "Health monitoring iteration no %u started", loop);
|
||||
netdata_log_debug(D_HEALTH, "Health monitoring iteration no %u started", loop);
|
||||
|
||||
time_t now = now_realtime_sec();
|
||||
int runnable = 0, apply_hibernation_delay = 0;
|
||||
|
@ -1202,7 +1202,7 @@ void *health_main(void *ptr) {
|
|||
rc->value = NAN;
|
||||
rc->run_flags |= RRDCALC_FLAG_DB_ERROR;
|
||||
|
||||
debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': database lookup returned error %d",
|
||||
netdata_log_debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': database lookup returned error %d",
|
||||
rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc), ret
|
||||
);
|
||||
} else
|
||||
|
@ -1213,14 +1213,14 @@ void *health_main(void *ptr) {
|
|||
rc->value = NAN;
|
||||
rc->run_flags |= RRDCALC_FLAG_DB_NAN;
|
||||
|
||||
debug(D_HEALTH,
|
||||
netdata_log_debug(D_HEALTH,
|
||||
"Health on host '%s', alarm '%s.%s': database lookup returned empty value (possibly value is not collected yet)",
|
||||
rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc)
|
||||
);
|
||||
} else
|
||||
rc->run_flags &= ~RRDCALC_FLAG_DB_NAN;
|
||||
|
||||
debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': database lookup gave value " NETDATA_DOUBLE_FORMAT,
|
||||
netdata_log_debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': database lookup gave value " NETDATA_DOUBLE_FORMAT,
|
||||
rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc), rc->value
|
||||
);
|
||||
}
|
||||
|
@ -1236,14 +1236,14 @@ void *health_main(void *ptr) {
|
|||
rc->value = NAN;
|
||||
rc->run_flags |= RRDCALC_FLAG_CALC_ERROR;
|
||||
|
||||
debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': expression '%s' failed: %s",
|
||||
netdata_log_debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': expression '%s' failed: %s",
|
||||
rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc),
|
||||
rc->calculation->parsed_as, buffer_tostring(rc->calculation->error_msg)
|
||||
);
|
||||
} else {
|
||||
rc->run_flags &= ~RRDCALC_FLAG_CALC_ERROR;
|
||||
|
||||
debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': expression '%s' gave value "
|
||||
netdata_log_debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': expression '%s' gave value "
|
||||
NETDATA_DOUBLE_FORMAT
|
||||
": %s (source: %s)", rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc),
|
||||
rc->calculation->parsed_as, rc->calculation->result,
|
||||
|
@ -1280,14 +1280,14 @@ void *health_main(void *ptr) {
|
|||
// calculation failed
|
||||
rc->run_flags |= RRDCALC_FLAG_WARN_ERROR;
|
||||
|
||||
debug(D_HEALTH,
|
||||
netdata_log_debug(D_HEALTH,
|
||||
"Health on host '%s', alarm '%s.%s': warning expression failed with error: %s",
|
||||
rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc),
|
||||
buffer_tostring(rc->warning->error_msg)
|
||||
);
|
||||
} else {
|
||||
rc->run_flags &= ~RRDCALC_FLAG_WARN_ERROR;
|
||||
debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': warning expression gave value "
|
||||
netdata_log_debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': warning expression gave value "
|
||||
NETDATA_DOUBLE_FORMAT
|
||||
": %s (source: %s)", rrdhost_hostname(host), rrdcalc_chart_name(rc),
|
||||
rrdcalc_name(rc), rc->warning->result, buffer_tostring(rc->warning->error_msg), rrdcalc_source(rc)
|
||||
|
@ -1306,14 +1306,14 @@ void *health_main(void *ptr) {
|
|||
// calculation failed
|
||||
rc->run_flags |= RRDCALC_FLAG_CRIT_ERROR;
|
||||
|
||||
debug(D_HEALTH,
|
||||
netdata_log_debug(D_HEALTH,
|
||||
"Health on host '%s', alarm '%s.%s': critical expression failed with error: %s",
|
||||
rrdhost_hostname(host), rrdcalc_chart_name(rc), rrdcalc_name(rc),
|
||||
buffer_tostring(rc->critical->error_msg)
|
||||
);
|
||||
} else {
|
||||
rc->run_flags &= ~RRDCALC_FLAG_CRIT_ERROR;
|
||||
debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': critical expression gave value "
|
||||
netdata_log_debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': critical expression gave value "
|
||||
NETDATA_DOUBLE_FORMAT
|
||||
": %s (source: %s)", rrdhost_hostname(host), rrdcalc_chart_name(rc),
|
||||
rrdcalc_name(rc), rc->critical->result, buffer_tostring(rc->critical->error_msg),
|
||||
|
@ -1515,7 +1515,7 @@ void *health_main(void *ptr) {
|
|||
}
|
||||
rc->run_flags |= RRDCALC_FLAG_RUN_ONCE;
|
||||
health_process_notifications(host, ae);
|
||||
debug(D_HEALTH, "Notification sent for the repeating alarm %u.", ae->alarm_id);
|
||||
netdata_log_debug(D_HEALTH, "Notification sent for the repeating alarm %u.", ae->alarm_id);
|
||||
health_alarm_wait_for_execution(ae);
|
||||
health_alarm_log_free_one_nochecks_nounlink(ae);
|
||||
}
|
||||
|
|
|
@ -308,7 +308,7 @@ static inline int health_parse_db_lookup(
|
|||
RRDR_TIME_GROUPING *group_method, int *after, int *before, int *every,
|
||||
RRDCALC_OPTIONS *options, STRING **dimensions, STRING **foreachdim
|
||||
) {
|
||||
debug(D_HEALTH, "Health configuration parsing database lookup %zu@%s: %s", line, filename, string);
|
||||
netdata_log_debug(D_HEALTH, "Health configuration parsing database lookup %zu@%s: %s", line, filename, string);
|
||||
|
||||
if(*dimensions) string_freez(*dimensions);
|
||||
if(*foreachdim) string_freez(*foreachdim);
|
||||
|
@ -507,7 +507,7 @@ int sql_store_hashes = 1;
|
|||
static int health_readfile(const char *filename, void *data) {
|
||||
RRDHOST *host = (RRDHOST *)data;
|
||||
|
||||
debug(D_HEALTH, "Health configuration reading file '%s'", filename);
|
||||
netdata_log_debug(D_HEALTH, "Health configuration reading file '%s'", filename);
|
||||
|
||||
static uint32_t
|
||||
hash_alarm = 0,
|
||||
|
@ -738,10 +738,10 @@ static int health_readfile(const char *filename, void *data) {
|
|||
|
||||
if(!simple_pattern_matches_string(os_pattern, host->os)) {
|
||||
if(rc)
|
||||
debug(D_HEALTH, "HEALTH on '%s' ignoring alarm '%s' defined at %zu@%s: host O/S does not match '%s'", rrdhost_hostname(host), rrdcalc_name(rc), line, filename, os_match);
|
||||
netdata_log_debug(D_HEALTH, "HEALTH on '%s' ignoring alarm '%s' defined at %zu@%s: host O/S does not match '%s'", rrdhost_hostname(host), rrdcalc_name(rc), line, filename, os_match);
|
||||
|
||||
if(rt)
|
||||
debug(D_HEALTH, "HEALTH on '%s' ignoring template '%s' defined at %zu@%s: host O/S does not match '%s'", rrdhost_hostname(host), rrdcalctemplate_name(rt), line, filename, os_match);
|
||||
netdata_log_debug(D_HEALTH, "HEALTH on '%s' ignoring template '%s' defined at %zu@%s: host O/S does not match '%s'", rrdhost_hostname(host), rrdcalctemplate_name(rt), line, filename, os_match);
|
||||
|
||||
ignore_this = 1;
|
||||
}
|
||||
|
@ -755,10 +755,10 @@ static int health_readfile(const char *filename, void *data) {
|
|||
|
||||
if(!simple_pattern_matches_string(host_pattern, host->hostname)) {
|
||||
if(rc)
|
||||
debug(D_HEALTH, "HEALTH on '%s' ignoring alarm '%s' defined at %zu@%s: hostname does not match '%s'", rrdhost_hostname(host), rrdcalc_name(rc), line, filename, host_match);
|
||||
netdata_log_debug(D_HEALTH, "HEALTH on '%s' ignoring alarm '%s' defined at %zu@%s: hostname does not match '%s'", rrdhost_hostname(host), rrdcalc_name(rc), line, filename, host_match);
|
||||
|
||||
if(rt)
|
||||
debug(D_HEALTH, "HEALTH on '%s' ignoring template '%s' defined at %zu@%s: hostname does not match '%s'", rrdhost_hostname(host), rrdcalctemplate_name(rt), line, filename, host_match);
|
||||
netdata_log_debug(D_HEALTH, "HEALTH on '%s' ignoring template '%s' defined at %zu@%s: hostname does not match '%s'", rrdhost_hostname(host), rrdcalctemplate_name(rt), line, filename, host_match);
|
||||
|
||||
ignore_this = 1;
|
||||
}
|
||||
|
@ -1328,7 +1328,7 @@ void sql_refresh_hashes(void)
|
|||
void health_readdir(RRDHOST *host, const char *user_path, const char *stock_path, const char *subpath) {
|
||||
if(unlikely((!host->health.health_enabled) && !rrdhost_flag_check(host, RRDHOST_FLAG_INITIALIZED_HEALTH)) ||
|
||||
!service_running(SERVICE_HEALTH)) {
|
||||
debug(D_HEALTH, "CONFIG health is not enabled for host '%s'", rrdhost_hostname(host));
|
||||
netdata_log_debug(D_HEALTH, "CONFIG health is not enabled for host '%s'", rrdhost_hostname(host));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ inline ALARM_ENTRY* health_create_alarm_entry(
|
|||
int delay,
|
||||
HEALTH_ENTRY_FLAGS flags
|
||||
) {
|
||||
debug(D_HEALTH, "Health adding alarm log entry with id: %u", host->health_log.next_log_id);
|
||||
netdata_log_debug(D_HEALTH, "Health adding alarm log entry with id: %u", host->health_log.next_log_id);
|
||||
|
||||
ALARM_ENTRY *ae = callocz(1, sizeof(ALARM_ENTRY));
|
||||
ae->name = string_dup(name);
|
||||
|
@ -89,7 +89,7 @@ inline void health_alarm_log_add_entry(
|
|||
RRDHOST *host,
|
||||
ALARM_ENTRY *ae
|
||||
) {
|
||||
debug(D_HEALTH, "Health adding alarm log entry with id: %u", ae->unique_id);
|
||||
netdata_log_debug(D_HEALTH, "Health adding alarm log entry with id: %u", ae->unique_id);
|
||||
|
||||
__atomic_add_fetch(&host->health_transitions, 1, __ATOMIC_RELAXED);
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ void buffer_vsprintf(BUFFER *wb, const char *fmt, va_list args)
|
|||
do {
|
||||
need += space_remaining * 2;
|
||||
|
||||
debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %zu, size = %zu, by %zu bytes (wrote = %zu)\n", wb->len, wb->size, need, wrote);
|
||||
netdata_log_debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %zu, size = %zu, by %zu bytes (wrote = %zu)\n", wb->len, wb->size, need, wrote);
|
||||
buffer_need_bytes(wb, need);
|
||||
|
||||
space_remaining = wb->size - wb->len - 1;
|
||||
|
@ -131,7 +131,7 @@ void buffer_sprintf(BUFFER *wb, const char *fmt, ...)
|
|||
do {
|
||||
need += space_remaining * 2;
|
||||
|
||||
debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %zu, size = %zu, by %zu bytes (wrote = %zu)\n", wb->len, wb->size, need, wrote);
|
||||
netdata_log_debug(D_WEB_BUFFER, "web_buffer_sprintf(): increasing web_buffer at position %zu, size = %zu, by %zu bytes (wrote = %zu)\n", wb->len, wb->size, need, wrote);
|
||||
buffer_need_bytes(wb, need);
|
||||
|
||||
space_remaining = wb->size - wb->len - 1;
|
||||
|
@ -246,7 +246,7 @@ BUFFER *buffer_create(size_t size, size_t *statistics)
|
|||
{
|
||||
BUFFER *b;
|
||||
|
||||
debug(D_WEB_BUFFER, "Creating new web buffer of size %zu.", size);
|
||||
netdata_log_debug(D_WEB_BUFFER, "Creating new web buffer of size %zu.", size);
|
||||
|
||||
b = callocz(1, sizeof(BUFFER));
|
||||
b->buffer = mallocz(size + sizeof(BUFFER_OVERFLOW_EOF) + 2);
|
||||
|
@ -268,7 +268,7 @@ void buffer_free(BUFFER *b) {
|
|||
|
||||
buffer_overflow_check(b);
|
||||
|
||||
debug(D_WEB_BUFFER, "Freeing web buffer of size %zu.", b->size);
|
||||
netdata_log_debug(D_WEB_BUFFER, "Freeing web buffer of size %zu.", b->size);
|
||||
|
||||
if(b->statistics)
|
||||
__atomic_sub_fetch(b->statistics, b->size + sizeof(BUFFER) + sizeof(BUFFER_OVERFLOW_EOF) + 2, __ATOMIC_RELAXED);
|
||||
|
@ -290,7 +290,7 @@ void buffer_increase(BUFFER *b, size_t free_size_required) {
|
|||
size_t optimal = (b->size > 5*1024*1024) ? b->size / 2 : b->size;
|
||||
if(optimal > wanted) wanted = optimal;
|
||||
|
||||
debug(D_WEB_BUFFER, "Increasing data buffer from size %zu to %zu.", b->size, b->size + wanted);
|
||||
netdata_log_debug(D_WEB_BUFFER, "Increasing data buffer from size %zu to %zu.", b->size, b->size + wanted);
|
||||
|
||||
b->buffer = reallocz(b->buffer, b->size + wanted + sizeof(BUFFER_OVERFLOW_EOF) + 2);
|
||||
b->size += wanted;
|
||||
|
|
|
@ -164,7 +164,7 @@ static inline struct section *appconfig_section_find(struct config *root, const
|
|||
}
|
||||
|
||||
static inline struct section *appconfig_section_create(struct config *root, const char *section) {
|
||||
debug(D_CONFIG, "Creating section '%s'.", section);
|
||||
netdata_log_debug(D_CONFIG, "Creating section '%s'.", section);
|
||||
|
||||
struct section *co = callocz(1, sizeof(struct section));
|
||||
co->name = strdupz(section);
|
||||
|
@ -194,7 +194,7 @@ void appconfig_section_destroy_non_loaded(struct config *root, const char *secti
|
|||
struct section *co;
|
||||
struct config_option *cv, *cv_next;
|
||||
|
||||
debug(D_CONFIG, "Destroying section '%s'.", section);
|
||||
netdata_log_debug(D_CONFIG, "Destroying section '%s'.", section);
|
||||
|
||||
co = appconfig_section_find(root, section);
|
||||
if(!co) {
|
||||
|
@ -259,7 +259,7 @@ void appconfig_section_destroy_non_loaded(struct config *root, const char *secti
|
|||
|
||||
void appconfig_section_option_destroy_non_loaded(struct config *root, const char *section, const char *name)
|
||||
{
|
||||
debug(D_CONFIG, "Destroying section option '%s -> %s'.", section, name);
|
||||
netdata_log_debug(D_CONFIG, "Destroying section option '%s -> %s'.", section, name);
|
||||
|
||||
struct section *co;
|
||||
co = appconfig_section_find(root, section);
|
||||
|
@ -310,7 +310,7 @@ void appconfig_section_option_destroy_non_loaded(struct config *root, const char
|
|||
// config name-value methods
|
||||
|
||||
static inline struct config_option *appconfig_value_create(struct section *co, const char *name, const char *value) {
|
||||
debug(D_CONFIG, "Creating config entry for name '%s', value '%s', in section '%s'.", name, value, co->name);
|
||||
netdata_log_debug(D_CONFIG, "Creating config entry for name '%s', value '%s', in section '%s'.", name, value, co->name);
|
||||
|
||||
struct config_option *cv = callocz(1, sizeof(struct config_option));
|
||||
cv->name = strdupz(name);
|
||||
|
@ -341,7 +341,7 @@ static inline struct config_option *appconfig_value_create(struct section *co, c
|
|||
int appconfig_exists(struct config *root, const char *section, const char *name) {
|
||||
struct config_option *cv;
|
||||
|
||||
debug(D_CONFIG, "request to get config in section '%s', name '%s'", section, name);
|
||||
netdata_log_debug(D_CONFIG, "request to get config in section '%s', name '%s'", section, name);
|
||||
|
||||
struct section *co = appconfig_section_find(root, section);
|
||||
if(!co) return 0;
|
||||
|
@ -356,7 +356,7 @@ int appconfig_move(struct config *root, const char *section_old, const char *nam
|
|||
struct config_option *cv_old, *cv_new;
|
||||
int ret = -1;
|
||||
|
||||
debug(D_CONFIG, "request to rename config in section '%s', old name '%s', to section '%s', new name '%s'", section_old, name_old, section_new, name_new);
|
||||
netdata_log_debug(D_CONFIG, "request to rename config in section '%s', old name '%s', to section '%s', new name '%s'", section_old, name_old, section_new, name_new);
|
||||
|
||||
struct section *co_old = appconfig_section_find(root, section_old);
|
||||
if(!co_old) return ret;
|
||||
|
@ -439,9 +439,9 @@ char *appconfig_get_by_section(struct section *co, const char *name, const char
|
|||
char *appconfig_get(struct config *root, const char *section, const char *name, const char *default_value)
|
||||
{
|
||||
if (default_value == NULL)
|
||||
debug(D_CONFIG, "request to get config in section '%s', name '%s' or fail", section, name);
|
||||
netdata_log_debug(D_CONFIG, "request to get config in section '%s', name '%s' or fail", section, name);
|
||||
else
|
||||
debug(D_CONFIG, "request to get config in section '%s', name '%s', default_value '%s'", section, name, default_value);
|
||||
netdata_log_debug(D_CONFIG, "request to get config in section '%s', name '%s', default_value '%s'", section, name, default_value);
|
||||
|
||||
struct section *co = appconfig_section_find(root, section);
|
||||
if (!co && !default_value)
|
||||
|
@ -532,7 +532,7 @@ const char *appconfig_set_default(struct config *root, const char *section, cons
|
|||
{
|
||||
struct config_option *cv;
|
||||
|
||||
debug(D_CONFIG, "request to set default config in section '%s', name '%s', value '%s'", section, name, value);
|
||||
netdata_log_debug(D_CONFIG, "request to set default config in section '%s', name '%s', value '%s'", section, name, value);
|
||||
|
||||
struct section *co = appconfig_section_find(root, section);
|
||||
if(!co) return appconfig_set(root, section, name, value);
|
||||
|
@ -559,7 +559,7 @@ const char *appconfig_set(struct config *root, const char *section, const char *
|
|||
{
|
||||
struct config_option *cv;
|
||||
|
||||
debug(D_CONFIG, "request to set config in section '%s', name '%s', value '%s'", section, name, value);
|
||||
netdata_log_debug(D_CONFIG, "request to set config in section '%s', name '%s', value '%s'", section, name, value);
|
||||
|
||||
struct section *co = appconfig_section_find(root, section);
|
||||
if(!co) co = appconfig_section_create(root, section);
|
||||
|
@ -649,7 +649,7 @@ int appconfig_load(struct config *root, char *filename, int overwrite_used, cons
|
|||
|
||||
if(!filename) filename = CONFIG_DIR "/" CONFIG_FILENAME;
|
||||
|
||||
debug(D_CONFIG, "CONFIG: opening config file '%s'", filename);
|
||||
netdata_log_debug(D_CONFIG, "CONFIG: opening config file '%s'", filename);
|
||||
|
||||
FILE *fp = fopen(filename, "r");
|
||||
if(!fp) {
|
||||
|
@ -669,7 +669,7 @@ int appconfig_load(struct config *root, char *filename, int overwrite_used, cons
|
|||
|
||||
s = trim(buffer);
|
||||
if(!s || *s == '#') {
|
||||
debug(D_CONFIG, "CONFIG: ignoring line %d of file '%s', it is empty.", line, filename);
|
||||
netdata_log_debug(D_CONFIG, "CONFIG: ignoring line %d of file '%s', it is empty.", line, filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -778,12 +778,12 @@ int appconfig_load(struct config *root, char *filename, int overwrite_used, cons
|
|||
}
|
||||
} else {
|
||||
if (((cv->flags & CONFIG_VALUE_USED) && overwrite_used) || !(cv->flags & CONFIG_VALUE_USED)) {
|
||||
debug(
|
||||
netdata_log_debug(
|
||||
D_CONFIG, "CONFIG: line %d of file '%s', overwriting '%s/%s'.", line, filename, co->name, cv->name);
|
||||
freez(cv->value);
|
||||
cv->value = strdupz(value);
|
||||
} else
|
||||
debug(
|
||||
netdata_log_debug(
|
||||
D_CONFIG,
|
||||
"CONFIG: ignoring line %d of file '%s', '%s/%s' is already present and used.",
|
||||
line,
|
||||
|
|
|
@ -1065,7 +1065,7 @@ static size_t hashtable_destroy_unsafe(DICTIONARY *dict) {
|
|||
JU_ERRNO(&J_Error), JU_ERRID(&J_Error));
|
||||
}
|
||||
|
||||
debug(D_DICTIONARY, "Dictionary: hash table freed %lu bytes", ret);
|
||||
netdata_log_debug(D_DICTIONARY, "Dictionary: hash table freed %lu bytes", ret);
|
||||
|
||||
dict->index.JudyHSArray = NULL;
|
||||
return (size_t)ret;
|
||||
|
@ -1376,7 +1376,7 @@ static void dict_item_reset_value_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *
|
|||
if(unlikely(is_view_dictionary(dict)))
|
||||
fatal("DICTIONARY: %s() should never be called on views.", __FUNCTION__ );
|
||||
|
||||
debug(D_DICTIONARY, "Dictionary entry with name '%s' found. Changing its value.", item_get_name(item));
|
||||
netdata_log_debug(D_DICTIONARY, "Dictionary entry with name '%s' found. Changing its value.", item_get_name(item));
|
||||
|
||||
DICTIONARY_VALUE_RESETS_PLUS1(dict);
|
||||
|
||||
|
@ -1388,12 +1388,12 @@ static void dict_item_reset_value_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *
|
|||
dictionary_execute_delete_callback(dict, item);
|
||||
|
||||
if(likely(dict->options & DICT_OPTION_VALUE_LINK_DONT_CLONE)) {
|
||||
debug(D_DICTIONARY, "Dictionary: linking value to '%s'", item_get_name(item));
|
||||
netdata_log_debug(D_DICTIONARY, "Dictionary: linking value to '%s'", item_get_name(item));
|
||||
item->shared->value = value;
|
||||
item->shared->value_len = value_len;
|
||||
}
|
||||
else {
|
||||
debug(D_DICTIONARY, "Dictionary: cloning value to '%s'", item_get_name(item));
|
||||
netdata_log_debug(D_DICTIONARY, "Dictionary: cloning value to '%s'", item_get_name(item));
|
||||
|
||||
void *old_value = item->shared->value;
|
||||
void *new_value = NULL;
|
||||
|
@ -1405,7 +1405,7 @@ static void dict_item_reset_value_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *
|
|||
item->shared->value = new_value;
|
||||
item->shared->value_len = value_len;
|
||||
|
||||
debug(D_DICTIONARY, "Dictionary: freeing old value of '%s'", item_get_name(item));
|
||||
netdata_log_debug(D_DICTIONARY, "Dictionary: freeing old value of '%s'", item_get_name(item));
|
||||
dict_item_value_freez(dict, old_value);
|
||||
}
|
||||
|
||||
|
@ -1413,7 +1413,7 @@ static void dict_item_reset_value_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *
|
|||
}
|
||||
|
||||
static size_t dict_item_free_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *item) {
|
||||
debug(D_DICTIONARY, "Destroying name value entry for name '%s'.", item_get_name(item));
|
||||
netdata_log_debug(D_DICTIONARY, "Destroying name value entry for name '%s'.", item_get_name(item));
|
||||
|
||||
if(!item_flag_check(item, ITEM_FLAG_DELETED))
|
||||
DICTIONARY_ENTRIES_MINUS1(dict);
|
||||
|
@ -1428,7 +1428,7 @@ static size_t dict_item_free_with_hooks(DICTIONARY *dict, DICTIONARY_ITEM *item)
|
|||
dictionary_execute_delete_callback(dict, item);
|
||||
|
||||
if(unlikely(!(dict->options & DICT_OPTION_VALUE_LINK_DONT_CLONE))) {
|
||||
debug(D_DICTIONARY, "Dictionary freeing value of '%s'", item_get_name(item));
|
||||
netdata_log_debug(D_DICTIONARY, "Dictionary freeing value of '%s'", item_get_name(item));
|
||||
dict_item_value_freez(dict, item->shared->value);
|
||||
item->shared->value = NULL;
|
||||
}
|
||||
|
@ -1554,7 +1554,7 @@ static bool dict_item_del(DICTIONARY *dict, const char *name, ssize_t name_len)
|
|||
if(name_len == -1)
|
||||
name_len = (ssize_t)strlen(name) + 1; // we need the terminating null too
|
||||
|
||||
debug(D_DICTIONARY, "DEL dictionary entry with name '%s'.", name);
|
||||
netdata_log_debug(D_DICTIONARY, "DEL dictionary entry with name '%s'.", name);
|
||||
|
||||
// Unfortunately, the JudyHSDel() does not return the value of the
|
||||
// item that was deleted, so we have to find it before we delete it,
|
||||
|
@ -1605,7 +1605,7 @@ static DICTIONARY_ITEM *dict_item_add_or_reset_value_and_acquire(DICTIONARY *dic
|
|||
if(name_len == -1)
|
||||
name_len = (ssize_t)strlen(name) + 1; // we need the terminating null too
|
||||
|
||||
debug(D_DICTIONARY, "SET dictionary entry with name '%s'.", name);
|
||||
netdata_log_debug(D_DICTIONARY, "SET dictionary entry with name '%s'.", name);
|
||||
|
||||
// DISCUSSION:
|
||||
// Is it better to gain a read-lock and do a hashtable_get_unsafe()
|
||||
|
@ -1724,7 +1724,7 @@ static DICTIONARY_ITEM *dict_item_find_and_acquire(DICTIONARY *dict, const char
|
|||
if(name_len == -1)
|
||||
name_len = (ssize_t)strlen(name) + 1; // we need the terminating null too
|
||||
|
||||
debug(D_DICTIONARY, "GET dictionary entry with name '%s'.", name);
|
||||
netdata_log_debug(D_DICTIONARY, "GET dictionary entry with name '%s'.", name);
|
||||
|
||||
dictionary_index_lock_rdlock(dict);
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ static int clean_kprobe_event(FILE *out, char *filename, char *father_pid, netda
|
|||
|
||||
int clean_kprobe_events(FILE *out, int pid, netdata_ebpf_events_t *ptr)
|
||||
{
|
||||
debug(D_EXIT, "Cleaning parent process events.");
|
||||
char filename[FILENAME_MAX + 1];
|
||||
snprintf(filename, FILENAME_MAX, "%s%s", NETDATA_DEBUGFS, "kprobe_events");
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ SILENCERS *silencers;
|
|||
*/
|
||||
SILENCER *create_silencer(void) {
|
||||
SILENCER *t = callocz(1, sizeof(SILENCER));
|
||||
debug(D_HEALTH, "HEALTH command API: Created empty silencer");
|
||||
netdata_log_debug(D_HEALTH, "HEALTH command API: Created empty silencer");
|
||||
|
||||
return t;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ void health_silencers_add(SILENCER *silencer) {
|
|||
// Add the created instance to the linked list in silencers
|
||||
silencer->next = silencers->silencers;
|
||||
silencers->silencers = silencer;
|
||||
debug(D_HEALTH, "HEALTH command API: Added silencer %s:%s:%s:%s:%s", silencer->alarms,
|
||||
netdata_log_debug(D_HEALTH, "HEALTH command API: Added silencer %s:%s:%s:%s:%s", silencer->alarms,
|
||||
silencer->charts, silencer->contexts, silencer->hosts, silencer->families
|
||||
);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ int health_silencers_json_read_callback(JSON_ENTRY *e)
|
|||
e->callback_function = health_silencers_json_read_callback;
|
||||
if(strcmp(e->name,"")) {
|
||||
// init silencer
|
||||
debug(D_HEALTH, "JSON: Got object with a name, initializing new silencer for %s",e->name);
|
||||
netdata_log_debug(D_HEALTH, "JSON: Got object with a name, initializing new silencer for %s",e->name);
|
||||
#endif
|
||||
e->callback_data = create_silencer();
|
||||
if(e->callback_data) {
|
||||
|
@ -133,18 +133,18 @@ int health_silencers_json_read_callback(JSON_ENTRY *e)
|
|||
|
||||
case JSON_STRING:
|
||||
if(!strcmp(e->name,"type")) {
|
||||
debug(D_HEALTH, "JSON: Processing type=%s",e->data.string);
|
||||
netdata_log_debug(D_HEALTH, "JSON: Processing type=%s",e->data.string);
|
||||
if (!strcmp(e->data.string,"SILENCE")) silencers->stype = STYPE_SILENCE_NOTIFICATIONS;
|
||||
else if (!strcmp(e->data.string,"DISABLE")) silencers->stype = STYPE_DISABLE_ALARMS;
|
||||
} else {
|
||||
debug(D_HEALTH, "JSON: Adding %s=%s", e->name, e->data.string);
|
||||
netdata_log_debug(D_HEALTH, "JSON: Adding %s=%s", e->name, e->data.string);
|
||||
if (e->callback_data)
|
||||
(void)health_silencers_addparam(e->callback_data, e->name, e->data.string);
|
||||
}
|
||||
break;
|
||||
|
||||
case JSON_BOOLEAN:
|
||||
debug(D_HEALTH, "JSON: Processing all_alarms");
|
||||
netdata_log_debug(D_HEALTH, "JSON: Processing all_alarms");
|
||||
silencers->all_alarms=e->data.boolean?1:0;
|
||||
break;
|
||||
|
||||
|
|
|
@ -1529,7 +1529,7 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p
|
|||
char *udir = strdupz_path_subpath(user_path, subpath);
|
||||
char *sdir = strdupz_path_subpath(stock_path, subpath);
|
||||
|
||||
debug(D_HEALTH, "CONFIG traversing user-config directory '%s', stock config directory '%s'", udir, sdir);
|
||||
netdata_log_debug(D_HEALTH, "CONFIG traversing user-config directory '%s', stock config directory '%s'", udir, sdir);
|
||||
|
||||
DIR *dir = opendir(udir);
|
||||
if (!dir) {
|
||||
|
@ -1543,7 +1543,7 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p
|
|||
(de->d_name[0] == '.' && de->d_name[1] == '\0') ||
|
||||
(de->d_name[0] == '.' && de->d_name[1] == '.' && de->d_name[2] == '\0')
|
||||
) {
|
||||
debug(D_HEALTH, "CONFIG ignoring user-config directory '%s/%s'", udir, de->d_name);
|
||||
netdata_log_debug(D_HEALTH, "CONFIG ignoring user-config directory '%s/%s'", udir, de->d_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1558,20 +1558,20 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p
|
|||
if(path_is_file(udir, de->d_name) &&
|
||||
len > 5 && !strcmp(&de->d_name[len - 5], ".conf")) {
|
||||
char *filename = strdupz_path_subpath(udir, de->d_name);
|
||||
debug(D_HEALTH, "CONFIG calling callback for user file '%s'", filename);
|
||||
netdata_log_debug(D_HEALTH, "CONFIG calling callback for user file '%s'", filename);
|
||||
callback(filename, data);
|
||||
freez(filename);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
debug(D_HEALTH, "CONFIG ignoring user-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type);
|
||||
netdata_log_debug(D_HEALTH, "CONFIG ignoring user-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
debug(D_HEALTH, "CONFIG traversing stock config directory '%s', user config directory '%s'", sdir, udir);
|
||||
netdata_log_debug(D_HEALTH, "CONFIG traversing stock config directory '%s', user config directory '%s'", sdir, udir);
|
||||
|
||||
dir = opendir(sdir);
|
||||
if (!dir) {
|
||||
|
@ -1586,7 +1586,7 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p
|
|||
(de->d_name[0] == '.' && de->d_name[1] == '\0') ||
|
||||
(de->d_name[0] == '.' && de->d_name[1] == '.' && de->d_name[2] == '\0')
|
||||
) {
|
||||
debug(D_HEALTH, "CONFIG ignoring stock config directory '%s/%s'", sdir, de->d_name);
|
||||
netdata_log_debug(D_HEALTH, "CONFIG ignoring stock config directory '%s/%s'", sdir, de->d_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1606,7 +1606,7 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p
|
|||
if(path_is_file(sdir, de->d_name) && !path_is_file(udir, de->d_name) &&
|
||||
len > 5 && !strcmp(&de->d_name[len - 5], ".conf")) {
|
||||
char *filename = strdupz_path_subpath(sdir, de->d_name);
|
||||
debug(D_HEALTH, "CONFIG calling callback for stock file '%s'", filename);
|
||||
netdata_log_debug(D_HEALTH, "CONFIG calling callback for stock file '%s'", filename);
|
||||
callback(filename, data);
|
||||
freez(filename);
|
||||
continue;
|
||||
|
@ -1614,13 +1614,13 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p
|
|||
|
||||
}
|
||||
|
||||
debug(D_HEALTH, "CONFIG ignoring stock-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type);
|
||||
netdata_log_debug(D_HEALTH, "CONFIG ignoring stock-config file '%s/%s' of type %d", udir, de->d_name, (int)de->d_type);
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
debug(D_HEALTH, "CONFIG done traversing user-config directory '%s', stock config directory '%s'", udir, sdir);
|
||||
netdata_log_debug(D_HEALTH, "CONFIG done traversing user-config directory '%s', stock config directory '%s'", udir, sdir);
|
||||
|
||||
freez(udir);
|
||||
freez(sdir);
|
||||
|
|
|
@ -135,29 +135,29 @@ int __netdata_mutex_unlock(netdata_mutex_t *mutex) {
|
|||
|
||||
int netdata_mutex_init_debug(const char *file __maybe_unused, const char *function __maybe_unused,
|
||||
const unsigned long line __maybe_unused, netdata_mutex_t *mutex) {
|
||||
debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_init(%p) from %lu@%s, %s()", mutex, line, file, function);
|
||||
netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_init(%p) from %lu@%s, %s()", mutex, line, file, function);
|
||||
|
||||
int ret = __netdata_mutex_init(mutex);
|
||||
|
||||
debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_init(%p) = %d, from %lu@%s, %s()", mutex, ret, line, file, function);
|
||||
netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_init(%p) = %d, from %lu@%s, %s()", mutex, ret, line, file, function);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int netdata_mutex_destroy_debug(const char *file __maybe_unused, const char *function __maybe_unused,
|
||||
const unsigned long line __maybe_unused, netdata_mutex_t *mutex) {
|
||||
debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_destroy(%p) from %lu@%s, %s()", mutex, line, file, function);
|
||||
netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_destroy(%p) from %lu@%s, %s()", mutex, line, file, function);
|
||||
|
||||
int ret = __netdata_mutex_destroy(mutex);
|
||||
|
||||
debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_destroy(%p) = %d, from %lu@%s, %s()", mutex, ret, line, file, function);
|
||||
netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_destroy(%p) = %d, from %lu@%s, %s()", mutex, ret, line, file, function);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int netdata_mutex_lock_debug(const char *file __maybe_unused, const char *function __maybe_unused,
|
||||
const unsigned long line __maybe_unused, netdata_mutex_t *mutex) {
|
||||
debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_lock(%p) from %lu@%s, %s()", mutex, line, file, function);
|
||||
netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_lock(%p) from %lu@%s, %s()", mutex, line, file, function);
|
||||
|
||||
usec_t start_s = now_monotonic_high_precision_usec();
|
||||
int ret = __netdata_mutex_lock(mutex);
|
||||
|
@ -167,14 +167,14 @@ int netdata_mutex_lock_debug(const char *file __maybe_unused, const char *functi
|
|||
(void)start_s;
|
||||
(void)end_s;
|
||||
|
||||
debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_lock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function);
|
||||
netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_lock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int netdata_mutex_trylock_debug(const char *file __maybe_unused, const char *function __maybe_unused,
|
||||
const unsigned long line __maybe_unused, netdata_mutex_t *mutex) {
|
||||
debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_trylock(%p) from %lu@%s, %s()", mutex, line, file, function);
|
||||
netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_trylock(%p) from %lu@%s, %s()", mutex, line, file, function);
|
||||
|
||||
usec_t start_s = now_monotonic_high_precision_usec();
|
||||
int ret = __netdata_mutex_trylock(mutex);
|
||||
|
@ -184,14 +184,14 @@ int netdata_mutex_trylock_debug(const char *file __maybe_unused, const char *fun
|
|||
(void)start_s;
|
||||
(void)end_s;
|
||||
|
||||
debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_trylock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function);
|
||||
netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_trylock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int netdata_mutex_unlock_debug(const char *file __maybe_unused, const char *function __maybe_unused,
|
||||
const unsigned long line __maybe_unused, netdata_mutex_t *mutex) {
|
||||
debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_unlock(%p) from %lu@%s, %s()", mutex, line, file, function);
|
||||
netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_unlock(%p) from %lu@%s, %s()", mutex, line, file, function);
|
||||
|
||||
usec_t start_s = now_monotonic_high_precision_usec();
|
||||
int ret = __netdata_mutex_unlock(mutex);
|
||||
|
@ -201,7 +201,7 @@ int netdata_mutex_unlock_debug(const char *file __maybe_unused, const char *func
|
|||
(void)start_s;
|
||||
(void)end_s;
|
||||
|
||||
debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_unlock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function);
|
||||
netdata_log_debug(D_LOCKS, "MUTEX_LOCK: netdata_mutex_unlock(%p) = %d in %llu usec, from %lu@%s, %s()", mutex, ret, end_s - start_s, line, file, function);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -109,11 +109,11 @@ typedef struct error_with_limit {
|
|||
#define error_limit_static_thread_var(var, log_every_secs, sleep_usecs) static __thread ERROR_LIMIT var = { .last_logged = 0, .count = 0, .log_every = (log_every_secs), .sleep_ut = (sleep_usecs) }
|
||||
|
||||
#ifdef NETDATA_INTERNAL_CHECKS
|
||||
#define debug(type, args...) do { if(unlikely(debug_flags & type)) debug_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
|
||||
#define netdata_log_debug(type, args...) do { if(unlikely(debug_flags & type)) debug_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
|
||||
#define internal_error(condition, args...) do { if(unlikely(condition)) error_int(0, "IERR", __FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
|
||||
#define internal_fatal(condition, args...) do { if(unlikely(condition)) fatal_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0)
|
||||
#else
|
||||
#define debug(type, args...) debug_dummy()
|
||||
#define netdata_log_debug(type, args...) debug_dummy()
|
||||
#define internal_error(args...) debug_dummy()
|
||||
#define internal_fatal(args...) debug_dummy()
|
||||
#endif
|
||||
|
|
|
@ -75,7 +75,7 @@ long get_system_cpus_with_cache(bool cache, bool for_netdata) {
|
|||
if(processors[index] < 1)
|
||||
processors[index] = 1;
|
||||
|
||||
debug(D_SYSTEM, "System has %ld processors.", processors[index]);
|
||||
netdata_log_debug(D_SYSTEM, "System has %ld processors.", processors[index]);
|
||||
return processors[index];
|
||||
|
||||
#endif /* __APPLE__, __FreeBSD__ */
|
||||
|
|
|
@ -384,7 +384,7 @@ int netdata_pclose(FILE *fp_child_input, FILE *fp_child_output, pid_t pid) {
|
|||
int ret;
|
||||
siginfo_t info;
|
||||
|
||||
debug(D_EXIT, "Request to netdata_pclose() on pid %d", pid);
|
||||
netdata_log_debug(D_EXIT, "Request to netdata_pclose() on pid %d", pid);
|
||||
|
||||
if (fp_child_input)
|
||||
fclose(fp_child_input);
|
||||
|
|
|
@ -48,11 +48,11 @@ char *procfile_filename(procfile *ff) {
|
|||
// An array of words
|
||||
|
||||
static inline void procfile_words_add(procfile *ff, char *str) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": adding word No %d: '%s'", fw->len, str);
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": adding word No %d: '%s'", fw->len, str);
|
||||
|
||||
pfwords *fw = ff->words;
|
||||
if(unlikely(fw->len == fw->size)) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": expanding words");
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": expanding words");
|
||||
size_t minimum = PFWORDS_INCREASE_STEP;
|
||||
size_t optimal = fw->size / 2;
|
||||
size_t wanted = (optimal > minimum)?optimal:minimum;
|
||||
|
@ -66,7 +66,7 @@ static inline void procfile_words_add(procfile *ff, char *str) {
|
|||
|
||||
NEVERNULL
|
||||
static inline pfwords *procfile_words_create(void) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": initializing words");
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": initializing words");
|
||||
|
||||
size_t size = (procfile_adaptive_initial_allocation) ? procfile_max_words : PFWORDS_INCREASE_STEP;
|
||||
|
||||
|
@ -77,12 +77,12 @@ static inline pfwords *procfile_words_create(void) {
|
|||
}
|
||||
|
||||
static inline void procfile_words_reset(pfwords *fw) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": resetting words");
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": resetting words");
|
||||
fw->len = 0;
|
||||
}
|
||||
|
||||
static inline void procfile_words_free(pfwords *fw) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": freeing words");
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": freeing words");
|
||||
|
||||
freez(fw);
|
||||
}
|
||||
|
@ -93,11 +93,11 @@ static inline void procfile_words_free(pfwords *fw) {
|
|||
|
||||
NEVERNULL
|
||||
static inline size_t *procfile_lines_add(procfile *ff) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": adding line %d at word %d", fl->len, first_word);
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": adding line %d at word %d", fl->len, first_word);
|
||||
|
||||
pflines *fl = ff->lines;
|
||||
if(unlikely(fl->len == fl->size)) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": expanding lines");
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": expanding lines");
|
||||
size_t minimum = PFLINES_INCREASE_STEP;
|
||||
size_t optimal = fl->size / 2;
|
||||
size_t wanted = (optimal > minimum)?optimal:minimum;
|
||||
|
@ -115,7 +115,7 @@ static inline size_t *procfile_lines_add(procfile *ff) {
|
|||
|
||||
NEVERNULL
|
||||
static inline pflines *procfile_lines_create(void) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": initializing lines");
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": initializing lines");
|
||||
|
||||
size_t size = (unlikely(procfile_adaptive_initial_allocation)) ? procfile_max_words : PFLINES_INCREASE_STEP;
|
||||
|
||||
|
@ -126,13 +126,13 @@ static inline pflines *procfile_lines_create(void) {
|
|||
}
|
||||
|
||||
static inline void procfile_lines_reset(pflines *fl) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": resetting lines");
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": resetting lines");
|
||||
|
||||
fl->len = 0;
|
||||
}
|
||||
|
||||
static inline void procfile_lines_free(pflines *fl) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": freeing lines");
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": freeing lines");
|
||||
|
||||
freez(fl);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ static inline void procfile_lines_free(pflines *fl) {
|
|||
void procfile_close(procfile *ff) {
|
||||
if(unlikely(!ff)) return;
|
||||
|
||||
debug(D_PROCFILE, PF_PREFIX ": Closing file '%s'", procfile_filename(ff));
|
||||
netdata_log_debug(D_PROCFILE, PF_PREFIX ": Closing file '%s'", procfile_filename(ff));
|
||||
|
||||
freez(ff->filename);
|
||||
procfile_lines_free(ff->lines);
|
||||
|
@ -156,7 +156,7 @@ void procfile_close(procfile *ff) {
|
|||
|
||||
NOINLINE
|
||||
static void procfile_parser(procfile *ff) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": Parsing file '%s'", ff->filename);
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": Parsing file '%s'", ff->filename);
|
||||
|
||||
char *s = ff->data // our current position
|
||||
, *e = &ff->data[ff->len] // the terminating null
|
||||
|
@ -206,7 +206,7 @@ static void procfile_parser(procfile *ff) {
|
|||
(*line_words)++;
|
||||
t = ++s;
|
||||
|
||||
// debug(D_PROCFILE, PF_PREFIX ": ended line %d with %d words", l, ff->lines->lines[l].words);
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": ended line %d with %d words", l, ff->lines->lines[l].words);
|
||||
|
||||
line_words = procfile_lines_add(ff);
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ static void procfile_parser(procfile *ff) {
|
|||
}
|
||||
|
||||
procfile *procfile_readall(procfile *ff) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": Reading file '%s'.", ff->filename);
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": Reading file '%s'.", ff->filename);
|
||||
|
||||
ff->len = 0; // zero the used size
|
||||
ssize_t r = 1; // read at least once
|
||||
|
@ -288,12 +288,12 @@ procfile *procfile_readall(procfile *ff) {
|
|||
size_t optimal = ff->size / 2;
|
||||
size_t wanted = (optimal > minimum)?optimal:minimum;
|
||||
|
||||
debug(D_PROCFILE, PF_PREFIX ": Expanding data buffer for file '%s' by %zu bytes.", procfile_filename(ff), wanted);
|
||||
netdata_log_debug(D_PROCFILE, PF_PREFIX ": Expanding data buffer for file '%s' by %zu bytes.", procfile_filename(ff), wanted);
|
||||
ff = reallocz(ff, sizeof(procfile) + ff->size + wanted);
|
||||
ff->size += wanted;
|
||||
}
|
||||
|
||||
debug(D_PROCFILE, "Reading file '%s', from position %zd with length %zd", procfile_filename(ff), s, (ssize_t)(ff->size - s));
|
||||
netdata_log_debug(D_PROCFILE, "Reading file '%s', from position %zd with length %zd", procfile_filename(ff), s, (ssize_t)(ff->size - s));
|
||||
r = read(ff->fd, &ff->data[s], ff->size - s);
|
||||
if(unlikely(r == -1)) {
|
||||
if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) collector_error(PF_PREFIX ": Cannot read from file '%s' on fd %d", procfile_filename(ff), ff->fd);
|
||||
|
@ -306,7 +306,7 @@ procfile *procfile_readall(procfile *ff) {
|
|||
ff->len += r;
|
||||
}
|
||||
|
||||
// debug(D_PROCFILE, "Rewinding file '%s'", ff->filename);
|
||||
// netdata_log_debug(D_PROCFILE, "Rewinding file '%s'", ff->filename);
|
||||
if(unlikely(lseek(ff->fd, 0, SEEK_SET) == -1)) {
|
||||
if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) collector_error(PF_PREFIX ": Cannot rewind on file '%s'.", procfile_filename(ff));
|
||||
else if(unlikely(ff->flags & PROCFILE_FLAG_ERROR_ON_ERROR_LOG))
|
||||
|
@ -325,7 +325,7 @@ procfile *procfile_readall(procfile *ff) {
|
|||
if(unlikely(ff->words->len > procfile_max_words)) procfile_max_words = ff->words->len;
|
||||
}
|
||||
|
||||
// debug(D_PROCFILE, "File '%s' updated.", ff->filename);
|
||||
// netdata_log_debug(D_PROCFILE, "File '%s' updated.", ff->filename);
|
||||
return ff;
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ void procfile_set_open_close(procfile *ff, const char *open, const char *close)
|
|||
}
|
||||
|
||||
procfile *procfile_open(const char *filename, const char *separators, uint32_t flags) {
|
||||
debug(D_PROCFILE, PF_PREFIX ": Opening file '%s'", filename);
|
||||
netdata_log_debug(D_PROCFILE, PF_PREFIX ": Opening file '%s'", filename);
|
||||
|
||||
int fd = open(filename, procfile_open_flags, 0666);
|
||||
if(unlikely(fd == -1)) {
|
||||
|
@ -430,7 +430,7 @@ procfile *procfile_open(const char *filename, const char *separators, uint32_t f
|
|||
|
||||
procfile_set_separators(ff, separators);
|
||||
|
||||
debug(D_PROCFILE, "File '%s' opened.", filename);
|
||||
netdata_log_debug(D_PROCFILE, "File '%s' opened.", filename);
|
||||
return ff;
|
||||
}
|
||||
|
||||
|
@ -469,17 +469,17 @@ void procfile_print(procfile *ff) {
|
|||
char *s;
|
||||
(void)s;
|
||||
|
||||
debug(D_PROCFILE, "File '%s' with %zu lines and %zu words", procfile_filename(ff), ff->lines->len, ff->words->len);
|
||||
netdata_log_debug(D_PROCFILE, "File '%s' with %zu lines and %zu words", procfile_filename(ff), ff->lines->len, ff->words->len);
|
||||
|
||||
for(l = 0; likely(l < lines) ;l++) {
|
||||
size_t words = procfile_linewords(ff, l);
|
||||
|
||||
debug(D_PROCFILE, " line %zu starts at word %zu and has %zu words", l, ff->lines->lines[l].first, ff->lines->lines[l].words);
|
||||
netdata_log_debug(D_PROCFILE, " line %zu starts at word %zu and has %zu words", l, ff->lines->lines[l].first, ff->lines->lines[l].words);
|
||||
|
||||
size_t w;
|
||||
for(w = 0; likely(w < words) ;w++) {
|
||||
s = procfile_lineword(ff, l, w);
|
||||
debug(D_PROCFILE, " [%zu.%zu] '%s'", l, w, s);
|
||||
netdata_log_debug(D_PROCFILE, " [%zu.%zu] '%s'", l, w, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -326,10 +326,10 @@ extern void simple_pattern_dump(uint64_t debug_type, SIMPLE_PATTERN *p)
|
|||
{
|
||||
struct simple_pattern *root = (struct simple_pattern *)p;
|
||||
if(root==NULL) {
|
||||
debug(debug_type,"dump_pattern(NULL)");
|
||||
netdata_log_debug(debug_type,"dump_pattern(NULL)");
|
||||
return;
|
||||
}
|
||||
debug(debug_type,"dump_pattern(%p) child=%p next=%p mode=%u match=%s", root, root->child, root->next, root->mode,
|
||||
netdata_log_debug(debug_type,"dump_pattern(%p) child=%p next=%p mode=%u match=%s", root, root->child, root->next, root->mode,
|
||||
root->match);
|
||||
if(root->child!=NULL)
|
||||
simple_pattern_dump(debug_type, (SIMPLE_PATTERN*)root->child);
|
||||
|
|
|
@ -406,7 +406,7 @@ bool netdata_ssl_accept(NETDATA_SSL *ssl) {
|
|||
static void netdata_ssl_info_callback(const SSL *ssl, int where, int ret __maybe_unused) {
|
||||
(void)ssl;
|
||||
if (where & SSL_CB_ALERT) {
|
||||
debug(D_WEB_CLIENT,"SSL INFO CALLBACK %s %s", SSL_alert_type_string(ret), SSL_alert_desc_string_long(ret));
|
||||
netdata_log_debug(D_WEB_CLIENT,"SSL INFO CALLBACK %s %s", SSL_alert_type_string(ret), SSL_alert_desc_string_long(ret));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -559,7 +559,7 @@ static SSL_CTX * netdata_ssl_create_server_ctx(unsigned long mode) {
|
|||
#if (OPENSSL_VERSION_NUMBER < OPENSSL_VERSION_095)
|
||||
SSL_CTX_set_verify_depth(ctx,1);
|
||||
#endif
|
||||
debug(D_WEB_CLIENT,"SSL GLOBAL CONTEXT STARTED\n");
|
||||
netdata_log_debug(D_WEB_CLIENT,"SSL GLOBAL CONTEXT STARTED\n");
|
||||
|
||||
SSL_CTX_set_mode(ctx, mode);
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ char *strdup_client_description(int family, const char *protocol, const char *ip
|
|||
int create_listen_socket_unix(const char *path, int listen_backlog) {
|
||||
int sock;
|
||||
|
||||
debug(D_LISTENER, "LISTENER: UNIX creating new listening socket on path '%s'", path);
|
||||
netdata_log_debug(D_LISTENER, "LISTENER: UNIX creating new listening socket on path '%s'", path);
|
||||
|
||||
sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if(sock < 0) {
|
||||
|
@ -253,14 +253,14 @@ int create_listen_socket_unix(const char *path, int listen_backlog) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
debug(D_LISTENER, "LISTENER: Listening on UNIX path '%s'", path);
|
||||
netdata_log_debug(D_LISTENER, "LISTENER: Listening on UNIX path '%s'", path);
|
||||
return sock;
|
||||
}
|
||||
|
||||
int create_listen_socket4(int socktype, const char *ip, uint16_t port, int listen_backlog) {
|
||||
int sock;
|
||||
|
||||
debug(D_LISTENER, "LISTENER: IPv4 creating new listening socket on ip '%s' port %d, socktype %d", ip, port, socktype);
|
||||
netdata_log_debug(D_LISTENER, "LISTENER: IPv4 creating new listening socket on ip '%s' port %d, socktype %d", ip, port, socktype);
|
||||
|
||||
sock = socket(AF_INET, socktype, 0);
|
||||
if(sock < 0) {
|
||||
|
@ -297,7 +297,7 @@ int create_listen_socket4(int socktype, const char *ip, uint16_t port, int liste
|
|||
return -1;
|
||||
}
|
||||
|
||||
debug(D_LISTENER, "LISTENER: Listening on IPv4 ip '%s' port %d, socktype %d", ip, port, socktype);
|
||||
netdata_log_debug(D_LISTENER, "LISTENER: Listening on IPv4 ip '%s' port %d, socktype %d", ip, port, socktype);
|
||||
return sock;
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ int create_listen_socket6(int socktype, uint32_t scope_id, const char *ip, int p
|
|||
int sock;
|
||||
int ipv6only = 1;
|
||||
|
||||
debug(D_LISTENER, "LISTENER: IPv6 creating new listening socket on ip '%s' port %d, socktype %d", ip, port, socktype);
|
||||
netdata_log_debug(D_LISTENER, "LISTENER: IPv6 creating new listening socket on ip '%s' port %d, socktype %d", ip, port, socktype);
|
||||
|
||||
sock = socket(AF_INET6, socktype, 0);
|
||||
if (sock < 0) {
|
||||
|
@ -349,7 +349,7 @@ int create_listen_socket6(int socktype, uint32_t scope_id, const char *ip, int p
|
|||
return -1;
|
||||
}
|
||||
|
||||
debug(D_LISTENER, "LISTENER: Listening on IPv6 ip '%s' port %d, socktype %d", ip, port, socktype);
|
||||
netdata_log_debug(D_LISTENER, "LISTENER: Listening on IPv6 ip '%s' port %d, socktype %d", ip, port, socktype);
|
||||
return sock;
|
||||
}
|
||||
|
||||
|
@ -603,7 +603,7 @@ static inline int bind_to_this(LISTEN_SOCKETS *sockets, const char *definition,
|
|||
}
|
||||
|
||||
default:
|
||||
debug(D_LISTENER, "LISTENER: Unknown socket family %d", family);
|
||||
netdata_log_debug(D_LISTENER, "LISTENER: Unknown socket family %d", family);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -635,7 +635,7 @@ int listen_sockets_setup(LISTEN_SOCKETS *sockets) {
|
|||
}
|
||||
else sockets->default_port = (uint16_t)new_port;
|
||||
|
||||
debug(D_OPTIONS, "LISTENER: Default listen port set to %d.", sockets->default_port);
|
||||
netdata_log_debug(D_OPTIONS, "LISTENER: Default listen port set to %d.", sockets->default_port);
|
||||
|
||||
char *s = appconfig_get(sockets->config, sockets->config_section, "bind to", sockets->default_bind_to);
|
||||
while(*s) {
|
||||
|
@ -697,7 +697,7 @@ static inline int connect_to_unix(const char *path, struct timeval *timeout) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
debug(D_CONNECT_TO, "Connected to UNIX socket on path '%s'.", path);
|
||||
netdata_log_debug(D_CONNECT_TO, "Connected to UNIX socket on path '%s'.", path);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ int connect_to_this_ip46(int protocol, int socktype, const char *host, uint32_t
|
|||
sizeof(servBfr),
|
||||
NI_NUMERICHOST | NI_NUMERICSERV);
|
||||
|
||||
debug(D_CONNECT_TO, "Address info: host = '%s', service = '%s', ai_flags = 0x%02X, ai_family = %d (PF_INET = %d, PF_INET6 = %d), ai_socktype = %d (SOCK_STREAM = %d, SOCK_DGRAM = %d), ai_protocol = %d (IPPROTO_TCP = %d, IPPROTO_UDP = %d), ai_addrlen = %lu (sockaddr_in = %lu, sockaddr_in6 = %lu)",
|
||||
netdata_log_debug(D_CONNECT_TO, "Address info: host = '%s', service = '%s', ai_flags = 0x%02X, ai_family = %d (PF_INET = %d, PF_INET6 = %d), ai_socktype = %d (SOCK_STREAM = %d, SOCK_DGRAM = %d), ai_protocol = %d (IPPROTO_TCP = %d, IPPROTO_UDP = %d), ai_addrlen = %lu (sockaddr_in = %lu, sockaddr_in6 = %lu)",
|
||||
hostBfr,
|
||||
servBfr,
|
||||
(unsigned int)ai->ai_flags,
|
||||
|
@ -770,7 +770,7 @@ int connect_to_this_ip46(int protocol, int socktype, const char *host, uint32_t
|
|||
struct sockaddr_in *pSadrIn = (struct sockaddr_in *)ai->ai_addr;
|
||||
(void)pSadrIn;
|
||||
|
||||
debug(D_CONNECT_TO, "ai_addr = sin_family: %d (AF_INET = %d, AF_INET6 = %d), sin_addr: '%s', sin_port: '%s'",
|
||||
netdata_log_debug(D_CONNECT_TO, "ai_addr = sin_family: %d (AF_INET = %d, AF_INET6 = %d), sin_addr: '%s', sin_port: '%s'",
|
||||
pSadrIn->sin_family,
|
||||
AF_INET,
|
||||
AF_INET6,
|
||||
|
@ -783,7 +783,7 @@ int connect_to_this_ip46(int protocol, int socktype, const char *host, uint32_t
|
|||
struct sockaddr_in6 *pSadrIn6 = (struct sockaddr_in6 *) ai->ai_addr;
|
||||
(void)pSadrIn6;
|
||||
|
||||
debug(D_CONNECT_TO,"ai_addr = sin6_family: %d (AF_INET = %d, AF_INET6 = %d), sin6_addr: '%s', sin6_port: '%s', sin6_flowinfo: %u, sin6_scope_id: %u",
|
||||
netdata_log_debug(D_CONNECT_TO,"ai_addr = sin6_family: %d (AF_INET = %d, AF_INET6 = %d), sin6_addr: '%s', sin6_port: '%s', sin6_flowinfo: %u, sin6_scope_id: %u",
|
||||
pSadrIn6->sin6_family,
|
||||
AF_INET,
|
||||
AF_INET6,
|
||||
|
@ -795,7 +795,7 @@ int connect_to_this_ip46(int protocol, int socktype, const char *host, uint32_t
|
|||
}
|
||||
|
||||
default: {
|
||||
debug(D_CONNECT_TO, "Unknown protocol family %d.", ai->ai_family);
|
||||
netdata_log_debug(D_CONNECT_TO, "Unknown protocol family %d.", ai->ai_family);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -854,7 +854,7 @@ int connect_to_this_ip46(int protocol, int socktype, const char *host, uint32_t
|
|||
}
|
||||
|
||||
if(fd != -1)
|
||||
debug(D_CONNECT_TO, "Connected to '%s' on port '%s'.", hostBfr, servBfr);
|
||||
netdata_log_debug(D_CONNECT_TO, "Connected to '%s' on port '%s'.", hostBfr, servBfr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -930,7 +930,7 @@ int connect_to_this(const char *definition, int default_port, struct timeval *ti
|
|||
service = e;
|
||||
}
|
||||
|
||||
debug(D_CONNECT_TO, "Attempting connection to host = '%s', service = '%s', interface = '%s', protocol = %d (tcp = %d, udp = %d)", host, service, interface, protocol, IPPROTO_TCP, IPPROTO_UDP);
|
||||
netdata_log_debug(D_CONNECT_TO, "Attempting connection to host = '%s', service = '%s', interface = '%s', protocol = %d (tcp = %d, udp = %d)", host, service, interface, protocol, IPPROTO_TCP, IPPROTO_UDP);
|
||||
|
||||
if(!*host) {
|
||||
netdata_log_error("Definition '%s' does not specify a host.", definition);
|
||||
|
@ -1189,7 +1189,7 @@ int accept4(int sock, struct sockaddr *addr, socklen_t *addrlen, int flags) {
|
|||
int connection_allowed(int fd, char *client_ip, char *client_host, size_t hostsize, SIMPLE_PATTERN *access_list,
|
||||
const char *patname, int allow_dns)
|
||||
{
|
||||
debug(D_LISTENER,"checking %s... (allow_dns=%d)", patname, allow_dns);
|
||||
netdata_log_debug(D_LISTENER,"checking %s... (allow_dns=%d)", patname, allow_dns);
|
||||
if (!access_list)
|
||||
return 1;
|
||||
if (simple_pattern_matches(access_list, client_ip))
|
||||
|
@ -1231,7 +1231,7 @@ int connection_allowed(int fd, char *client_ip, char *client_host, size_t hostsi
|
|||
inet_ntop(AF_INET6, &((struct sockaddr_in6*)(scan->ai_addr))->sin6_addr, address, INET6_ADDRSTRLEN);
|
||||
break;
|
||||
}
|
||||
debug(D_LISTENER, "Incoming ip %s rev-resolved onto %s, validating against forward-resolution %s",
|
||||
netdata_log_debug(D_LISTENER, "Incoming ip %s rev-resolved onto %s, validating against forward-resolution %s",
|
||||
client_ip, client_host, address);
|
||||
if (!strcmp(client_ip, address)) {
|
||||
validated = 1;
|
||||
|
@ -1248,7 +1248,7 @@ int connection_allowed(int fd, char *client_ip, char *client_host, size_t hostsi
|
|||
freeaddrinfo(addr_infos);
|
||||
}
|
||||
if (!simple_pattern_matches(access_list, client_host)) {
|
||||
debug(D_LISTENER, "Incoming connection on '%s' (%s) does not match allowed pattern for %s",
|
||||
netdata_log_debug(D_LISTENER, "Incoming connection on '%s' (%s) does not match allowed pattern for %s",
|
||||
client_ip, client_host, patname);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1284,26 +1284,26 @@ int accept_socket(int fd, int flags, char *client_ip, size_t ipsize, char *clien
|
|||
|
||||
switch (((struct sockaddr *)&sadr)->sa_family) {
|
||||
case AF_UNIX:
|
||||
debug(D_LISTENER, "New UNIX domain web client from %s on socket %d.", client_ip, fd);
|
||||
netdata_log_debug(D_LISTENER, "New UNIX domain web client from %s on socket %d.", client_ip, fd);
|
||||
// set the port - certain versions of libc return garbage on unix sockets
|
||||
strncpyz(client_port, "UNIX", portsize);
|
||||
break;
|
||||
|
||||
case AF_INET:
|
||||
debug(D_LISTENER, "New IPv4 web client from %s port %s on socket %d.", client_ip, client_port, fd);
|
||||
netdata_log_debug(D_LISTENER, "New IPv4 web client from %s port %s on socket %d.", client_ip, client_port, fd);
|
||||
break;
|
||||
|
||||
case AF_INET6:
|
||||
if (strncmp(client_ip, "::ffff:", 7) == 0) {
|
||||
memmove(client_ip, &client_ip[7], strlen(&client_ip[7]) + 1);
|
||||
debug(D_LISTENER, "New IPv4 web client from %s port %s on socket %d.", client_ip, client_port, fd);
|
||||
netdata_log_debug(D_LISTENER, "New IPv4 web client from %s port %s on socket %d.", client_ip, client_port, fd);
|
||||
}
|
||||
else
|
||||
debug(D_LISTENER, "New IPv6 web client from %s port %s on socket %d.", client_ip, client_port, fd);
|
||||
netdata_log_debug(D_LISTENER, "New IPv6 web client from %s port %s on socket %d.", client_ip, client_port, fd);
|
||||
break;
|
||||
|
||||
default:
|
||||
debug(D_LISTENER, "New UNKNOWN web client from %s port %s on socket %d.", client_ip, client_port, fd);
|
||||
netdata_log_debug(D_LISTENER, "New UNKNOWN web client from %s port %s on socket %d.", client_ip, client_port, fd);
|
||||
break;
|
||||
}
|
||||
if (!connection_allowed(nfd, client_ip, client_host, hostsize, access_list, "connection", allow_dns)) {
|
||||
|
@ -1344,7 +1344,7 @@ inline POLLINFO *poll_add_fd(POLLJOB *p
|
|||
, int (*snd_callback)(POLLINFO * /*pi*/, short int * /*events*/)
|
||||
, void *data
|
||||
) {
|
||||
debug(D_POLLFD, "POLLFD: ADD: request to add fd %d, slots = %zu, used = %zu, min = %zu, max = %zu, next free = %zd", fd, p->slots, p->used, p->min, p->max, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: ADD: request to add fd %d, slots = %zu, used = %zu, min = %zu, max = %zu, next free = %zd", fd, p->slots, p->used, p->min, p->max, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
|
||||
|
||||
if(unlikely(fd < 0)) return NULL;
|
||||
|
||||
|
@ -1356,7 +1356,7 @@ inline POLLINFO *poll_add_fd(POLLJOB *p
|
|||
|
||||
if(unlikely(!p->first_free)) {
|
||||
size_t new_slots = p->slots + POLL_FDS_INCREASE_STEP;
|
||||
debug(D_POLLFD, "POLLFD: ADD: increasing size (current = %zu, new = %zu, used = %zu, min = %zu, max = %zu)", p->slots, new_slots, p->used, p->min, p->max);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: ADD: increasing size (current = %zu, new = %zu, used = %zu, min = %zu, max = %zu)", p->slots, new_slots, p->used, p->min, p->max);
|
||||
|
||||
p->fds = reallocz(p->fds, sizeof(struct pollfd) * new_slots);
|
||||
p->inf = reallocz(p->inf, sizeof(POLLINFO) * new_slots);
|
||||
|
@ -1364,7 +1364,7 @@ inline POLLINFO *poll_add_fd(POLLJOB *p
|
|||
// reset all the newly added slots
|
||||
ssize_t i;
|
||||
for(i = new_slots - 1; i >= (ssize_t)p->slots ; i--) {
|
||||
debug(D_POLLFD, "POLLFD: ADD: resetting new slot %zd", i);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: ADD: resetting new slot %zd", i);
|
||||
p->fds[i].fd = -1;
|
||||
p->fds[i].events = 0;
|
||||
p->fds[i].revents = 0;
|
||||
|
@ -1395,7 +1395,7 @@ inline POLLINFO *poll_add_fd(POLLJOB *p
|
|||
POLLINFO *pi = p->first_free;
|
||||
p->first_free = p->first_free->next;
|
||||
|
||||
debug(D_POLLFD, "POLLFD: ADD: selected slot %zu, next free is %zd", pi->slot, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: ADD: selected slot %zu, next free is %zd", pi->slot, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
|
||||
|
||||
struct pollfd *pf = &p->fds[pi->slot];
|
||||
pf->fd = fd;
|
||||
|
@ -1437,7 +1437,7 @@ inline POLLINFO *poll_add_fd(POLLJOB *p
|
|||
}
|
||||
netdata_thread_enable_cancelability();
|
||||
|
||||
debug(D_POLLFD, "POLLFD: ADD: completed, slots = %zu, used = %zu, min = %zu, max = %zu, next free = %zd", p->slots, p->used, p->min, p->max, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: ADD: completed, slots = %zu, used = %zu, min = %zu, max = %zu, next free = %zd", p->slots, p->used, p->min, p->max, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
|
||||
|
||||
return pi;
|
||||
}
|
||||
|
@ -1446,7 +1446,7 @@ inline void poll_close_fd(POLLINFO *pi) {
|
|||
POLLJOB *p = pi->p;
|
||||
|
||||
struct pollfd *pf = &p->fds[pi->slot];
|
||||
debug(D_POLLFD, "POLLFD: DEL: request to clear slot %zu (fd %d), old next free was %zd", pi->slot, pf->fd, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: DEL: request to clear slot %zu (fd %d), old next free was %zd", pi->slot, pf->fd, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
|
||||
|
||||
if(unlikely(pf->fd == -1)) return;
|
||||
|
||||
|
@ -1499,7 +1499,7 @@ inline void poll_close_fd(POLLINFO *pi) {
|
|||
}
|
||||
netdata_thread_enable_cancelability();
|
||||
|
||||
debug(D_POLLFD, "POLLFD: DEL: completed, slots = %zu, used = %zu, min = %zu, max = %zu, next free = %zd", p->slots, p->used, p->min, p->max, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: DEL: completed, slots = %zu, used = %zu, min = %zu, max = %zu, next free = %zd", p->slots, p->used, p->min, p->max, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
|
||||
}
|
||||
|
||||
void *poll_default_add_callback(POLLINFO *pi, short int *events, void *data) {
|
||||
|
@ -1586,7 +1586,7 @@ static inline int poll_process_send(POLLJOB *p, POLLINFO *pi, struct pollfd *pf,
|
|||
pi->last_sent_t = now;
|
||||
pi->send_count++;
|
||||
|
||||
debug(D_POLLFD, "POLLFD: LISTENER: sending data to socket on slot %zu (fd %d)", pi->slot, pf->fd);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: sending data to socket on slot %zu (fd %d)", pi->slot, pf->fd);
|
||||
|
||||
pf->events = 0;
|
||||
|
||||
|
@ -1607,7 +1607,7 @@ static inline int poll_process_tcp_read(POLLJOB *p, POLLINFO *pi, struct pollfd
|
|||
pi->last_received_t = now;
|
||||
pi->recv_count++;
|
||||
|
||||
debug(D_POLLFD, "POLLFD: LISTENER: reading data from TCP client slot %zu (fd %d)", pi->slot, pf->fd);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: reading data from TCP client slot %zu (fd %d)", pi->slot, pf->fd);
|
||||
|
||||
pf->events = 0;
|
||||
|
||||
|
@ -1628,7 +1628,7 @@ static inline int poll_process_udp_read(POLLINFO *pi, struct pollfd *pf, time_t
|
|||
pi->last_received_t = now;
|
||||
pi->recv_count++;
|
||||
|
||||
debug(D_POLLFD, "POLLFD: LISTENER: reading data from UDP slot %zu (fd %d)", pi->slot, pf->fd);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: reading data from UDP slot %zu (fd %d)", pi->slot, pf->fd);
|
||||
|
||||
// TODO: access_list is not applied to UDP
|
||||
// but checking the access list on every UDP packet will destroy
|
||||
|
@ -1648,13 +1648,13 @@ static int poll_process_new_tcp_connection(POLLJOB *p, POLLINFO *pi, struct poll
|
|||
pi->last_received_t = now;
|
||||
pi->recv_count++;
|
||||
|
||||
debug(D_POLLFD, "POLLFD: LISTENER: accepting connections from slot %zu (fd %d)", pi->slot, pf->fd);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: accepting connections from slot %zu (fd %d)", pi->slot, pf->fd);
|
||||
|
||||
char client_ip[INET6_ADDRSTRLEN] = "";
|
||||
char client_port[NI_MAXSERV] = "";
|
||||
char client_host[NI_MAXHOST] = "";
|
||||
|
||||
debug(D_POLLFD, "POLLFD: LISTENER: calling accept4() slot %zu (fd %d)", pi->slot, pf->fd);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: calling accept4() slot %zu (fd %d)", pi->slot, pf->fd);
|
||||
|
||||
int nfd = accept_socket(
|
||||
pf->fd,SOCK_NONBLOCK,
|
||||
|
@ -1665,7 +1665,7 @@ static int poll_process_new_tcp_connection(POLLJOB *p, POLLINFO *pi, struct poll
|
|||
if (unlikely(nfd < 0)) {
|
||||
// accept failed
|
||||
|
||||
debug(D_POLLFD, "POLLFD: LISTENER: accept4() slot %zu (fd %d) failed.", pi->slot, pf->fd);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: accept4() slot %zu (fd %d) failed.", pi->slot, pf->fd);
|
||||
|
||||
if(unlikely(errno == EMFILE)) {
|
||||
error_limit_static_global_var(erl, 10, 1000);
|
||||
|
@ -1797,7 +1797,7 @@ void poll_events(LISTEN_SOCKETS *sockets
|
|||
now_usec = now_boottime_usec();
|
||||
|
||||
if(unlikely(timer_usec && now_usec >= next_timer_usec)) {
|
||||
debug(D_POLLFD, "Calling timer callback after %zu usec", (size_t)(now_usec - last_timer_usec));
|
||||
netdata_log_debug(D_POLLFD, "Calling timer callback after %zu usec", (size_t)(now_usec - last_timer_usec));
|
||||
last_timer_usec = now_usec;
|
||||
p.tmr_callback(p.timer_data);
|
||||
now_usec = now_boottime_usec();
|
||||
|
@ -1822,7 +1822,7 @@ void poll_events(LISTEN_SOCKETS *sockets
|
|||
}
|
||||
}
|
||||
|
||||
debug(D_POLLFD, "POLLFD: LISTENER: Waiting on %zu sockets for %zu ms...", p.max + 1, (size_t)timeout_ms);
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: Waiting on %zu sockets for %zu ms...", p.max + 1, (size_t)timeout_ms);
|
||||
retval = poll(p.fds, p.max + 1, timeout_ms);
|
||||
time_t now = now_boottime_sec();
|
||||
|
||||
|
@ -1831,7 +1831,7 @@ void poll_events(LISTEN_SOCKETS *sockets
|
|||
break;
|
||||
}
|
||||
else if(unlikely(!retval)) {
|
||||
debug(D_POLLFD, "POLLFD: LISTENER: poll() timeout.");
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: poll() timeout.");
|
||||
}
|
||||
else {
|
||||
POLLINFO *pi;
|
||||
|
@ -1987,5 +1987,5 @@ void poll_events(LISTEN_SOCKETS *sockets
|
|||
}
|
||||
|
||||
netdata_thread_cleanup_pop(1);
|
||||
debug(D_POLLFD, "POLLFD: LISTENER: cleanup completed");
|
||||
netdata_log_debug(D_POLLFD, "POLLFD: LISTENER: cleanup completed");
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ size_t netdata_threads_init(void) {
|
|||
if(i != 0)
|
||||
fatal("pthread_attr_getstacksize() failed with code %d.", i);
|
||||
else
|
||||
debug(D_OPTIONS, "initial pthread stack size is %zu bytes", stacksize);
|
||||
netdata_log_debug(D_OPTIONS, "initial pthread stack size is %zu bytes", stacksize);
|
||||
|
||||
return stacksize;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "registry_internals.h"
|
||||
|
||||
int registry_db_should_be_saved(void) {
|
||||
debug(D_REGISTRY, "log entries %llu, max %llu", registry.log_count, registry.save_registry_every_entries);
|
||||
netdata_log_debug(D_REGISTRY, "log entries %llu, max %llu", registry.log_count, registry.save_registry_every_entries);
|
||||
return registry.log_count > registry.save_registry_every_entries;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ int registry_db_should_be_saved(void) {
|
|||
// INTERNAL FUNCTIONS FOR SAVING REGISTRY OBJECTS
|
||||
|
||||
static int registry_machine_save_url(REGISTRY_MACHINE_URL *mu, FILE *fp) {
|
||||
debug(D_REGISTRY, "REGISTRY: registry_machine_save_url('%s')", string2str(mu->url));
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_save_url('%s')", string2str(mu->url));
|
||||
|
||||
int ret = fprintf(fp, "V\t%08x\t%08x\t%08x\t%02x\t%s\n",
|
||||
mu->first_t,
|
||||
|
@ -32,7 +32,7 @@ static int registry_machine_save(const DICTIONARY_ITEM *item __maybe_unused, voi
|
|||
REGISTRY_MACHINE *m = entry;
|
||||
FILE *fp = file;
|
||||
|
||||
debug(D_REGISTRY, "REGISTRY: registry_machine_save('%s')", m->guid);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_save('%s')", m->guid);
|
||||
|
||||
int ret = fprintf(fp, "M\t%08x\t%08x\t%08x\t%s\n",
|
||||
m->first_t,
|
||||
|
@ -57,7 +57,7 @@ static int registry_machine_save(const DICTIONARY_ITEM *item __maybe_unused, voi
|
|||
}
|
||||
|
||||
static inline int registry_person_save_url(REGISTRY_PERSON_URL *pu, FILE *fp) {
|
||||
debug(D_REGISTRY, "REGISTRY: registry_person_save_url('%s')", string2str(pu->url));
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: registry_person_save_url('%s')", string2str(pu->url));
|
||||
|
||||
int ret = fprintf(fp, "U\t%08x\t%08x\t%08x\t%02x\t%s\t%s\t%s\n",
|
||||
pu->first_t,
|
||||
|
@ -78,7 +78,7 @@ static inline int registry_person_save(const DICTIONARY_ITEM *item __maybe_unuse
|
|||
REGISTRY_PERSON *p = entry;
|
||||
FILE *fp = file;
|
||||
|
||||
debug(D_REGISTRY, "REGISTRY: registry_person_save('%s')", p->guid);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: registry_person_save('%s')", p->guid);
|
||||
|
||||
int ret = fprintf(fp, "P\t%08x\t%08x\t%08x\t%s\n",
|
||||
p->first_t,
|
||||
|
@ -120,7 +120,7 @@ int registry_db_save(void) {
|
|||
snprintfz(old_filename, FILENAME_MAX, "%s.old", registry.db_filename);
|
||||
snprintfz(tmp_filename, FILENAME_MAX, "%s.tmp", registry.db_filename);
|
||||
|
||||
debug(D_REGISTRY, "REGISTRY: Creating file '%s'", tmp_filename);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: Creating file '%s'", tmp_filename);
|
||||
FILE *fp = fopen(tmp_filename, "w");
|
||||
if(!fp) {
|
||||
netdata_log_error("REGISTRY: Cannot create file: %s", tmp_filename);
|
||||
|
@ -130,7 +130,7 @@ int registry_db_save(void) {
|
|||
|
||||
// dictionary_walkthrough_read() has its own locking, so this is safe to do
|
||||
|
||||
debug(D_REGISTRY, "REGISTRY: saving all machines");
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: saving all machines");
|
||||
int bytes1 = dictionary_walkthrough_read(registry.machines, registry_machine_save, fp);
|
||||
if(bytes1 < 0) {
|
||||
netdata_log_error("REGISTRY: Cannot save registry machines - return value %d", bytes1);
|
||||
|
@ -138,9 +138,9 @@ int registry_db_save(void) {
|
|||
error_log_limit_reset();
|
||||
return bytes1;
|
||||
}
|
||||
debug(D_REGISTRY, "REGISTRY: saving machines took %d bytes", bytes1);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: saving machines took %d bytes", bytes1);
|
||||
|
||||
debug(D_REGISTRY, "Saving all persons");
|
||||
netdata_log_debug(D_REGISTRY, "Saving all persons");
|
||||
int bytes2 = dictionary_walkthrough_read(registry.persons, registry_person_save, fp);
|
||||
if(bytes2 < 0) {
|
||||
netdata_log_error("REGISTRY: Cannot save registry persons - return value %d", bytes2);
|
||||
|
@ -148,7 +148,7 @@ int registry_db_save(void) {
|
|||
error_log_limit_reset();
|
||||
return bytes2;
|
||||
}
|
||||
debug(D_REGISTRY, "REGISTRY: saving persons took %d bytes", bytes2);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: saving persons took %d bytes", bytes2);
|
||||
|
||||
// save the totals
|
||||
fprintf(fp, "T\t%016llx\t%016llx\t%016llx\t%016llx\t%016llx\t%016llx\n",
|
||||
|
@ -165,34 +165,34 @@ int registry_db_save(void) {
|
|||
errno = 0;
|
||||
|
||||
// remove the .old db
|
||||
debug(D_REGISTRY, "REGISTRY: Removing old db '%s'", old_filename);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: Removing old db '%s'", old_filename);
|
||||
if(unlink(old_filename) == -1 && errno != ENOENT)
|
||||
netdata_log_error("REGISTRY: cannot remove old registry file '%s'", old_filename);
|
||||
|
||||
// rename the db to .old
|
||||
debug(D_REGISTRY, "REGISTRY: Link current db '%s' to .old: '%s'", registry.db_filename, old_filename);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: Link current db '%s' to .old: '%s'", registry.db_filename, old_filename);
|
||||
if(link(registry.db_filename, old_filename) == -1 && errno != ENOENT)
|
||||
netdata_log_error("REGISTRY: cannot move file '%s' to '%s'. Saving registry DB failed!", registry.db_filename, old_filename);
|
||||
|
||||
else {
|
||||
// remove the database (it is saved in .old)
|
||||
debug(D_REGISTRY, "REGISTRY: removing db '%s'", registry.db_filename);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: removing db '%s'", registry.db_filename);
|
||||
if (unlink(registry.db_filename) == -1 && errno != ENOENT)
|
||||
netdata_log_error("REGISTRY: cannot remove old registry file '%s'", registry.db_filename);
|
||||
|
||||
// move the .tmp to make it active
|
||||
debug(D_REGISTRY, "REGISTRY: linking tmp db '%s' to active db '%s'", tmp_filename, registry.db_filename);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: linking tmp db '%s' to active db '%s'", tmp_filename, registry.db_filename);
|
||||
if (link(tmp_filename, registry.db_filename) == -1) {
|
||||
netdata_log_error("REGISTRY: cannot move file '%s' to '%s'. Saving registry DB failed!", tmp_filename,
|
||||
registry.db_filename);
|
||||
|
||||
// move the .old back
|
||||
debug(D_REGISTRY, "REGISTRY: linking old db '%s' to active db '%s'", old_filename, registry.db_filename);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: linking old db '%s' to active db '%s'", old_filename, registry.db_filename);
|
||||
if(link(old_filename, registry.db_filename) == -1)
|
||||
netdata_log_error("REGISTRY: cannot move file '%s' to '%s'. Recovering the old registry DB failed!", old_filename, registry.db_filename);
|
||||
}
|
||||
else {
|
||||
debug(D_REGISTRY, "REGISTRY: removing tmp db '%s'", tmp_filename);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: removing tmp db '%s'", tmp_filename);
|
||||
if(unlink(tmp_filename) == -1)
|
||||
netdata_log_error("REGISTRY: cannot remove tmp registry file '%s'", tmp_filename);
|
||||
|
||||
|
@ -219,7 +219,7 @@ size_t registry_db_load(void) {
|
|||
STRING *u = NULL;
|
||||
size_t line = 0;
|
||||
|
||||
debug(D_REGISTRY, "REGISTRY: loading active db from: '%s'", registry.db_filename);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: loading active db from: '%s'", registry.db_filename);
|
||||
FILE *fp = fopen(registry.db_filename, "r");
|
||||
if(!fp) {
|
||||
netdata_log_error("REGISTRY: cannot open registry file: '%s'", registry.db_filename);
|
||||
|
@ -232,7 +232,7 @@ size_t registry_db_load(void) {
|
|||
while((s = fgets_trim_len(buf, 4096, fp, &len))) {
|
||||
line++;
|
||||
|
||||
debug(D_REGISTRY, "REGISTRY: read line %zu to length %zu: %s", line, len, s);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: read line %zu to length %zu: %s", line, len, s);
|
||||
switch(*s) {
|
||||
case 'U': // person URL
|
||||
if(unlikely(!p)) {
|
||||
|
@ -284,7 +284,7 @@ size_t registry_db_load(void) {
|
|||
pu->last_t = (uint32_t)strtoul(&s[11], NULL, 16);
|
||||
pu->usages = (uint32_t)strtoul(&s[20], NULL, 16);
|
||||
pu->flags = (uint8_t)strtoul(&s[29], NULL, 16);
|
||||
debug(D_REGISTRY, "REGISTRY: loaded person URL '%s' with name '%s' of machine '%s', first: %u, last: %u, usages: %u, flags: %02x",
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: loaded person URL '%s' with name '%s' of machine '%s', first: %u, last: %u, usages: %u, flags: %02x",
|
||||
string2str(u), string2str(pu->machine_name), m->guid, pu->first_t, pu->last_t, pu->usages, pu->flags);
|
||||
|
||||
string_freez(u);
|
||||
|
@ -302,7 +302,7 @@ size_t registry_db_load(void) {
|
|||
p = registry_person_allocate(&s[29], (time_t)strtoul(&s[2], NULL, 16));
|
||||
p->last_t = (uint32_t)strtoul(&s[11], NULL, 16);
|
||||
p->usages = (uint32_t)strtoul(&s[20], NULL, 16);
|
||||
debug(D_REGISTRY, "REGISTRY: loaded person '%s', first: %u, last: %u, usages: %u", p->guid, p->first_t, p->last_t, p->usages);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: loaded person '%s', first: %u, last: %u, usages: %u", p->guid, p->first_t, p->last_t, p->usages);
|
||||
break;
|
||||
|
||||
case 'V': // machine URL
|
||||
|
@ -336,7 +336,7 @@ size_t registry_db_load(void) {
|
|||
mu->last_t = (uint32_t)strtoul(&s[11], NULL, 16);
|
||||
mu->usages = (uint32_t)strtoul(&s[20], NULL, 16);
|
||||
mu->flags = (uint8_t)strtoul(&s[29], NULL, 16);
|
||||
debug(D_REGISTRY, "Registry loaded machine URL '%s', machine '%s', first: %u, last: %u, usages: %u, flags: %02x",
|
||||
netdata_log_debug(D_REGISTRY, "Registry loaded machine URL '%s', machine '%s', first: %u, last: %u, usages: %u, flags: %02x",
|
||||
string2str(u), m->guid, mu->first_t, mu->last_t, mu->usages, mu->flags);
|
||||
|
||||
string_freez(u);
|
||||
|
@ -354,7 +354,7 @@ size_t registry_db_load(void) {
|
|||
m = registry_machine_allocate(&s[29], (time_t)strtoul(&s[2], NULL, 16));
|
||||
m->last_t = (uint32_t)strtoul(&s[11], NULL, 16);
|
||||
m->usages = (uint32_t)strtoul(&s[20], NULL, 16);
|
||||
debug(D_REGISTRY, "REGISTRY: loaded machine '%s', first: %u, last: %u, usages: %u", m->guid, m->first_t, m->last_t, m->usages);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: loaded machine '%s', first: %u, last: %u, usages: %u", m->guid, m->first_t, m->last_t, m->usages);
|
||||
break;
|
||||
|
||||
case 'T': // totals
|
||||
|
|
|
@ -210,7 +210,7 @@ static int machine_delete_callback(const DICTIONARY_ITEM *item __maybe_unused, v
|
|||
static int registry_person_del_callback(const DICTIONARY_ITEM *item __maybe_unused, void *entry, void *d __maybe_unused) {
|
||||
REGISTRY_PERSON *p = (REGISTRY_PERSON *)entry;
|
||||
|
||||
debug(D_REGISTRY, "Registry: registry_person_del('%s'): deleting person", p->guid);
|
||||
netdata_log_debug(D_REGISTRY, "Registry: registry_person_del('%s'): deleting person", p->guid);
|
||||
|
||||
while(p->person_urls)
|
||||
registry_person_unlink_from_url(p, (REGISTRY_PERSON_URL *)p->person_urls);
|
||||
|
@ -218,7 +218,7 @@ static int registry_person_del_callback(const DICTIONARY_ITEM *item __maybe_unus
|
|||
//debug(D_REGISTRY, "Registry: deleting person '%s' from persons registry", p->guid);
|
||||
//dictionary_del(registry.persons, p->guid);
|
||||
|
||||
debug(D_REGISTRY, "Registry: freeing person '%s'", p->guid);
|
||||
netdata_log_debug(D_REGISTRY, "Registry: freeing person '%s'", p->guid);
|
||||
freez(p);
|
||||
|
||||
return 1;
|
||||
|
@ -227,12 +227,12 @@ static int registry_person_del_callback(const DICTIONARY_ITEM *item __maybe_unus
|
|||
void registry_free(void) {
|
||||
if(!registry.enabled) return;
|
||||
|
||||
debug(D_REGISTRY, "Registry: destroying persons dictionary");
|
||||
netdata_log_debug(D_REGISTRY, "Registry: destroying persons dictionary");
|
||||
dictionary_walkthrough_read(registry.persons, registry_person_del_callback, NULL);
|
||||
dictionary_destroy(registry.persons);
|
||||
registry.persons = NULL;
|
||||
|
||||
debug(D_REGISTRY, "Registry: destroying machines dictionary");
|
||||
netdata_log_debug(D_REGISTRY, "Registry: destroying machines dictionary");
|
||||
dictionary_walkthrough_read(registry.machines, machine_delete_callback, NULL);
|
||||
dictionary_destroy(registry.machines);
|
||||
registry.machines = NULL;
|
||||
|
|
|
@ -142,7 +142,7 @@ REGISTRY_PERSON_URL *registry_verify_request(const char *person_guid, char *mach
|
|||
// REGISTRY REQUESTS
|
||||
|
||||
REGISTRY_PERSON *registry_request_access(const char *person_guid, char *machine_guid, char *url, char *name, time_t when) {
|
||||
debug(D_REGISTRY, "registry_request_access('%s', '%s', '%s'): NEW REQUEST", (person_guid)?person_guid:"", machine_guid, url);
|
||||
netdata_log_debug(D_REGISTRY, "registry_request_access('%s', '%s', '%s'): NEW REQUEST", (person_guid)?person_guid:"", machine_guid, url);
|
||||
|
||||
bool is_dummy = is_dummy_person(person_guid);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ ssize_t registry_log_load(void) {
|
|||
// otherwise we will append to it the values we read
|
||||
registry_log_close();
|
||||
|
||||
debug(D_REGISTRY, "Registry: loading active db from: %s", registry.log_filename);
|
||||
netdata_log_debug(D_REGISTRY, "Registry: loading active db from: %s", registry.log_filename);
|
||||
FILE *fp = fopen(registry.log_filename, "r");
|
||||
if(!fp)
|
||||
netdata_log_error("Registry: cannot open registry file: %s", registry.log_filename);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// MACHINE
|
||||
|
||||
REGISTRY_MACHINE *registry_machine_find(const char *machine_guid) {
|
||||
debug(D_REGISTRY, "REGISTRY: registry_machine_find('%s')", machine_guid);
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_find('%s')", machine_guid);
|
||||
return dictionary_get(registry.machines, machine_guid);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ void registry_machine_url_unlink_from_machine_and_free(REGISTRY_MACHINE *m, REGI
|
|||
}
|
||||
|
||||
REGISTRY_MACHINE_URL *registry_machine_url_allocate(REGISTRY_MACHINE *m, STRING *u, time_t when) {
|
||||
debug(D_REGISTRY, "REGISTRY: registry_machine_url_allocate('%s', '%s'): allocating %zu bytes", m->guid, string2str(u), sizeof(REGISTRY_MACHINE_URL));
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_url_allocate('%s', '%s'): allocating %zu bytes", m->guid, string2str(u), sizeof(REGISTRY_MACHINE_URL));
|
||||
|
||||
REGISTRY_MACHINE_URL *mu = aral_mallocz(registry.machine_urls_aral);
|
||||
|
||||
|
@ -37,7 +37,7 @@ REGISTRY_MACHINE_URL *registry_machine_url_allocate(REGISTRY_MACHINE *m, STRING
|
|||
mu->url = string_dup(u);
|
||||
mu->flags = REGISTRY_URL_FLAGS_DEFAULT;
|
||||
|
||||
debug(D_REGISTRY, "REGISTRY: registry_machine_url_allocate('%s', '%s'): indexing URL in machine", m->guid, string2str(u));
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_url_allocate('%s', '%s'): indexing URL in machine", m->guid, string2str(u));
|
||||
|
||||
DOUBLE_LINKED_LIST_PREPEND_ITEM_UNSAFE(m->machine_urls, mu, prev, next);
|
||||
|
||||
|
@ -45,7 +45,7 @@ REGISTRY_MACHINE_URL *registry_machine_url_allocate(REGISTRY_MACHINE *m, STRING
|
|||
}
|
||||
|
||||
REGISTRY_MACHINE *registry_machine_allocate(const char *machine_guid, time_t when) {
|
||||
debug(D_REGISTRY, "REGISTRY: registry_machine_allocate('%s'): creating new machine, sizeof(MACHINE)=%zu", machine_guid, sizeof(REGISTRY_MACHINE));
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_allocate('%s'): creating new machine, sizeof(MACHINE)=%zu", machine_guid, sizeof(REGISTRY_MACHINE));
|
||||
|
||||
REGISTRY_MACHINE *m = aral_mallocz(registry.machines_aral);
|
||||
|
||||
|
@ -89,16 +89,16 @@ REGISTRY_MACHINE *registry_machine_find_or_create(const char *machine_guid, time
|
|||
// LINKING OF OBJECTS
|
||||
|
||||
REGISTRY_MACHINE_URL *registry_machine_link_to_url(REGISTRY_MACHINE *m, STRING *url, time_t when) {
|
||||
debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): searching for URL in machine", m->guid, string2str(url));
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): searching for URL in machine", m->guid, string2str(url));
|
||||
|
||||
REGISTRY_MACHINE_URL *mu = registry_machine_url_find(m, url);
|
||||
if(!mu) {
|
||||
debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): not found", m->guid, string2str(url));
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): not found", m->guid, string2str(url));
|
||||
mu = registry_machine_url_allocate(m, url, when);
|
||||
registry.machines_urls_count++;
|
||||
}
|
||||
else {
|
||||
debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): found", m->guid, string2str(url));
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): found", m->guid, string2str(url));
|
||||
mu->usages++;
|
||||
if(likely(mu->last_t < (uint32_t)when)) mu->last_t = (uint32_t)when;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ REGISTRY_MACHINE_URL *registry_machine_link_to_url(REGISTRY_MACHINE *m, STRING *
|
|||
if(likely(m->last_t < (uint32_t)when)) m->last_t = (uint32_t)when;
|
||||
|
||||
if(mu->flags & REGISTRY_URL_FLAGS_EXPIRED) {
|
||||
debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): accessing an expired URL.", m->guid, string2str(url));
|
||||
netdata_log_debug(D_REGISTRY, "REGISTRY: registry_machine_link_to_url('%s', '%s'): accessing an expired URL.", m->guid, string2str(url));
|
||||
mu->flags &= ~REGISTRY_URL_FLAGS_EXPIRED;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// PERSON_URL INDEX
|
||||
|
||||
inline REGISTRY_PERSON_URL *registry_person_url_index_find(REGISTRY_PERSON *p, STRING *url) {
|
||||
debug(D_REGISTRY, "Registry: registry_person_url_index_find('%s', '%s')", p->guid, string2str(url));
|
||||
netdata_log_debug(D_REGISTRY, "Registry: registry_person_url_index_find('%s', '%s')", p->guid, string2str(url));
|
||||
|
||||
REGISTRY_PERSON_URL *pu;
|
||||
for(pu = p->person_urls ; pu ;pu = pu->next)
|
||||
|
@ -31,7 +31,7 @@ inline REGISTRY_PERSON_URL *registry_person_url_index_del(REGISTRY_PERSON *p, RE
|
|||
// PERSON_URL
|
||||
|
||||
REGISTRY_PERSON_URL *registry_person_url_allocate(REGISTRY_PERSON *p, REGISTRY_MACHINE *m, STRING *url, char *machine_name, size_t machine_name_len, time_t when) {
|
||||
debug(D_REGISTRY, "registry_person_url_allocate('%s', '%s', '%s'): allocating %zu bytes", p->guid, m->guid, string2str(url), sizeof(REGISTRY_PERSON_URL) + machine_name_len);
|
||||
netdata_log_debug(D_REGISTRY, "registry_person_url_allocate('%s', '%s', '%s'): allocating %zu bytes", p->guid, m->guid, string2str(url), sizeof(REGISTRY_PERSON_URL) + machine_name_len);
|
||||
|
||||
// protection from too big names
|
||||
if(machine_name_len > registry.max_name_length)
|
||||
|
@ -50,7 +50,7 @@ REGISTRY_PERSON_URL *registry_person_url_allocate(REGISTRY_PERSON *p, REGISTRY_M
|
|||
pu->flags = REGISTRY_URL_FLAGS_DEFAULT;
|
||||
m->links++;
|
||||
|
||||
debug(D_REGISTRY, "registry_person_url_allocate('%s', '%s', '%s'): indexing URL in person", p->guid, m->guid, string2str(url));
|
||||
netdata_log_debug(D_REGISTRY, "registry_person_url_allocate('%s', '%s', '%s'): indexing URL in person", p->guid, m->guid, string2str(url));
|
||||
REGISTRY_PERSON_URL *tpu = registry_person_url_index_add(p, pu);
|
||||
if(tpu != pu) {
|
||||
netdata_log_error("Registry: Attempted to add duplicate person url '%s' with name '%s' to person '%s'", string2str(url), machine_name, p->guid);
|
||||
|
@ -64,7 +64,7 @@ REGISTRY_PERSON_URL *registry_person_url_allocate(REGISTRY_PERSON *p, REGISTRY_M
|
|||
}
|
||||
|
||||
void registry_person_url_deindex_and_free(REGISTRY_PERSON *p, REGISTRY_PERSON_URL *pu) {
|
||||
debug(D_REGISTRY, "registry_person_url_deindex_and_free('%s', '%s')", p->guid, string2str(pu->url));
|
||||
netdata_log_debug(D_REGISTRY, "registry_person_url_deindex_and_free('%s', '%s')", p->guid, string2str(pu->url));
|
||||
|
||||
REGISTRY_PERSON_URL *tpu = registry_person_url_index_del(p, pu);
|
||||
if(tpu) {
|
||||
|
@ -77,7 +77,7 @@ void registry_person_url_deindex_and_free(REGISTRY_PERSON *p, REGISTRY_PERSON_UR
|
|||
|
||||
// this function is needed to change the name of a PERSON_URL
|
||||
REGISTRY_PERSON_URL *registry_person_url_reallocate(REGISTRY_PERSON *p, REGISTRY_MACHINE *m, STRING *url, char *machine_name, size_t machine_name_len, time_t when, REGISTRY_PERSON_URL *pu) {
|
||||
debug(D_REGISTRY, "registry_person_url_reallocate('%s', '%s', '%s'): allocating %zu bytes", p->guid, m->guid, string2str(url), sizeof(REGISTRY_PERSON_URL) + machine_name_len);
|
||||
netdata_log_debug(D_REGISTRY, "registry_person_url_reallocate('%s', '%s', '%s'): allocating %zu bytes", p->guid, m->guid, string2str(url), sizeof(REGISTRY_PERSON_URL) + machine_name_len);
|
||||
|
||||
// keep a backup
|
||||
REGISTRY_PERSON_URL pu2 = {
|
||||
|
@ -108,12 +108,12 @@ REGISTRY_PERSON_URL *registry_person_url_reallocate(REGISTRY_PERSON *p, REGISTRY
|
|||
// PERSON
|
||||
|
||||
REGISTRY_PERSON *registry_person_find(const char *person_guid) {
|
||||
debug(D_REGISTRY, "Registry: registry_person_find('%s')", person_guid);
|
||||
netdata_log_debug(D_REGISTRY, "Registry: registry_person_find('%s')", person_guid);
|
||||
return dictionary_get(registry.persons, person_guid);
|
||||
}
|
||||
|
||||
REGISTRY_PERSON *registry_person_allocate(const char *person_guid, time_t when) {
|
||||
debug(D_REGISTRY, "Registry: registry_person_allocate('%s'): allocating new person, sizeof(PERSON)=%zu", (person_guid)?person_guid:"", sizeof(REGISTRY_PERSON));
|
||||
netdata_log_debug(D_REGISTRY, "Registry: registry_person_allocate('%s'): allocating new person, sizeof(PERSON)=%zu", (person_guid)?person_guid:"", sizeof(REGISTRY_PERSON));
|
||||
|
||||
REGISTRY_PERSON *p = aral_mallocz(registry.persons_aral);
|
||||
if(!person_guid) {
|
||||
|
@ -122,9 +122,9 @@ REGISTRY_PERSON *registry_person_allocate(const char *person_guid, time_t when)
|
|||
uuid_generate(uuid);
|
||||
uuid_unparse_lower(uuid, p->guid);
|
||||
|
||||
debug(D_REGISTRY, "Registry: Checking if the generated person guid '%s' is unique", p->guid);
|
||||
netdata_log_debug(D_REGISTRY, "Registry: Checking if the generated person guid '%s' is unique", p->guid);
|
||||
if (!dictionary_get(registry.persons, p->guid)) {
|
||||
debug(D_REGISTRY, "Registry: generated person guid '%s' is unique", p->guid);
|
||||
netdata_log_debug(D_REGISTRY, "Registry: generated person guid '%s' is unique", p->guid);
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
@ -151,7 +151,7 @@ REGISTRY_PERSON *registry_person_allocate(const char *person_guid, time_t when)
|
|||
// 3. if it is not valid, create a new one
|
||||
// 4. return it
|
||||
REGISTRY_PERSON *registry_person_find_or_create(const char *person_guid, time_t when, bool is_dummy) {
|
||||
debug(D_REGISTRY, "Registry: registry_person_find_or_create('%s'): creating dictionary of urls", person_guid);
|
||||
netdata_log_debug(D_REGISTRY, "Registry: registry_person_find_or_create('%s'): creating dictionary of urls", person_guid);
|
||||
|
||||
char buf[GUID_LEN + 1];
|
||||
REGISTRY_PERSON *p = NULL;
|
||||
|
@ -181,28 +181,28 @@ REGISTRY_PERSON *registry_person_find_or_create(const char *person_guid, time_t
|
|||
// LINKING OF OBJECTS
|
||||
|
||||
REGISTRY_PERSON_URL *registry_person_link_to_url(REGISTRY_PERSON *p, REGISTRY_MACHINE *m, STRING *url, char *machine_name, size_t machine_name_len, time_t when) {
|
||||
debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): searching for URL in person", p->guid, m->guid, string2str(url));
|
||||
netdata_log_debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): searching for URL in person", p->guid, m->guid, string2str(url));
|
||||
|
||||
REGISTRY_PERSON_URL *pu = registry_person_url_index_find(p, url);
|
||||
if(!pu) {
|
||||
debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): not found", p->guid, m->guid, string2str(url));
|
||||
netdata_log_debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): not found", p->guid, m->guid, string2str(url));
|
||||
pu = registry_person_url_allocate(p, m, url, machine_name, machine_name_len, when);
|
||||
registry.persons_urls_count++;
|
||||
}
|
||||
else {
|
||||
debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): found", p->guid, m->guid, string2str(url));
|
||||
netdata_log_debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): found", p->guid, m->guid, string2str(url));
|
||||
pu->usages++;
|
||||
if(likely(pu->last_t < (uint32_t)when)) pu->last_t = (uint32_t)when;
|
||||
|
||||
if(pu->machine != m) {
|
||||
REGISTRY_MACHINE_URL *mu = registry_machine_url_find(pu->machine, url);
|
||||
if(mu) {
|
||||
debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): URL switched machines (old was '%s') - expiring it from previous machine.",
|
||||
netdata_log_debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): URL switched machines (old was '%s') - expiring it from previous machine.",
|
||||
p->guid, m->guid, string2str(url), pu->machine->guid);
|
||||
mu->flags |= REGISTRY_URL_FLAGS_EXPIRED;
|
||||
}
|
||||
else {
|
||||
debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): URL switched machines (old was '%s') - but the URL is not linked to the old machine.",
|
||||
netdata_log_debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): URL switched machines (old was '%s') - but the URL is not linked to the old machine.",
|
||||
p->guid, m->guid, string2str(url), pu->machine->guid);
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ REGISTRY_PERSON_URL *registry_person_link_to_url(REGISTRY_PERSON *p, REGISTRY_MA
|
|||
if(likely(p->last_t < (uint32_t)when)) p->last_t = (uint32_t)when;
|
||||
|
||||
if(pu->flags & REGISTRY_URL_FLAGS_EXPIRED) {
|
||||
debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): accessing an expired URL. Re-enabling URL.", p->guid, m->guid, string2str(url));
|
||||
netdata_log_debug(D_REGISTRY, "registry_person_link_to_url('%s', '%s', '%s'): accessing an expired URL. Re-enabling URL.", p->guid, m->guid, string2str(url));
|
||||
pu->flags &= ~REGISTRY_URL_FLAGS_EXPIRED;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ size_t rrdpush_compress(struct compressor_state *state, const char *data, size_t
|
|||
uint32_t len = ((compressed_data_size & 0x7f) | 0x80 | (((compressed_data_size & (0x7f << 7)) << 1) | 0x8000)) << 8;
|
||||
*(uint32_t *)state->compression_result_buffer = len | RRDPUSH_COMPRESSION_SIGNATURE;
|
||||
*out = state->compression_result_buffer;
|
||||
debug(D_STREAM, "%s: Compressed data header: %ld", STREAM_COMPRESSION_MSG, compressed_data_size);
|
||||
netdata_log_debug(D_STREAM, "%s: Compressed data header: %ld", STREAM_COMPRESSION_MSG, compressed_data_size);
|
||||
return compressed_data_size + RRDPUSH_COMPRESSION_SIGNATURE_SIZE;
|
||||
}
|
||||
|
||||
|
|
|
@ -734,7 +734,7 @@ static void rrdpush_receive(struct receiver_state *rpt)
|
|||
sprintf(initial_response, "%s", START_STREAMING_PROMPT_V1);
|
||||
}
|
||||
|
||||
debug(D_STREAM, "Initial response to %s: %s", rpt->client_ip, initial_response);
|
||||
netdata_log_debug(D_STREAM, "Initial response to %s: %s", rpt->client_ip, initial_response);
|
||||
ssize_t bytes_sent = send_timeout(
|
||||
#ifdef ENABLE_HTTPS
|
||||
&rpt->ssl,
|
||||
|
|
|
@ -1185,7 +1185,7 @@ int rrdpush_receiver_thread_spawn(struct web_client *w, char *decoded_query_stri
|
|||
}
|
||||
}
|
||||
|
||||
debug(D_SYSTEM, "starting STREAM receive thread.");
|
||||
netdata_log_debug(D_SYSTEM, "starting STREAM receive thread.");
|
||||
|
||||
rrdpush_receiver_takeover_web_connection(w, rpt);
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ static inline void rrdpush_sender_add_host_variable_to_buffer(BUFFER *wb, const
|
|||
, rrdvar2number(rva)
|
||||
);
|
||||
|
||||
debug(D_STREAM, "RRDVAR pushed HOST VARIABLE %s = " NETDATA_DOUBLE_FORMAT, rrdvar_name(rva), rrdvar2number(rva));
|
||||
netdata_log_debug(D_STREAM, "RRDVAR pushed HOST VARIABLE %s = " NETDATA_DOUBLE_FORMAT, rrdvar_name(rva), rrdvar2number(rva));
|
||||
}
|
||||
|
||||
void rrdpush_sender_send_this_host_variable_now(RRDHOST *host, const RRDVAR_ACQUIRED *rva) {
|
||||
|
@ -242,7 +242,7 @@ static void rrdpush_sender_thread_send_custom_host_variables(RRDHOST *host) {
|
|||
sender_commit(host->sender, wb, STREAM_TRAFFIC_TYPE_METADATA);
|
||||
sender_thread_buffer_free();
|
||||
|
||||
debug(D_STREAM, "RRDVAR sent %d VARIABLES", ret);
|
||||
netdata_log_debug(D_STREAM, "RRDVAR sent %d VARIABLES", ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -752,7 +752,7 @@ static bool rrdpush_sender_thread_connect_to_parent(RRDHOST *host, int default_p
|
|||
netdata_log_error("STREAM %s [send to %s]: cannot enlarge the socket buffer.", rrdhost_hostname(host), s->connected_to);
|
||||
|
||||
http[bytes] = '\0';
|
||||
debug(D_STREAM, "Response to sender from far end: %s", http);
|
||||
netdata_log_debug(D_STREAM, "Response to sender from far end: %s", http);
|
||||
if(!rrdpush_sender_validate_response(host, s, http, bytes))
|
||||
return false;
|
||||
|
||||
|
@ -765,7 +765,7 @@ static bool rrdpush_sender_thread_connect_to_parent(RRDHOST *host, int default_p
|
|||
|
||||
log_sender_capabilities(s);
|
||||
|
||||
debug(D_STREAM, "STREAM: Connected on fd %d...", s->rrdpush_sender_socket);
|
||||
netdata_log_debug(D_STREAM, "STREAM: Connected on fd %d...", s->rrdpush_sender_socket);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -824,7 +824,7 @@ static ssize_t attempt_to_send(struct sender_state *s) {
|
|||
sender_lock(s);
|
||||
char *chunk;
|
||||
size_t outstanding = cbuffer_next_unsafe(s->buffer, &chunk);
|
||||
debug(D_STREAM, "STREAM: Sending data. Buffer r=%zu w=%zu s=%zu, next chunk=%zu", cb->read, cb->write, cb->size, outstanding);
|
||||
netdata_log_debug(D_STREAM, "STREAM: Sending data. Buffer r=%zu w=%zu s=%zu, next chunk=%zu", cb->read, cb->write, cb->size, outstanding);
|
||||
|
||||
#ifdef ENABLE_HTTPS
|
||||
if(SSL_connection(&s->ssl))
|
||||
|
@ -839,18 +839,18 @@ static ssize_t attempt_to_send(struct sender_state *s) {
|
|||
cbuffer_remove_unsafe(s->buffer, ret);
|
||||
s->sent_bytes_on_this_connection += ret;
|
||||
s->sent_bytes += ret;
|
||||
debug(D_STREAM, "STREAM %s [send to %s]: Sent %zd bytes", rrdhost_hostname(s->host), s->connected_to, ret);
|
||||
netdata_log_debug(D_STREAM, "STREAM %s [send to %s]: Sent %zd bytes", rrdhost_hostname(s->host), s->connected_to, ret);
|
||||
}
|
||||
else if (ret == -1 && (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK))
|
||||
debug(D_STREAM, "STREAM %s [send to %s]: unavailable after polling POLLOUT", rrdhost_hostname(s->host), s->connected_to);
|
||||
netdata_log_debug(D_STREAM, "STREAM %s [send to %s]: unavailable after polling POLLOUT", rrdhost_hostname(s->host), s->connected_to);
|
||||
else if (ret == -1) {
|
||||
worker_is_busy(WORKER_SENDER_JOB_DISCONNECT_SEND_ERROR);
|
||||
debug(D_STREAM, "STREAM: Send failed - closing socket...");
|
||||
netdata_log_debug(D_STREAM, "STREAM: Send failed - closing socket...");
|
||||
netdata_log_error("STREAM %s [send to %s]: failed to send metrics - closing connection - we have sent %zu bytes on this connection.", rrdhost_hostname(s->host), s->connected_to, s->sent_bytes_on_this_connection);
|
||||
rrdpush_sender_thread_close_socket(s->host);
|
||||
}
|
||||
else
|
||||
debug(D_STREAM, "STREAM: send() returned 0 -> no error but no transmission");
|
||||
netdata_log_debug(D_STREAM, "STREAM: send() returned 0 -> no error but no transmission");
|
||||
|
||||
replication_recalculate_buffer_used_ratio_unsafe(s);
|
||||
sender_unlock(s);
|
||||
|
@ -1388,7 +1388,7 @@ void *rrdpush_sender_thread(void *ptr) {
|
|||
|
||||
int poll_rc = poll(fds, 2, 1000);
|
||||
|
||||
debug(D_STREAM, "STREAM: poll() finished collector=%d socket=%d (current chunk %zu bytes)...",
|
||||
netdata_log_debug(D_STREAM, "STREAM: poll() finished collector=%d socket=%d (current chunk %zu bytes)...",
|
||||
fds[Collector].revents, fds[Socket].revents, outstanding);
|
||||
|
||||
if(unlikely(rrdhost_sender_should_exit(s)))
|
||||
|
@ -1403,7 +1403,7 @@ void *rrdpush_sender_thread(void *ptr) {
|
|||
// Spurious wake-ups without error - loop again
|
||||
if (poll_rc == 0 || ((poll_rc == -1) && (errno == EAGAIN || errno == EINTR))) {
|
||||
netdata_thread_testcancel();
|
||||
debug(D_STREAM, "Spurious wakeup");
|
||||
netdata_log_debug(D_STREAM, "Spurious wakeup");
|
||||
now_s = now_monotonic_sec();
|
||||
continue;
|
||||
}
|
||||
|
@ -1430,7 +1430,7 @@ void *rrdpush_sender_thread(void *ptr) {
|
|||
// If the collector woke us up then empty the pipe to remove the signal
|
||||
if (fds[Collector].revents & (POLLIN|POLLPRI)) {
|
||||
worker_is_busy(WORKER_SENDER_JOB_PIPE_READ);
|
||||
debug(D_STREAM, "STREAM: Data added to send buffer (current buffer chunk %zu bytes)...", outstanding);
|
||||
netdata_log_debug(D_STREAM, "STREAM: Data added to send buffer (current buffer chunk %zu bytes)...", outstanding);
|
||||
|
||||
if (read(fds[Collector].fd, thread_data->pipe_buffer, pipe_buffer_size) == -1)
|
||||
netdata_log_error("STREAM %s [send to %s]: cannot read from internal pipe.", rrdhost_hostname(s->host), s->connected_to);
|
||||
|
|
|
@ -17,29 +17,29 @@ extern size_t procfile_max_allocation;
|
|||
|
||||
|
||||
static inline void pflines_reset(pflines *fl) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": resetting lines");
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": resetting lines");
|
||||
|
||||
fl->len = 0;
|
||||
}
|
||||
|
||||
static inline void pflines_free(pflines *fl) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": freeing lines");
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": freeing lines");
|
||||
|
||||
freez(fl);
|
||||
}
|
||||
|
||||
static inline void pfwords_reset(pfwords *fw) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": resetting words");
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": resetting words");
|
||||
fw->len = 0;
|
||||
}
|
||||
|
||||
|
||||
static inline void pfwords_add(procfile *ff, char *str) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": adding word No %d: '%s'", fw->len, str);
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": adding word No %d: '%s'", fw->len, str);
|
||||
|
||||
pfwords *fw = ff->words;
|
||||
if(unlikely(fw->len == fw->size)) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": expanding words");
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": expanding words");
|
||||
|
||||
ff->words = fw = reallocz(fw, sizeof(pfwords) + (fw->size + PFWORDS_INCREASE_STEP) * sizeof(char *));
|
||||
fw->size += PFWORDS_INCREASE_STEP;
|
||||
|
@ -50,11 +50,11 @@ static inline void pfwords_add(procfile *ff, char *str) {
|
|||
|
||||
NEVERNULL
|
||||
static inline size_t *pflines_add(procfile *ff) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": adding line %d at word %d", fl->len, first_word);
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": adding line %d at word %d", fl->len, first_word);
|
||||
|
||||
pflines *fl = ff->lines;
|
||||
if(unlikely(fl->len == fl->size)) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": expanding lines");
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": expanding lines");
|
||||
|
||||
ff->lines = fl = reallocz(fl, sizeof(pflines) + (fl->size + PFLINES_INCREASE_STEP) * sizeof(ffline));
|
||||
fl->size += PFLINES_INCREASE_STEP;
|
||||
|
@ -70,7 +70,7 @@ static inline size_t *pflines_add(procfile *ff) {
|
|||
|
||||
NOINLINE
|
||||
static void procfile_parser(procfile *ff) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": Parsing file '%s'", ff->filename);
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": Parsing file '%s'", ff->filename);
|
||||
|
||||
char *s = ff->data // our current position
|
||||
, *e = &ff->data[ff->len] // the terminating null
|
||||
|
@ -115,7 +115,7 @@ static void procfile_parser(procfile *ff) {
|
|||
(*line_words)++;
|
||||
t = ++s;
|
||||
|
||||
// debug(D_PROCFILE, PF_PREFIX ": ended line %d with %d words", l, ff->lines->lines[l].words);
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": ended line %d with %d words", l, ff->lines->lines[l].words);
|
||||
|
||||
line_words = pflines_add(ff);
|
||||
break;
|
||||
|
@ -190,7 +190,7 @@ static void procfile_parser(procfile *ff) {
|
|||
|
||||
|
||||
procfile *procfile_readall1(procfile *ff) {
|
||||
// debug(D_PROCFILE, PF_PREFIX ": Reading file '%s'.", ff->filename);
|
||||
// netdata_log_debug(D_PROCFILE, PF_PREFIX ": Reading file '%s'.", ff->filename);
|
||||
|
||||
ff->len = 0; // zero the used size
|
||||
ssize_t r = 1; // read at least once
|
||||
|
@ -199,12 +199,12 @@ procfile *procfile_readall1(procfile *ff) {
|
|||
ssize_t x = ff->size - s;
|
||||
|
||||
if(unlikely(!x)) {
|
||||
debug(D_PROCFILE, PF_PREFIX ": Expanding data buffer for file '%s'.", procfile_filename(ff));
|
||||
netdata_log_debug(D_PROCFILE, PF_PREFIX ": Expanding data buffer for file '%s'.", procfile_filename(ff));
|
||||
ff = reallocz(ff, sizeof(procfile) + ff->size + PROCFILE_INCREMENT_BUFFER);
|
||||
ff->size += PROCFILE_INCREMENT_BUFFER;
|
||||
}
|
||||
|
||||
debug(D_PROCFILE, "Reading file '%s', from position %zd with length %zd", procfile_filename(ff), s, (ssize_t)(ff->size - s));
|
||||
netdata_log_debug(D_PROCFILE, "Reading file '%s', from position %zd with length %zd", procfile_filename(ff), s, (ssize_t)(ff->size - s));
|
||||
r = read(ff->fd, &ff->data[s], ff->size - s);
|
||||
if(unlikely(r == -1)) {
|
||||
if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) netdata_log_error(PF_PREFIX ": Cannot read from file '%s' on fd %d", procfile_filename(ff), ff->fd);
|
||||
|
@ -215,7 +215,7 @@ procfile *procfile_readall1(procfile *ff) {
|
|||
ff->len += r;
|
||||
}
|
||||
|
||||
// debug(D_PROCFILE, "Rewinding file '%s'", ff->filename);
|
||||
// netdata_log_debug(D_PROCFILE, "Rewinding file '%s'", ff->filename);
|
||||
if(unlikely(lseek(ff->fd, 0, SEEK_SET) == -1)) {
|
||||
if(unlikely(!(ff->flags & PROCFILE_FLAG_NO_ERROR_ON_FILE_IO))) netdata_log_error(PF_PREFIX ": Cannot rewind on file '%s'.", procfile_filename(ff));
|
||||
procfile_close(ff);
|
||||
|
@ -232,7 +232,7 @@ procfile *procfile_readall1(procfile *ff) {
|
|||
if(unlikely(ff->words->len > procfile_max_words)) procfile_max_words = ff->words->len;
|
||||
}
|
||||
|
||||
// debug(D_PROCFILE, "File '%s' updated.", ff->filename);
|
||||
// netdata_log_debug(D_PROCFILE, "File '%s' updated.", ff->filename);
|
||||
return ff;
|
||||
}
|
||||
|
||||
|
|
|
@ -905,7 +905,7 @@ int web_client_api_request_v1_badge(RRDHOST *host, struct web_client *w, char *u
|
|||
if(!name || !*name) continue;
|
||||
if(!value || !*value) continue;
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: API v1 badge.svg query param '%s' with value '%s'", w->id, name, value);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 badge.svg query param '%s' with value '%s'", w->id, name, value);
|
||||
|
||||
// name and value are now the parameters
|
||||
// they are not null and not empty
|
||||
|
@ -1040,7 +1040,7 @@ int web_client_api_request_v1_badge(RRDHOST *host, struct web_client *w, char *u
|
|||
units = rrdset_units(st);
|
||||
}
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: API command 'badge.svg' for chart '%s', alarm '%s', dimensions '%s', after '%lld', before '%lld', points '%d', group '%d', options '0x%08x'"
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: API command 'badge.svg' for chart '%s', alarm '%s', dimensions '%s', after '%lld', before '%lld', points '%d', group '%d', options '0x%08x'"
|
||||
, w->id
|
||||
, chart
|
||||
, alarm?alarm:""
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
void free_silencers(SILENCER *t) {
|
||||
if (!t) return;
|
||||
if (t->next) free_silencers(t->next);
|
||||
debug(D_HEALTH, "HEALTH command API: Freeing silencer %s:%s:%s:%s:%s", t->alarms,
|
||||
netdata_log_debug(D_HEALTH, "HEALTH command API: Freeing silencer %s:%s:%s:%s:%s", t->alarms,
|
||||
t->charts, t->contexts, t->hosts, t->families);
|
||||
simple_pattern_free(t->alarms_pattern);
|
||||
simple_pattern_free(t->charts_pattern);
|
||||
|
@ -133,7 +133,7 @@ int web_client_api_request_v1_mgmt_health(RRDHOST *host, struct web_client *w, c
|
|||
buffer_strcat(wb, HEALTH_CMDAPI_MSG_AUTHERROR);
|
||||
ret = HTTP_RESP_FORBIDDEN;
|
||||
} else {
|
||||
debug(D_HEALTH, "HEALTH command API: Comparing secret '%s' to '%s'", w->auth_bearer_token, api_secret);
|
||||
netdata_log_debug(D_HEALTH, "HEALTH command API: Comparing secret '%s' to '%s'", w->auth_bearer_token, api_secret);
|
||||
if (strcmp(w->auth_bearer_token, api_secret)) {
|
||||
buffer_strcat(wb, HEALTH_CMDAPI_MSG_AUTHERROR);
|
||||
ret = HTTP_RESP_FORBIDDEN;
|
||||
|
@ -146,7 +146,7 @@ int web_client_api_request_v1_mgmt_health(RRDHOST *host, struct web_client *w, c
|
|||
if (!key || !*key) continue;
|
||||
if (!value || !*value) continue;
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: API v1 health query param '%s' with value '%s'", w->id, key, value);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 health query param '%s' with value '%s'", w->id, key, value);
|
||||
|
||||
// name and value are now the parameters
|
||||
if (!strcmp(key, "cmd")) {
|
||||
|
|
|
@ -414,7 +414,7 @@ inline int web_client_api_request_v1_alarm_count(RRDHOST *host, struct web_clien
|
|||
if(!name || !*name) continue;
|
||||
if(!value || !*value) continue;
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: API v1 alarm_count query param '%s' with value '%s'", w->id, name, value);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 alarm_count query param '%s' with value '%s'", w->id, name, value);
|
||||
|
||||
char* p = value;
|
||||
if(!strcmp(name, "status")) {
|
||||
|
@ -654,7 +654,7 @@ inline int web_client_api_request_v1_chart(RRDHOST *host, struct web_client *w,
|
|||
|
||||
// returns the HTTP code
|
||||
static inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, char *url) {
|
||||
debug(D_WEB_CLIENT, "%llu: API v1 data with URL '%s'", w->id, url);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 data with URL '%s'", w->id, url);
|
||||
|
||||
int ret = HTTP_RESP_BAD_REQUEST;
|
||||
BUFFER *dimensions = NULL;
|
||||
|
@ -693,7 +693,7 @@ static inline int web_client_api_request_v1_data(RRDHOST *host, struct web_clien
|
|||
if(!name || !*name) continue;
|
||||
if(!value || !*value) continue;
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: API v1 data query param '%s' with value '%s'", w->id, name, value);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 data query param '%s' with value '%s'", w->id, name, value);
|
||||
|
||||
// name and value are now the parameters
|
||||
// they are not null and not empty
|
||||
|
@ -839,14 +839,14 @@ static inline int web_client_api_request_v1_data(RRDHOST *host, struct web_clien
|
|||
|
||||
if(outFileName && *outFileName) {
|
||||
buffer_sprintf(w->response.header, "Content-Disposition: attachment; filename=\"%s\"\r\n", outFileName);
|
||||
debug(D_WEB_CLIENT, "%llu: generating outfilename header: '%s'", w->id, outFileName);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: generating outfilename header: '%s'", w->id, outFileName);
|
||||
}
|
||||
|
||||
if(format == DATASOURCE_DATATABLE_JSONP) {
|
||||
if(responseHandler == NULL)
|
||||
responseHandler = "google.visualization.Query.setResponse";
|
||||
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: GOOGLE JSON/JSONP: version = '%s', reqId = '%s', sig = '%s', out = '%s', responseHandler = '%s', outFileName = '%s'",
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: GOOGLE JSON/JSONP: version = '%s', reqId = '%s', sig = '%s', out = '%s', responseHandler = '%s', outFileName = '%s'",
|
||||
w->id, google_version, google_reqId, google_sig, google_out, responseHandler, outFileName
|
||||
);
|
||||
|
||||
|
@ -927,7 +927,7 @@ inline int web_client_api_request_v1_registry(RRDHOST *host, struct web_client *
|
|||
*/
|
||||
}
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: API v1 registry with URL '%s'", w->id, url);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 registry with URL '%s'", w->id, url);
|
||||
|
||||
// TODO
|
||||
// The browser may send multiple cookies with our id
|
||||
|
@ -961,7 +961,7 @@ inline int web_client_api_request_v1_registry(RRDHOST *host, struct web_client *
|
|||
if (!name || !*name) continue;
|
||||
if (!value || !*value) continue;
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: API v1 registry query param '%s' with value '%s'", w->id, name, value);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: API v1 registry query param '%s' with value '%s'", w->id, name, value);
|
||||
|
||||
uint32_t hash = simple_hash(name);
|
||||
|
||||
|
|
|
@ -587,14 +587,14 @@ static int web_client_api_request_v2_data(RRDHOST *host __maybe_unused, struct w
|
|||
|
||||
if(outFileName && *outFileName) {
|
||||
buffer_sprintf(w->response.header, "Content-Disposition: attachment; filename=\"%s\"\r\n", outFileName);
|
||||
debug(D_WEB_CLIENT, "%llu: generating outfilename header: '%s'", w->id, outFileName);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: generating outfilename header: '%s'", w->id, outFileName);
|
||||
}
|
||||
|
||||
if(format == DATASOURCE_DATATABLE_JSONP) {
|
||||
if(responseHandler == NULL)
|
||||
responseHandler = "google.visualization.Query.setResponse";
|
||||
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: GOOGLE JSON/JSONP: version = '%s', reqId = '%s', sig = '%s', out = '%s', responseHandler = '%s', outFileName = '%s'",
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: GOOGLE JSON/JSONP: version = '%s', reqId = '%s', sig = '%s', out = '%s', responseHandler = '%s', outFileName = '%s'",
|
||||
w->id, google_version, google_reqId, google_sig, google_out, responseHandler, outFileName
|
||||
);
|
||||
|
||||
|
|
|
@ -41,11 +41,11 @@ static struct web_client *web_client_create_on_fd(POLLINFO *pi) {
|
|||
|
||||
int flag = 1;
|
||||
if(unlikely(web_client_check_tcp(w) && setsockopt(w->ifd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)) != 0))
|
||||
debug(D_WEB_CLIENT, "%llu: failed to enable TCP_NODELAY on socket fd %d.", w->id, w->ifd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: failed to enable TCP_NODELAY on socket fd %d.", w->id, w->ifd);
|
||||
|
||||
flag = 1;
|
||||
if(unlikely(setsockopt(w->ifd, SOL_SOCKET, SO_KEEPALIVE, (char *) &flag, sizeof(int)) != 0))
|
||||
debug(D_WEB_CLIENT, "%llu: failed to enable SO_KEEPALIVE on socket fd %d.", w->id, w->ifd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: failed to enable SO_KEEPALIVE on socket fd %d.", w->id, w->ifd);
|
||||
|
||||
web_client_update_acl_matches(w);
|
||||
web_client_enable_wait_receive(w);
|
||||
|
@ -101,7 +101,7 @@ static void *web_server_file_add_callback(POLLINFO *pi, short int *events, void
|
|||
|
||||
worker_private->files_read++;
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: ADDED FILE READ ON FD %d", w->id, pi->fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: ADDED FILE READ ON FD %d", w->id, pi->fd);
|
||||
*events = POLLIN;
|
||||
pi->data = w;
|
||||
|
||||
|
@ -111,14 +111,14 @@ static void *web_server_file_add_callback(POLLINFO *pi, short int *events, void
|
|||
|
||||
static void web_server_file_del_callback(POLLINFO *pi) {
|
||||
struct web_client *w = (struct web_client *)pi->data;
|
||||
debug(D_WEB_CLIENT, "%llu: RELEASE FILE READ ON FD %d", w->id, pi->fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: RELEASE FILE READ ON FD %d", w->id, pi->fd);
|
||||
|
||||
worker_is_busy(WORKER_JOB_DEL_FILE);
|
||||
|
||||
w->pollinfo_filecopy_slot = 0;
|
||||
|
||||
if(unlikely(!w->pollinfo_slot)) {
|
||||
debug(D_WEB_CLIENT, "%llu: CROSS WEB CLIENT CLEANUP (iFD %d, oFD %d)", w->id, pi->fd, w->ofd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: CROSS WEB CLIENT CLEANUP (iFD %d, oFD %d)", w->id, pi->fd, w->ofd);
|
||||
web_server_log_connection(w, "DISCONNECTED");
|
||||
web_client_request_done(w);
|
||||
web_client_release_to_cache(w);
|
||||
|
@ -137,18 +137,18 @@ static int web_server_file_read_callback(POLLINFO *pi, short int *events) {
|
|||
// if there is no POLLINFO linked to this, it means the client disconnected
|
||||
// stop the file reading too
|
||||
if(unlikely(!w->pollinfo_slot)) {
|
||||
debug(D_WEB_CLIENT, "%llu: PREVENTED ATTEMPT TO READ FILE ON FD %d, ON CLOSED WEB CLIENT", w->id, pi->fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: PREVENTED ATTEMPT TO READ FILE ON FD %d, ON CLOSED WEB CLIENT", w->id, pi->fd);
|
||||
retval = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if(unlikely(w->mode != WEB_CLIENT_MODE_FILECOPY || w->ifd == w->ofd)) {
|
||||
debug(D_WEB_CLIENT, "%llu: PREVENTED ATTEMPT TO READ FILE ON FD %d, ON NON-FILECOPY WEB CLIENT", w->id, pi->fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: PREVENTED ATTEMPT TO READ FILE ON FD %d, ON NON-FILECOPY WEB CLIENT", w->id, pi->fd);
|
||||
retval = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: READING FILE ON FD %d", w->id, pi->fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: READING FILE ON FD %d", w->id, pi->fd);
|
||||
|
||||
worker_private->file_reads++;
|
||||
ssize_t ret = unlikely(web_client_read_file(w));
|
||||
|
@ -157,12 +157,12 @@ static int web_server_file_read_callback(POLLINFO *pi, short int *events) {
|
|||
POLLJOB *p = pi->p; // our POLLJOB
|
||||
POLLINFO *wpi = pollinfo_from_slot(p, w->pollinfo_slot); // POLLINFO of the client socket
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: SIGNALING W TO SEND (iFD %d, oFD %d)", w->id, pi->fd, wpi->fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: SIGNALING W TO SEND (iFD %d, oFD %d)", w->id, pi->fd, wpi->fd);
|
||||
p->fds[wpi->slot].events |= POLLOUT;
|
||||
}
|
||||
|
||||
if(unlikely(ret <= 0 || w->ifd == w->ofd)) {
|
||||
debug(D_WEB_CLIENT, "%llu: DONE READING FILE ON FD %d", w->id, pi->fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: DONE READING FILE ON FD %d", w->id, pi->fd);
|
||||
retval = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ static void *web_server_add_callback(POLLINFO *pi, short int *events, void *data
|
|||
|
||||
*events = POLLIN;
|
||||
|
||||
debug(D_WEB_CLIENT_ACCESS, "LISTENER on %d: new connection.", pi->fd);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "LISTENER on %d: new connection.", pi->fd);
|
||||
struct web_client *w = web_client_create_on_fd(pi);
|
||||
|
||||
if (!strncmp(pi->client_port, "UNIX", 4)) {
|
||||
|
@ -240,7 +240,7 @@ static void *web_server_add_callback(POLLINFO *pi, short int *events, void *data
|
|||
}
|
||||
#endif
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: ADDED CLIENT FD %d", w->id, pi->fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: ADDED CLIENT FD %d", w->id, pi->fd);
|
||||
|
||||
cleanup:
|
||||
worker_is_idle();
|
||||
|
@ -260,13 +260,13 @@ static void web_server_del_callback(POLLINFO *pi) {
|
|||
POLLINFO *fpi = pollinfo_from_slot(pi->p, w->pollinfo_filecopy_slot); // POLLINFO of the client socket
|
||||
(void)fpi;
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: THE CLIENT WILL BE FRED BY READING FILE JOB ON FD %d", w->id, fpi->fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: THE CLIENT WILL BE FRED BY READING FILE JOB ON FD %d", w->id, fpi->fd);
|
||||
}
|
||||
else {
|
||||
if(web_client_flag_check(w, WEB_CLIENT_FLAG_DONT_CLOSE_SOCKET))
|
||||
pi->flags |= POLLINFO_FLAG_DONT_CLOSE;
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: CLOSING CLIENT FD %d", w->id, pi->fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: CLOSING CLIENT FD %d", w->id, pi->fd);
|
||||
web_server_log_connection(w, "DISCONNECTED");
|
||||
web_client_request_done(w);
|
||||
web_client_release_to_cache(w);
|
||||
|
@ -289,7 +289,7 @@ static int web_server_rcv_callback(POLLINFO *pi, short int *events) {
|
|||
bytes = web_client_receive(w);
|
||||
|
||||
if (likely(bytes > 0)) {
|
||||
debug(D_WEB_CLIENT, "%llu: processing received data on fd %d.", w->id, fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: processing received data on fd %d.", w->id, fd);
|
||||
worker_is_idle();
|
||||
worker_is_busy(WORKER_JOB_PROCESS);
|
||||
web_client_process_request(w);
|
||||
|
@ -300,11 +300,11 @@ static int web_server_rcv_callback(POLLINFO *pi, short int *events) {
|
|||
|
||||
else if(unlikely(w->mode == WEB_CLIENT_MODE_FILECOPY)) {
|
||||
if(w->pollinfo_filecopy_slot == 0) {
|
||||
debug(D_WEB_CLIENT, "%llu: FILECOPY DETECTED ON FD %d", w->id, pi->fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: FILECOPY DETECTED ON FD %d", w->id, pi->fd);
|
||||
|
||||
if (unlikely(w->ifd != -1 && w->ifd != w->ofd && w->ifd != fd)) {
|
||||
// add a new socket to poll_events, with the same
|
||||
debug(D_WEB_CLIENT, "%llu: CREATING FILECOPY SLOT ON FD %d", w->id, pi->fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: CREATING FILECOPY SLOT ON FD %d", w->id, pi->fd);
|
||||
|
||||
POLLINFO *fpi = poll_add_fd(
|
||||
pi->p
|
||||
|
@ -366,7 +366,7 @@ static int web_server_snd_callback(POLLINFO *pi, short int *events) {
|
|||
struct web_client *w = (struct web_client *)pi->data;
|
||||
int fd = pi->fd;
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: sending data on fd %d.", w->id, fd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: sending data on fd %d.", w->id, fd);
|
||||
|
||||
int ret = web_client_send(w);
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ static void web_client_reset_allocations(struct web_client *w, bool free_all) {
|
|||
void web_client_request_done(struct web_client *w) {
|
||||
web_client_uncork_socket(w);
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: Resetting client.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Resetting client.", w->id);
|
||||
|
||||
if(likely(buffer_strlen(w->url_as_received))) {
|
||||
struct timeval tv;
|
||||
|
@ -233,7 +233,7 @@ void web_client_request_done(struct web_client *w) {
|
|||
|
||||
if(unlikely(w->mode == WEB_CLIENT_MODE_FILECOPY)) {
|
||||
if(w->ifd != w->ofd) {
|
||||
debug(D_WEB_CLIENT, "%llu: Closing filecopy input file descriptor %d.", w->id, w->ifd);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Closing filecopy input file descriptor %d.", w->id, w->ifd);
|
||||
|
||||
if(web_server_mode != WEB_SERVER_MODE_STATIC_THREADED) {
|
||||
if (w->ifd != -1){
|
||||
|
@ -480,7 +480,7 @@ static bool find_filename_to_serve(const char *filename, char *dst, size_t dst_l
|
|||
}
|
||||
|
||||
static int mysendfile(struct web_client *w, char *filename) {
|
||||
debug(D_WEB_CLIENT, "%llu: Looking for file '%s/%s'", w->id, netdata_configured_web_dir, filename);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Looking for file '%s/%s'", w->id, netdata_configured_web_dir, filename);
|
||||
|
||||
if(!web_client_can_access_dashboard(w))
|
||||
return web_client_permission_denied(w);
|
||||
|
@ -492,7 +492,7 @@ static int mysendfile(struct web_client *w, char *filename) {
|
|||
char *s;
|
||||
for(s = filename; *s ;s++) {
|
||||
if( !isalnum(*s) && *s != '/' && *s != '.' && *s != '-' && *s != '_') {
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: File '%s' is not acceptable.", w->id, filename);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: File '%s' is not acceptable.", w->id, filename);
|
||||
w->response.data->content_type = CT_TEXT_HTML;
|
||||
buffer_sprintf(w->response.data, "Filename contains invalid characters: ");
|
||||
buffer_strcat_htmlescape(w->response.data, filename);
|
||||
|
@ -502,7 +502,7 @@ static int mysendfile(struct web_client *w, char *filename) {
|
|||
|
||||
// if the filename contains a double dot refuse to serve it
|
||||
if(strstr(filename, "..") != 0) {
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: File '%s' is not acceptable.", w->id, filename);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: File '%s' is not acceptable.", w->id, filename);
|
||||
w->response.data->content_type = CT_TEXT_HTML;
|
||||
buffer_strcat(w->response.data, "Relative filenames are not supported: ");
|
||||
buffer_strcat_htmlescape(w->response.data, filename);
|
||||
|
@ -548,7 +548,7 @@ static int mysendfile(struct web_client *w, char *filename) {
|
|||
sock_setnonblock(w->ifd);
|
||||
|
||||
w->response.data->content_type = contenttype_for_filename(web_filename);
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: Sending file '%s' (%"PRId64" bytes, ifd %d, ofd %d).", w->id, web_filename, (int64_t)statbuf.st_size, w->ifd, w->ofd);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: Sending file '%s' (%"PRId64" bytes, ifd %d, ofd %d).", w->id, web_filename, (int64_t)statbuf.st_size, w->ifd, w->ofd);
|
||||
|
||||
w->mode = WEB_CLIENT_MODE_FILECOPY;
|
||||
web_client_enable_wait_receive(w);
|
||||
|
@ -569,7 +569,7 @@ static int mysendfile(struct web_client *w, char *filename) {
|
|||
|
||||
void web_client_enable_deflate(struct web_client *w, int gzip) {
|
||||
if(unlikely(w->response.zinitialized)) {
|
||||
debug(D_DEFLATE, "%llu: Compression has already be initialized for this client.", w->id);
|
||||
netdata_log_debug(D_DEFLATE, "%llu: Compression has already be initialized for this client.", w->id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -610,7 +610,7 @@ void web_client_enable_deflate(struct web_client *w, int gzip) {
|
|||
w->response.zinitialized = true;
|
||||
w->flags |= WEB_CLIENT_CHUNKED_TRANSFER;
|
||||
|
||||
debug(D_DEFLATE, "%llu: Initialized compression.", w->id);
|
||||
netdata_log_debug(D_DEFLATE, "%llu: Initialized compression.", w->id);
|
||||
}
|
||||
|
||||
void buffer_data_options2string(BUFFER *wb, uint32_t options) {
|
||||
|
@ -711,7 +711,7 @@ int web_client_api_request(RRDHOST *host, struct web_client *w, char *url_path_f
|
|||
// get the api version
|
||||
char *tok = strsep_skip_consecutive_separators(&url_path_fragment, "/");
|
||||
if(tok && *tok) {
|
||||
debug(D_WEB_CLIENT, "%llu: Searching for API version '%s'.", w->id, tok);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Searching for API version '%s'.", w->id, tok);
|
||||
if(strcmp(tok, "v2") == 0)
|
||||
return web_client_api_request_v2(host, w, url_path_fragment);
|
||||
else if(strcmp(tok, "v1") == 0)
|
||||
|
@ -1161,7 +1161,7 @@ void web_client_build_http_header(struct web_client *w) {
|
|||
}
|
||||
|
||||
// prepare the HTTP response header
|
||||
debug(D_WEB_CLIENT, "%llu: Generating HTTP header with response %d.", w->id, w->response.code);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Generating HTTP header with response %d.", w->id, w->response.code);
|
||||
|
||||
const char *content_type_string = web_content_type_to_string(w->response.data->content_type);
|
||||
const char *code_msg = web_response_code_to_string(w->response.code);
|
||||
|
@ -1268,7 +1268,7 @@ static inline void web_client_send_http_header(struct web_client *w) {
|
|||
web_client_build_http_header(w);
|
||||
|
||||
// sent the HTTP header
|
||||
debug(D_WEB_DATA, "%llu: Sending response HTTP header of size %zu: '%s'"
|
||||
netdata_log_debug(D_WEB_DATA, "%llu: Sending response HTTP header of size %zu: '%s'"
|
||||
, w->id
|
||||
, buffer_strlen(w->response.header_output)
|
||||
, buffer_tostring(w->response.header_output)
|
||||
|
@ -1348,7 +1348,7 @@ static inline int web_client_switch_host(RRDHOST *host, struct web_client *w, ch
|
|||
|
||||
char *tok = strsep_skip_consecutive_separators(&url, "/");
|
||||
if(tok && *tok) {
|
||||
debug(D_WEB_CLIENT, "%llu: Searching for host with name '%s'.", w->id, tok);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Searching for host with name '%s'.", w->id, tok);
|
||||
|
||||
if(nodeid) {
|
||||
host = find_host_by_node_id(tok);
|
||||
|
@ -1420,12 +1420,12 @@ int web_client_api_request_with_node_selection(RRDHOST *host, struct web_client
|
|||
|
||||
if(unlikely(hash == hash_api && strcmp(tok, "api") == 0)) {
|
||||
// current API
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: API request ...", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: API request ...", w->id);
|
||||
return check_host_and_call(host, w, decoded_url_path, web_client_api_request);
|
||||
}
|
||||
else if(unlikely((hash == hash_host && strcmp(tok, "host") == 0) || (hash == hash_node && strcmp(tok, "node") == 0))) {
|
||||
// host switching
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: host switch request ...", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: host switch request ...", w->id);
|
||||
return web_client_switch_host(host, w, decoded_url_path, hash == hash_node, web_client_api_request_with_node_selection);
|
||||
}
|
||||
}
|
||||
|
@ -1475,14 +1475,14 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
|
|||
char *tok = strsep_skip_consecutive_separators(&decoded_url_path, "/?");
|
||||
if(likely(tok && *tok)) {
|
||||
uint32_t hash = simple_hash(tok);
|
||||
debug(D_WEB_CLIENT, "%llu: Processing command '%s'.", w->id, tok);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Processing command '%s'.", w->id, tok);
|
||||
|
||||
if(likely(hash == hash_api && strcmp(tok, "api") == 0)) { // current API
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: API request ...", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: API request ...", w->id);
|
||||
return check_host_and_call(host, w, decoded_url_path, web_client_api_request);
|
||||
}
|
||||
else if(unlikely((hash == hash_host && strcmp(tok, "host") == 0) || (hash == hash_node && strcmp(tok, "node") == 0))) { // host switching
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: host switch request ...", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: host switch request ...", w->id);
|
||||
return web_client_switch_host(host, w, decoded_url_path, hash == hash_node, web_client_process_url);
|
||||
}
|
||||
else if(unlikely(hash == hash_v2 && strcmp(tok, "v2") == 0)) {
|
||||
|
@ -1507,7 +1507,7 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
|
|||
if(unlikely(!web_client_can_access_netdataconf(w)))
|
||||
return web_client_permission_denied(w);
|
||||
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: generating netdata.conf ...", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: generating netdata.conf ...", w->id);
|
||||
w->response.data->content_type = CT_TEXT_PLAIN;
|
||||
buffer_flush(w->response.data);
|
||||
config_generate(w->response.data, 0);
|
||||
|
@ -1539,7 +1539,7 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
|
|||
// get the name of the data to show
|
||||
tok = strsep_skip_consecutive_separators(&decoded_url_path, "&");
|
||||
if(tok && *tok) {
|
||||
debug(D_WEB_CLIENT, "%llu: Searching for RRD data with name '%s'.", w->id, tok);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Searching for RRD data with name '%s'.", w->id, tok);
|
||||
|
||||
// do we have such a data set?
|
||||
RRDSET *st = rrdset_find_byname(host, tok);
|
||||
|
@ -1548,7 +1548,7 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
|
|||
w->response.data->content_type = CT_TEXT_HTML;
|
||||
buffer_strcat(w->response.data, "Chart is not found: ");
|
||||
buffer_strcat_htmlescape(w->response.data, tok);
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: %s is not found.", w->id, tok);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: %s is not found.", w->id, tok);
|
||||
return HTTP_RESP_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -1562,7 +1562,7 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
|
|||
w->response.data->content_type = CT_TEXT_HTML;
|
||||
buffer_sprintf(w->response.data, "Chart has now debug %s: ", rrdset_flag_check(st, RRDSET_FLAG_DEBUG)?"enabled":"disabled");
|
||||
buffer_strcat_htmlescape(w->response.data, tok);
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: debug for %s is %s.", w->id, tok, rrdset_flag_check(st, RRDSET_FLAG_DEBUG)?"enabled":"disabled");
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: debug for %s is %s.", w->id, tok, rrdset_flag_check(st, RRDSET_FLAG_DEBUG)?"enabled":"disabled");
|
||||
return HTTP_RESP_OK;
|
||||
}
|
||||
|
||||
|
@ -1574,7 +1574,7 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
|
|||
if(unlikely(!web_client_can_access_netdataconf(w)))
|
||||
return web_client_permission_denied(w);
|
||||
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: Mirroring...", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: Mirroring...", w->id);
|
||||
|
||||
// replace the zero bytes with spaces
|
||||
buffer_char_replace(w->response.data, '\0', ' ');
|
||||
|
@ -1676,7 +1676,7 @@ void web_client_process_request(struct web_client *w) {
|
|||
buffer_flush(w->url_as_received);
|
||||
buffer_strcat(w->url_as_received, "too big request");
|
||||
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: Received request is too big (%zu bytes).", w->id, w->response.data->len);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: Received request is too big (%zu bytes).", w->id, w->response.data->len);
|
||||
|
||||
size_t len = w->response.data->len;
|
||||
buffer_flush(w->response.data);
|
||||
|
@ -1710,28 +1710,28 @@ void web_client_process_request(struct web_client *w) {
|
|||
}
|
||||
#endif
|
||||
case HTTP_VALIDATION_MALFORMED_URL:
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: Malformed URL '%s'.", w->id, w->response.data->buffer);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: Malformed URL '%s'.", w->id, w->response.data->buffer);
|
||||
|
||||
buffer_flush(w->response.data);
|
||||
buffer_strcat(w->response.data, "Malformed URL...\r\n");
|
||||
w->response.code = HTTP_RESP_BAD_REQUEST;
|
||||
break;
|
||||
case HTTP_VALIDATION_EXCESS_REQUEST_DATA:
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: Excess data in request '%s'.", w->id, w->response.data->buffer);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: Excess data in request '%s'.", w->id, w->response.data->buffer);
|
||||
|
||||
buffer_flush(w->response.data);
|
||||
buffer_strcat(w->response.data, "Excess data in request.\r\n");
|
||||
w->response.code = HTTP_RESP_BAD_REQUEST;
|
||||
break;
|
||||
case HTTP_VALIDATION_TOO_MANY_READ_RETRIES:
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: Too many retries to read request '%s'.", w->id, w->response.data->buffer);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: Too many retries to read request '%s'.", w->id, w->response.data->buffer);
|
||||
|
||||
buffer_flush(w->response.data);
|
||||
buffer_strcat(w->response.data, "Too many retries to read request.\r\n");
|
||||
w->response.code = HTTP_RESP_BAD_REQUEST;
|
||||
break;
|
||||
case HTTP_VALIDATION_NOT_SUPPORTED:
|
||||
debug(D_WEB_CLIENT_ACCESS, "%llu: HTTP method requested is not supported '%s'.", w->id, w->response.data->buffer);
|
||||
netdata_log_debug(D_WEB_CLIENT_ACCESS, "%llu: HTTP method requested is not supported '%s'.", w->id, w->response.data->buffer);
|
||||
|
||||
buffer_flush(w->response.data);
|
||||
buffer_strcat(w->response.data, "HTTP method requested is not supported...\r\n");
|
||||
|
@ -1756,21 +1756,21 @@ void web_client_process_request(struct web_client *w) {
|
|||
|
||||
switch(w->mode) {
|
||||
case WEB_CLIENT_MODE_STREAM:
|
||||
debug(D_WEB_CLIENT, "%llu: STREAM done.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: STREAM done.", w->id);
|
||||
break;
|
||||
|
||||
case WEB_CLIENT_MODE_OPTIONS:
|
||||
debug(D_WEB_CLIENT, "%llu: Done preparing the OPTIONS response. Sending data (%zu bytes) to client.", w->id, w->response.data->len);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Done preparing the OPTIONS response. Sending data (%zu bytes) to client.", w->id, w->response.data->len);
|
||||
break;
|
||||
|
||||
case WEB_CLIENT_MODE_POST:
|
||||
case WEB_CLIENT_MODE_GET:
|
||||
debug(D_WEB_CLIENT, "%llu: Done preparing the response. Sending data (%zu bytes) to client.", w->id, w->response.data->len);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Done preparing the response. Sending data (%zu bytes) to client.", w->id, w->response.data->len);
|
||||
break;
|
||||
|
||||
case WEB_CLIENT_MODE_FILECOPY:
|
||||
if(w->response.rlen) {
|
||||
debug(D_WEB_CLIENT, "%llu: Done preparing the response. Will be sending data file of %zu bytes to client.", w->id, w->response.rlen);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Done preparing the response. Will be sending data file of %zu bytes to client.", w->id, w->response.rlen);
|
||||
web_client_enable_wait_receive(w);
|
||||
|
||||
/*
|
||||
|
@ -1787,7 +1787,7 @@ void web_client_process_request(struct web_client *w) {
|
|||
*/
|
||||
}
|
||||
else
|
||||
debug(D_WEB_CLIENT, "%llu: Done preparing the response. Will be sending an unknown amount of bytes to client.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Done preparing the response. Will be sending an unknown amount of bytes to client.", w->id);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1798,7 +1798,7 @@ void web_client_process_request(struct web_client *w) {
|
|||
|
||||
ssize_t web_client_send_chunk_header(struct web_client *w, size_t len)
|
||||
{
|
||||
debug(D_DEFLATE, "%llu: OPEN CHUNK of %zu bytes (hex: %zx).", w->id, len, len);
|
||||
netdata_log_debug(D_DEFLATE, "%llu: OPEN CHUNK of %zu bytes (hex: %zx).", w->id, len, len);
|
||||
char buf[24];
|
||||
ssize_t bytes;
|
||||
bytes = (ssize_t)sprintf(buf, "%zX\r\n", len);
|
||||
|
@ -1806,15 +1806,15 @@ ssize_t web_client_send_chunk_header(struct web_client *w, size_t len)
|
|||
|
||||
bytes = web_client_send_data(w,buf,strlen(buf),0);
|
||||
if(bytes > 0) {
|
||||
debug(D_DEFLATE, "%llu: Sent chunk header %zd bytes.", w->id, bytes);
|
||||
netdata_log_debug(D_DEFLATE, "%llu: Sent chunk header %zd bytes.", w->id, bytes);
|
||||
w->statistics.sent_bytes += bytes;
|
||||
}
|
||||
|
||||
else if(bytes == 0) {
|
||||
debug(D_WEB_CLIENT, "%llu: Did not send chunk header to the client.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Did not send chunk header to the client.", w->id);
|
||||
}
|
||||
else {
|
||||
debug(D_WEB_CLIENT, "%llu: Failed to send chunk header to client.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Failed to send chunk header to client.", w->id);
|
||||
WEB_CLIENT_IS_DEAD(w);
|
||||
}
|
||||
|
||||
|
@ -1828,15 +1828,15 @@ ssize_t web_client_send_chunk_close(struct web_client *w)
|
|||
ssize_t bytes;
|
||||
bytes = web_client_send_data(w,"\r\n",2,0);
|
||||
if(bytes > 0) {
|
||||
debug(D_DEFLATE, "%llu: Sent chunk suffix %zd bytes.", w->id, bytes);
|
||||
netdata_log_debug(D_DEFLATE, "%llu: Sent chunk suffix %zd bytes.", w->id, bytes);
|
||||
w->statistics.sent_bytes += bytes;
|
||||
}
|
||||
|
||||
else if(bytes == 0) {
|
||||
debug(D_WEB_CLIENT, "%llu: Did not send chunk suffix to the client.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Did not send chunk suffix to the client.", w->id);
|
||||
}
|
||||
else {
|
||||
debug(D_WEB_CLIENT, "%llu: Failed to send chunk suffix to client.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Failed to send chunk suffix to client.", w->id);
|
||||
WEB_CLIENT_IS_DEAD(w);
|
||||
}
|
||||
|
||||
|
@ -1850,15 +1850,15 @@ ssize_t web_client_send_chunk_finalize(struct web_client *w)
|
|||
ssize_t bytes;
|
||||
bytes = web_client_send_data(w,"\r\n0\r\n\r\n",7,0);
|
||||
if(bytes > 0) {
|
||||
debug(D_DEFLATE, "%llu: Sent chunk suffix %zd bytes.", w->id, bytes);
|
||||
netdata_log_debug(D_DEFLATE, "%llu: Sent chunk suffix %zd bytes.", w->id, bytes);
|
||||
w->statistics.sent_bytes += bytes;
|
||||
}
|
||||
|
||||
else if(bytes == 0) {
|
||||
debug(D_WEB_CLIENT, "%llu: Did not send chunk finalize suffix to the client.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Did not send chunk finalize suffix to the client.", w->id);
|
||||
}
|
||||
else {
|
||||
debug(D_WEB_CLIENT, "%llu: Failed to send chunk finalize suffix to client.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Failed to send chunk finalize suffix to client.", w->id);
|
||||
WEB_CLIENT_IS_DEAD(w);
|
||||
}
|
||||
|
||||
|
@ -1872,13 +1872,13 @@ ssize_t web_client_send_deflate(struct web_client *w)
|
|||
// when using compression,
|
||||
// w->response.sent is the amount of bytes passed through compression
|
||||
|
||||
debug(D_DEFLATE, "%llu: web_client_send_deflate(): w->response.data->len = %zu, w->response.sent = %zu, w->response.zhave = %zu, w->response.zsent = %zu, w->response.zstream.avail_in = %u, w->response.zstream.avail_out = %u, w->response.zstream.total_in = %lu, w->response.zstream.total_out = %lu.",
|
||||
netdata_log_debug(D_DEFLATE, "%llu: web_client_send_deflate(): w->response.data->len = %zu, w->response.sent = %zu, w->response.zhave = %zu, w->response.zsent = %zu, w->response.zstream.avail_in = %u, w->response.zstream.avail_out = %u, w->response.zstream.total_in = %lu, w->response.zstream.total_out = %lu.",
|
||||
w->id, w->response.data->len, w->response.sent, w->response.zhave, w->response.zsent, w->response.zstream.avail_in, w->response.zstream.avail_out, w->response.zstream.total_in, w->response.zstream.total_out);
|
||||
|
||||
if(w->response.data->len - w->response.sent == 0 && w->response.zstream.avail_in == 0 && w->response.zhave == w->response.zsent && w->response.zstream.avail_out != 0) {
|
||||
// there is nothing to send
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: Out of output data.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Out of output data.", w->id);
|
||||
|
||||
// finalize the chunk
|
||||
if(w->response.sent != 0) {
|
||||
|
@ -1888,20 +1888,20 @@ ssize_t web_client_send_deflate(struct web_client *w)
|
|||
|
||||
if(w->mode == WEB_CLIENT_MODE_FILECOPY && web_client_has_wait_receive(w) && w->response.rlen && w->response.rlen > w->response.data->len) {
|
||||
// we have to wait, more data will come
|
||||
debug(D_WEB_CLIENT, "%llu: Waiting for more data to become available.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Waiting for more data to become available.", w->id);
|
||||
web_client_disable_wait_send(w);
|
||||
return t;
|
||||
}
|
||||
|
||||
if(unlikely(!web_client_has_keepalive(w))) {
|
||||
debug(D_WEB_CLIENT, "%llu: Closing (keep-alive is not enabled). %zu bytes sent.", w->id, w->response.sent);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Closing (keep-alive is not enabled). %zu bytes sent.", w->id, w->response.sent);
|
||||
WEB_CLIENT_IS_DEAD(w);
|
||||
return t;
|
||||
}
|
||||
|
||||
// reset the client
|
||||
web_client_request_done(w);
|
||||
debug(D_WEB_CLIENT, "%llu: Done sending all data on socket.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Done sending all data on socket.", w->id);
|
||||
return t;
|
||||
}
|
||||
|
||||
|
@ -1914,7 +1914,7 @@ ssize_t web_client_send_deflate(struct web_client *w)
|
|||
if(t < 0) return t;
|
||||
}
|
||||
|
||||
debug(D_DEFLATE, "%llu: Compressing %zu new bytes starting from %zu (and %u left behind).", w->id, (w->response.data->len - w->response.sent), w->response.sent, w->response.zstream.avail_in);
|
||||
netdata_log_debug(D_DEFLATE, "%llu: Compressing %zu new bytes starting from %zu (and %u left behind).", w->id, (w->response.data->len - w->response.sent), w->response.sent, w->response.zstream.avail_in);
|
||||
|
||||
// give the compressor all the data not passed through the compressor yet
|
||||
if(w->response.data->len > w->response.sent) {
|
||||
|
@ -1931,10 +1931,10 @@ ssize_t web_client_send_deflate(struct web_client *w)
|
|||
if((w->mode == WEB_CLIENT_MODE_GET || w->mode == WEB_CLIENT_MODE_POST)
|
||||
|| (w->mode == WEB_CLIENT_MODE_FILECOPY && !web_client_has_wait_receive(w) && w->response.data->len == w->response.rlen)) {
|
||||
flush = Z_FINISH;
|
||||
debug(D_DEFLATE, "%llu: Requesting Z_FINISH, if possible.", w->id);
|
||||
netdata_log_debug(D_DEFLATE, "%llu: Requesting Z_FINISH, if possible.", w->id);
|
||||
}
|
||||
else {
|
||||
debug(D_DEFLATE, "%llu: Requesting Z_SYNC_FLUSH.", w->id);
|
||||
netdata_log_debug(D_DEFLATE, "%llu: Requesting Z_SYNC_FLUSH.", w->id);
|
||||
}
|
||||
|
||||
// compress
|
||||
|
@ -1950,30 +1950,30 @@ ssize_t web_client_send_deflate(struct web_client *w)
|
|||
// keep track of the bytes passed through the compressor
|
||||
w->response.sent = w->response.data->len;
|
||||
|
||||
debug(D_DEFLATE, "%llu: Compression produced %zu bytes.", w->id, w->response.zhave);
|
||||
netdata_log_debug(D_DEFLATE, "%llu: Compression produced %zu bytes.", w->id, w->response.zhave);
|
||||
|
||||
// open a new chunk
|
||||
ssize_t t2 = web_client_send_chunk_header(w, w->response.zhave);
|
||||
if(t2 < 0) return t2;
|
||||
t += t2;
|
||||
}
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: Sending %zu bytes of data (+%zd of chunk header).", w->id, w->response.zhave - w->response.zsent, t);
|
||||
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Sending %zu bytes of data (+%zd of chunk header).", w->id, w->response.zhave - w->response.zsent, t);
|
||||
|
||||
len = web_client_send_data(w,&w->response.zbuffer[w->response.zsent], (size_t) (w->response.zhave - w->response.zsent), MSG_DONTWAIT);
|
||||
if(len > 0) {
|
||||
w->statistics.sent_bytes += len;
|
||||
w->response.zsent += len;
|
||||
len += t;
|
||||
debug(D_WEB_CLIENT, "%llu: Sent %zd bytes.", w->id, len);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Sent %zd bytes.", w->id, len);
|
||||
}
|
||||
else if(len == 0) {
|
||||
debug(D_WEB_CLIENT, "%llu: Did not send any bytes to the client (zhave = %zu, zsent = %zu, need to send = %zu).",
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Did not send any bytes to the client (zhave = %zu, zsent = %zu, need to send = %zu).",
|
||||
w->id, w->response.zhave, w->response.zsent, w->response.zhave - w->response.zsent);
|
||||
|
||||
}
|
||||
else {
|
||||
debug(D_WEB_CLIENT, "%llu: Failed to send data to client.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Failed to send data to client.", w->id);
|
||||
WEB_CLIENT_IS_DEAD(w);
|
||||
}
|
||||
|
||||
|
@ -1988,7 +1988,7 @@ ssize_t web_client_send(struct web_client *w) {
|
|||
if(unlikely(w->response.data->len - w->response.sent == 0)) {
|
||||
// there is nothing to send
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: Out of output data.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Out of output data.", w->id);
|
||||
|
||||
// there can be two cases for this
|
||||
// A. we have done everything
|
||||
|
@ -1996,19 +1996,19 @@ ssize_t web_client_send(struct web_client *w) {
|
|||
|
||||
if(w->mode == WEB_CLIENT_MODE_FILECOPY && web_client_has_wait_receive(w) && w->response.rlen && w->response.rlen > w->response.data->len) {
|
||||
// we have to wait, more data will come
|
||||
debug(D_WEB_CLIENT, "%llu: Waiting for more data to become available.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Waiting for more data to become available.", w->id);
|
||||
web_client_disable_wait_send(w);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(unlikely(!web_client_has_keepalive(w))) {
|
||||
debug(D_WEB_CLIENT, "%llu: Closing (keep-alive is not enabled). %zu bytes sent.", w->id, w->response.sent);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Closing (keep-alive is not enabled). %zu bytes sent.", w->id, w->response.sent);
|
||||
WEB_CLIENT_IS_DEAD(w);
|
||||
return 0;
|
||||
}
|
||||
|
||||
web_client_request_done(w);
|
||||
debug(D_WEB_CLIENT, "%llu: Done sending all data on socket. Waiting for next request on the same socket.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Done sending all data on socket. Waiting for next request on the same socket.", w->id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2016,13 +2016,13 @@ ssize_t web_client_send(struct web_client *w) {
|
|||
if(likely(bytes > 0)) {
|
||||
w->statistics.sent_bytes += bytes;
|
||||
w->response.sent += bytes;
|
||||
debug(D_WEB_CLIENT, "%llu: Sent %zd bytes.", w->id, bytes);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Sent %zd bytes.", w->id, bytes);
|
||||
}
|
||||
else if(likely(bytes == 0)) {
|
||||
debug(D_WEB_CLIENT, "%llu: Did not send any bytes to the client.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Did not send any bytes to the client.", w->id);
|
||||
}
|
||||
else {
|
||||
debug(D_WEB_CLIENT, "%llu: Failed to send data to client.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Failed to send data to client.", w->id);
|
||||
WEB_CLIENT_IS_DEAD(w);
|
||||
}
|
||||
|
||||
|
@ -2046,8 +2046,8 @@ ssize_t web_client_read_file(struct web_client *w)
|
|||
w->response.data->len += bytes;
|
||||
w->response.data->buffer[w->response.data->len] = '\0';
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: Read %zd bytes.", w->id, bytes);
|
||||
debug(D_WEB_DATA, "%llu: Read data: '%s'.", w->id, &w->response.data->buffer[old]);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Read %zd bytes.", w->id, bytes);
|
||||
netdata_log_debug(D_WEB_DATA, "%llu: Read data: '%s'.", w->id, &w->response.data->buffer[old]);
|
||||
|
||||
web_client_enable_wait_send(w);
|
||||
|
||||
|
@ -2055,7 +2055,7 @@ ssize_t web_client_read_file(struct web_client *w)
|
|||
web_client_disable_wait_receive(w);
|
||||
}
|
||||
else if(likely(bytes == 0)) {
|
||||
debug(D_WEB_CLIENT, "%llu: Out of input file data.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Out of input file data.", w->id);
|
||||
|
||||
// if we cannot read, it means we have an error on input.
|
||||
// if however, we are copying a file from ifd to ofd, we should not return an error.
|
||||
|
@ -2065,7 +2065,7 @@ ssize_t web_client_read_file(struct web_client *w)
|
|||
// let it finish copying...
|
||||
web_client_disable_wait_receive(w);
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: Read the whole file.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Read the whole file.", w->id);
|
||||
|
||||
if(web_server_mode != WEB_SERVER_MODE_STATIC_THREADED) {
|
||||
if (w->ifd != w->ofd) close(w->ifd);
|
||||
|
@ -2074,7 +2074,7 @@ ssize_t web_client_read_file(struct web_client *w)
|
|||
w->ifd = w->ofd;
|
||||
}
|
||||
else {
|
||||
debug(D_WEB_CLIENT, "%llu: read data failed.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: read data failed.", w->id);
|
||||
WEB_CLIENT_IS_DEAD(w);
|
||||
}
|
||||
|
||||
|
@ -2120,18 +2120,18 @@ ssize_t web_client_receive(struct web_client *w)
|
|||
w->response.data->len += bytes;
|
||||
w->response.data->buffer[w->response.data->len] = '\0';
|
||||
|
||||
debug(D_WEB_CLIENT, "%llu: Received %zd bytes.", w->id, bytes);
|
||||
debug(D_WEB_DATA, "%llu: Received data: '%s'.", w->id, &w->response.data->buffer[old]);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Received %zd bytes.", w->id, bytes);
|
||||
netdata_log_debug(D_WEB_DATA, "%llu: Received data: '%s'.", w->id, &w->response.data->buffer[old]);
|
||||
}
|
||||
else if(unlikely(bytes < 0 && (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR))) {
|
||||
web_client_enable_wait_receive(w);
|
||||
return 0;
|
||||
}
|
||||
else if (bytes < 0) {
|
||||
debug(D_WEB_CLIENT, "%llu: receive data failed.", w->id);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: receive data failed.", w->id);
|
||||
WEB_CLIENT_IS_DEAD(w);
|
||||
} else
|
||||
debug(D_WEB_CLIENT, "%llu: Received %zd bytes.", w->id, bytes);
|
||||
netdata_log_debug(D_WEB_CLIENT, "%llu: Received %zd bytes.", w->id, bytes);
|
||||
|
||||
return(bytes);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ void debug_sockets() {
|
|||
buffer_strcat(wb, (api_sockets.fds_acl_flags[i] & WEB_CLIENT_ACL_MGMT)?"management ":"");
|
||||
buffer_strcat(wb, (api_sockets.fds_acl_flags[i] & WEB_CLIENT_ACL_STREAMING)?"streaming ":"");
|
||||
buffer_strcat(wb, (api_sockets.fds_acl_flags[i] & WEB_CLIENT_ACL_NETDATACONF)?"netdata.conf ":"");
|
||||
debug(D_WEB_CLIENT, "Socket fd %d name '%s' acl_flags: %s",
|
||||
netdata_log_debug(D_WEB_CLIENT, "Socket fd %d name '%s' acl_flags: %s",
|
||||
i,
|
||||
api_sockets.fds_names[i],
|
||||
buffer_tostring(wb));
|
||||
|
|
Loading…
Add table
Reference in a new issue