diff options
Diffstat (limited to 'aclk')
-rw-r--r-- | aclk/aclk.c | 2 | ||||
-rw-r--r-- | aclk/aclk_otp.c | 2 | ||||
-rw-r--r-- | aclk/aclk_query.c | 2 | ||||
-rw-r--r-- | aclk/aclk_rx_msgs.c | 2 | ||||
-rw-r--r-- | aclk/aclk_tx_msgs.c | 19 | ||||
-rw-r--r-- | aclk/schema-wrappers/alarm_config.cc | 18 | ||||
-rw-r--r-- | aclk/schema-wrappers/alarm_config.h | 2 | ||||
-rw-r--r-- | aclk/schema-wrappers/alarm_stream.cc | 22 | ||||
-rw-r--r-- | aclk/schema-wrappers/alarm_stream.h | 3 | ||||
-rw-r--r-- | aclk/schema-wrappers/node_info.h | 2 | ||||
-rw-r--r-- | aclk/schema-wrappers/schema_wrapper_utils.cc | 4 |
11 files changed, 25 insertions, 53 deletions
diff --git a/aclk/aclk.c b/aclk/aclk.c index 312db076f..854408ce6 100644 --- a/aclk/aclk.c +++ b/aclk/aclk.c @@ -1292,7 +1292,7 @@ char *aclk_state_json(void) } void add_aclk_host_labels(void) { - DICTIONARY *labels = localhost->rrdlabels; + RRDLABELS *labels = localhost->rrdlabels; #ifdef ENABLE_ACLK rrdlabels_add(labels, "_aclk_available", "true", RRDLABEL_SRC_AUTO|RRDLABEL_SRC_ACLK); diff --git a/aclk/aclk_otp.c b/aclk/aclk_otp.c index 99b2adea2..207ca08cf 100644 --- a/aclk/aclk_otp.c +++ b/aclk/aclk_otp.c @@ -502,7 +502,7 @@ int aclk_get_mqtt_otp(RSA *p_key, char **mqtt_id, char **mqtt_usr, char **mqtt_p } // Decrypt Challenge / Get response - unsigned char *response_plaintext; + unsigned char *response_plaintext = NULL; int response_plaintext_bytes = private_decrypt(p_key, challenge, challenge_bytes, &response_plaintext); if (response_plaintext_bytes < 0) { netdata_log_error("Couldn't decrypt the challenge received"); diff --git a/aclk/aclk_query.c b/aclk/aclk_query.c index 07d571be1..abacbca83 100644 --- a/aclk/aclk_query.c +++ b/aclk/aclk_query.c @@ -112,7 +112,7 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query) if(web_client_timeout_checkpoint_and_check(w, &t)) { netdata_log_access("QUERY CANCELED: QUEUE TIME EXCEEDED %llu ms (LIMIT %d ms)", t / USEC_PER_MS, query->timeout); retval = 1; - w->response.code = HTTP_RESP_BACKEND_FETCH_FAILED; + w->response.code = HTTP_RESP_SERVICE_UNAVAILABLE; aclk_http_msg_v2_err(query_thr->client, query->callback_topic, query->msg_id, w->response.code, CLOUD_EC_SND_TIMEOUT, CLOUD_EMSG_SND_TIMEOUT, NULL, 0); goto cleanup; } diff --git a/aclk/aclk_rx_msgs.c b/aclk/aclk_rx_msgs.c index 84ade2b34..6e4cd93fb 100644 --- a/aclk/aclk_rx_msgs.c +++ b/aclk/aclk_rx_msgs.c @@ -449,7 +449,7 @@ int stop_streaming_contexts(const char *msg, size_t msg_len) int cancel_pending_req(const char *msg, size_t msg_len) { - struct aclk_cancel_pending_req cmd; + struct aclk_cancel_pending_req cmd = {.request_id = NULL, .trace_id = NULL}; if(parse_cancel_pending_req(msg, msg_len, &cmd)) { error_report("Error parsing CancelPendingReq"); return 1; diff --git a/aclk/aclk_tx_msgs.c b/aclk/aclk_tx_msgs.c index 26e20dfb2..4102c818d 100644 --- a/aclk/aclk_tx_msgs.c +++ b/aclk/aclk_tx_msgs.c @@ -194,15 +194,16 @@ int aclk_http_msg_v2(mqtt_wss_client client, const char *topic, const char *msg_ int rc = aclk_send_message_with_bin_payload(client, msg, topic, payload, payload_len); switch (rc) { - case HTTP_RESP_FORBIDDEN: - aclk_http_msg_v2_err(client, topic, msg_id, rc, CLOUD_EC_REQ_REPLY_TOO_BIG, CLOUD_EMSG_REQ_REPLY_TOO_BIG, NULL, 0); - break; - case HTTP_RESP_INTERNAL_SERVER_ERROR: - aclk_http_msg_v2_err(client, topic, msg_id, rc, CLOUD_EC_FAIL_TOPIC, CLOUD_EMSG_FAIL_TOPIC, payload, payload_len); - break; - case HTTP_RESP_BACKEND_FETCH_FAILED: - aclk_http_msg_v2_err(client, topic, msg_id, rc, CLOUD_EC_SND_TIMEOUT, CLOUD_EMSG_SND_TIMEOUT, payload, payload_len); - break; + case HTTP_RESP_FORBIDDEN: + aclk_http_msg_v2_err(client, topic, msg_id, rc, CLOUD_EC_REQ_REPLY_TOO_BIG, CLOUD_EMSG_REQ_REPLY_TOO_BIG, NULL, 0); + break; + case HTTP_RESP_INTERNAL_SERVER_ERROR: + aclk_http_msg_v2_err(client, topic, msg_id, rc, CLOUD_EC_FAIL_TOPIC, CLOUD_EMSG_FAIL_TOPIC, payload, payload_len); + break; + case HTTP_RESP_GATEWAY_TIMEOUT: + case HTTP_RESP_SERVICE_UNAVAILABLE: + aclk_http_msg_v2_err(client, topic, msg_id, rc, CLOUD_EC_SND_TIMEOUT, CLOUD_EMSG_SND_TIMEOUT, payload, payload_len); + break; } return rc ? rc : http_code; } diff --git a/aclk/schema-wrappers/alarm_config.cc b/aclk/schema-wrappers/alarm_config.cc index fe0b0517c..64d28f324 100644 --- a/aclk/schema-wrappers/alarm_config.cc +++ b/aclk/schema-wrappers/alarm_config.cc @@ -15,28 +15,22 @@ void destroy_aclk_alarm_configuration(struct aclk_alarm_configuration *cfg) freez(cfg->alarm); freez(cfg->tmpl); freez(cfg->on_chart); - freez(cfg->classification); freez(cfg->type); freez(cfg->component); - freez(cfg->os); freez(cfg->hosts); freez(cfg->plugin); freez(cfg->module); freez(cfg->charts); - freez(cfg->families); freez(cfg->lookup); freez(cfg->every); freez(cfg->units); - freez(cfg->green); freez(cfg->red); - freez(cfg->calculation_expr); freez(cfg->warning_expr); freez(cfg->critical_expr); - freez(cfg->recipient); freez(cfg->exec); freez(cfg->delay); @@ -44,12 +38,11 @@ void destroy_aclk_alarm_configuration(struct aclk_alarm_configuration *cfg) freez(cfg->info); freez(cfg->options); freez(cfg->host_labels); - freez(cfg->p_db_lookup_dimensions); freez(cfg->p_db_lookup_method); freez(cfg->p_db_lookup_options); - freez(cfg->chart_labels); + freez(cfg->summary); } char *generate_provide_alarm_configuration(size_t *len, struct provide_alarm_configuration *data) @@ -65,14 +58,12 @@ char *generate_provide_alarm_configuration(size_t *len, struct provide_alarm_con cfg->set_template_(data->cfg.tmpl); if(data->cfg.on_chart) cfg->set_on_chart(data->cfg.on_chart); - if (data->cfg.classification) cfg->set_classification(data->cfg.classification); if (data->cfg.type) cfg->set_type(data->cfg.type); if (data->cfg.component) cfg->set_component(data->cfg.component); - if (data->cfg.os) cfg->set_os(data->cfg.os); if (data->cfg.hosts) @@ -83,27 +74,22 @@ char *generate_provide_alarm_configuration(size_t *len, struct provide_alarm_con cfg->set_module(data->cfg.module); if(data->cfg.charts) cfg->set_charts(data->cfg.charts); - if(data->cfg.families) - cfg->set_families(data->cfg.families); if(data->cfg.lookup) cfg->set_lookup(data->cfg.lookup); if(data->cfg.every) cfg->set_every(data->cfg.every); if(data->cfg.units) cfg->set_units(data->cfg.units); - if (data->cfg.green) cfg->set_green(data->cfg.green); if (data->cfg.red) cfg->set_red(data->cfg.red); - if (data->cfg.calculation_expr) cfg->set_calculation_expr(data->cfg.calculation_expr); if (data->cfg.warning_expr) cfg->set_warning_expr(data->cfg.warning_expr); if (data->cfg.critical_expr) cfg->set_critical_expr(data->cfg.critical_expr); - if (data->cfg.recipient) cfg->set_recipient(data->cfg.recipient); if (data->cfg.exec) @@ -131,6 +117,8 @@ char *generate_provide_alarm_configuration(size_t *len, struct provide_alarm_con if (data->cfg.chart_labels) cfg->set_chart_labels(data->cfg.chart_labels); + if (data->cfg.summary) + cfg->set_summary(data->cfg.summary); *len = PROTO_COMPAT_MSG_SIZE(msg); char *bin = (char*)mallocz(*len); diff --git a/aclk/schema-wrappers/alarm_config.h b/aclk/schema-wrappers/alarm_config.h index 4eaa4fd70..3c9a5d9a8 100644 --- a/aclk/schema-wrappers/alarm_config.h +++ b/aclk/schema-wrappers/alarm_config.h @@ -24,7 +24,6 @@ struct aclk_alarm_configuration { char *plugin; char *module; char *charts; - char *families; char *lookup; char *every; char *units; @@ -52,6 +51,7 @@ struct aclk_alarm_configuration { int32_t p_update_every; char *chart_labels; + char *summary; }; void destroy_aclk_alarm_configuration(struct aclk_alarm_configuration *cfg); diff --git a/aclk/schema-wrappers/alarm_stream.cc b/aclk/schema-wrappers/alarm_stream.cc index 1538bc9e0..29d80e39e 100644 --- a/aclk/schema-wrappers/alarm_stream.cc +++ b/aclk/schema-wrappers/alarm_stream.cc @@ -66,60 +66,41 @@ static alarms::v1::AlarmStatus aclk_alarm_status_to_proto(enum aclk_alarm_status void destroy_alarm_log_entry(struct alarm_log_entry *entry) { - //freez(entry->node_id); - //freez(entry->claim_id); - freez(entry->chart); freez(entry->name); - freez(entry->family); - freez(entry->config_hash); - freez(entry->timezone); - freez(entry->exec_path); freez(entry->conf_source); freez(entry->command); - freez(entry->value_string); freez(entry->old_value_string); - freez(entry->rendered_info); freez(entry->chart_context); freez(entry->transition_id); freez(entry->chart_name); + freez(entry->summary); } static void fill_alarm_log_entry(struct alarm_log_entry *data, AlarmLogEntry *proto) { proto->set_node_id(data->node_id); proto->set_claim_id(data->claim_id); - proto->set_chart(data->chart); proto->set_name(data->name); - if (data->family) - proto->set_family(data->family); - proto->set_when(data->when); - proto->set_config_hash(data->config_hash); - proto->set_utc_offset(data->utc_offset); proto->set_timezone(data->timezone); - proto->set_exec_path(data->exec_path); proto->set_conf_source(data->conf_source); proto->set_command(data->command); - proto->set_duration(data->duration); proto->set_non_clear_duration(data->non_clear_duration); - - proto->set_status(aclk_alarm_status_to_proto(data->status)); proto->set_old_status(aclk_alarm_status_to_proto(data->old_status)); proto->set_delay(data->delay); proto->set_delay_up_to_timestamp(data->delay_up_to_timestamp); - proto->set_last_repeat(data->last_repeat); proto->set_silenced(data->silenced); @@ -136,6 +117,7 @@ static void fill_alarm_log_entry(struct alarm_log_entry *data, AlarmLogEntry *pr proto->set_event_id(data->event_id); proto->set_transition_id(data->transition_id); proto->set_chart_name(data->chart_name); + proto->set_summary(data->summary); } char *generate_alarm_log_entry(size_t *len, struct alarm_log_entry *data) diff --git a/aclk/schema-wrappers/alarm_stream.h b/aclk/schema-wrappers/alarm_stream.h index 87893e0db..3c81ff445 100644 --- a/aclk/schema-wrappers/alarm_stream.h +++ b/aclk/schema-wrappers/alarm_stream.h @@ -76,7 +76,8 @@ struct alarm_log_entry { char *chart_name; uint64_t event_id; - char *transition_id; + char *transition_id; + char *summary; }; struct send_alarm_checkpoint { diff --git a/aclk/schema-wrappers/node_info.h b/aclk/schema-wrappers/node_info.h index de4ade78a..4f57601df 100644 --- a/aclk/schema-wrappers/node_info.h +++ b/aclk/schema-wrappers/node_info.h @@ -39,7 +39,7 @@ struct aclk_node_info { const char *custom_info; const char *machine_guid; - DICTIONARY *host_labels_ptr; + RRDLABELS *host_labels_ptr; struct machine_learning_info ml_info; }; diff --git a/aclk/schema-wrappers/schema_wrapper_utils.cc b/aclk/schema-wrappers/schema_wrapper_utils.cc index 6573e6299..96a4b9bf1 100644 --- a/aclk/schema-wrappers/schema_wrapper_utils.cc +++ b/aclk/schema-wrappers/schema_wrapper_utils.cc @@ -14,8 +14,8 @@ void set_timeval_from_google_timestamp(const google::protobuf::Timestamp &ts, st tv->tv_usec = ts.nanos()/1000; } -int label_add_to_map_callback(const char *name, const char *value, RRDLABEL_SRC ls, void *data) { - (void)ls; +int label_add_to_map_callback(const char *name, const char *value, RRDLABEL_SRC ls __maybe_unused, void *data) +{ auto map = (google::protobuf::Map<std::string, std::string> *)data; map->insert({name, value}); return 1; |