diff --git a/src/collectors/systemd-journal.plugin/systemd-journal.c b/src/collectors/systemd-journal.plugin/systemd-journal.c index 8d8055a8ff9382..9666e010958782 100644 --- a/src/collectors/systemd-journal.plugin/systemd-journal.c +++ b/src/collectors/systemd-journal.plugin/systemd-journal.c @@ -753,7 +753,7 @@ static int netdata_systemd_journal_query(BUFFER *wb, LOGS_QUERY_STATUS *lqs) { for(size_t f = 0; f < files_used ;f++) dictionary_acquired_item_release(journal_files_registry, file_items[f]); - return rrd_call_function_error(wb, "not modified", HTTP_RESP_NOT_MODIFIED); + return rrd_call_function_error(wb, "No new data since the previous call.", HTTP_RESP_NOT_MODIFIED); } // sort the files, so that they are optimal for facets @@ -911,7 +911,7 @@ static int netdata_systemd_journal_query(BUFFER *wb, LOGS_QUERY_STATUS *lqs) { switch (status) { case ND_SD_JOURNAL_OK: if(lqs->rq.if_modified_since && !lqs->c.rows_useful) - return rrd_call_function_error(wb, "no useful logs, not modified", HTTP_RESP_NOT_MODIFIED); + return rrd_call_function_error(wb, "No additional useful data since the previous call.", HTTP_RESP_NOT_MODIFIED); break; case ND_SD_JOURNAL_TIMED_OUT: @@ -919,19 +919,19 @@ static int netdata_systemd_journal_query(BUFFER *wb, LOGS_QUERY_STATUS *lqs) { break; case ND_SD_JOURNAL_CANCELLED: - return rrd_call_function_error(wb, "client closed connection", HTTP_RESP_CLIENT_CLOSED_REQUEST); + return rrd_call_function_error(wb, "Request cancelled.", HTTP_RESP_CLIENT_CLOSED_REQUEST); case ND_SD_JOURNAL_NOT_MODIFIED: - return rrd_call_function_error(wb, "not modified", HTTP_RESP_NOT_MODIFIED); + return rrd_call_function_error(wb, "No new data since the previous call.", HTTP_RESP_NOT_MODIFIED); case ND_SD_JOURNAL_FAILED_TO_OPEN: - return rrd_call_function_error(wb, "failed to open journal", HTTP_RESP_INTERNAL_SERVER_ERROR); + return rrd_call_function_error(wb, "Failed to open systemd journal file.", HTTP_RESP_INTERNAL_SERVER_ERROR); case ND_SD_JOURNAL_FAILED_TO_SEEK: - return rrd_call_function_error(wb, "failed to seek in journal", HTTP_RESP_INTERNAL_SERVER_ERROR); + return rrd_call_function_error(wb, "Failed to seek in systemd journal file.", HTTP_RESP_INTERNAL_SERVER_ERROR); default: - return rrd_call_function_error(wb, "unknown status", HTTP_RESP_INTERNAL_SERVER_ERROR); + return rrd_call_function_error(wb, "Unknown status", HTTP_RESP_INTERNAL_SERVER_ERROR); } buffer_json_member_add_uint64(wb, "status", HTTP_RESP_OK); diff --git a/src/daemon/config/dyncfg-tree.c b/src/daemon/config/dyncfg-tree.c index 0254d7d0b2c8ef..749b710115f275 100644 --- a/src/daemon/config/dyncfg-tree.c +++ b/src/daemon/config/dyncfg-tree.c @@ -264,7 +264,7 @@ static int dyncfg_config_execute_cb(struct rrd_function_execute *rfe, void *data rrd_call_function_error( rfe->result.wb, - "unknown config id given", code); + "Unknown config id given.", code); } cleanup: diff --git a/src/database/rrdfunctions-exporters.c b/src/database/rrdfunctions-exporters.c index 205d48bf3dbd4f..e5fe64683983d6 100644 --- a/src/database/rrdfunctions-exporters.c +++ b/src/database/rrdfunctions-exporters.c @@ -60,7 +60,7 @@ static void functions2json(DICTIONARY *functions, BUFFER *wb) { struct rrd_host_function *t; dfe_start_read(functions, t) { if (!rrd_collector_running(t->collector)) continue; - if(t->options & (RRD_FUNCTION_DYNCFG|RRD_FUNCTION_HIDDEN)) continue; + if(t->options & (RRD_FUNCTION_DYNCFG| RRD_FUNCTION_RESTRICTED)) continue; buffer_json_member_add_object(wb, t_dfe.name); { @@ -99,7 +99,7 @@ void host_functions2json(RRDHOST *host, BUFFER *wb) { struct rrd_host_function *t; dfe_start_read(host->functions, t) { if(!rrd_collector_running(t->collector)) continue; - if(t->options & (RRD_FUNCTION_DYNCFG|RRD_FUNCTION_HIDDEN)) continue; + if(t->options & (RRD_FUNCTION_DYNCFG| RRD_FUNCTION_RESTRICTED)) continue; buffer_json_member_add_object(wb, t_dfe.name); { @@ -130,7 +130,7 @@ void chart_functions_to_dict(DICTIONARY *rrdset_functions_view, DICTIONARY *dst, struct rrd_host_function *t; dfe_start_read(rrdset_functions_view, t) { if(!rrd_collector_running(t->collector)) continue; - if(t->options & (RRD_FUNCTION_DYNCFG|RRD_FUNCTION_HIDDEN)) continue; + if(t->options & (RRD_FUNCTION_DYNCFG| RRD_FUNCTION_RESTRICTED)) continue; dictionary_set(dst, t_dfe.name, value, value_size); } @@ -144,7 +144,7 @@ void host_functions_to_dict(RRDHOST *host, DICTIONARY *dst, void *value, size_t struct rrd_host_function *t; dfe_start_read(host->functions, t) { if(!rrd_collector_running(t->collector)) continue; - if(t->options & (RRD_FUNCTION_DYNCFG|RRD_FUNCTION_HIDDEN)) continue; + if(t->options & (RRD_FUNCTION_DYNCFG| RRD_FUNCTION_RESTRICTED)) continue; if(help) *help = t->help; diff --git a/src/database/rrdfunctions-inflight.c b/src/database/rrdfunctions-inflight.c index ac292443274855..811bec87ff3418 100644 --- a/src/database/rrdfunctions-inflight.c +++ b/src/database/rrdfunctions-inflight.c @@ -351,7 +351,7 @@ static int rrd_call_function_async_and_wait(struct rrd_function_inflight *r) { HTTP_RESP_CLIENT_CLOSED_REQUEST); else code = rrd_call_function_error(r->result.wb, - "Timeout while waiting for a response from the collector.", + "Timeout while waiting for a response from the plugin that serves this features", HTTP_RESP_GATEWAY_TIMEOUT); tmp->free_with_signal = true; @@ -359,7 +359,7 @@ static int rrd_call_function_async_and_wait(struct rrd_function_inflight *r) { } else { code = rrd_call_function_error( - r->result.wb, "Internal error while communicating with the collector", + r->result.wb, "Internal error while communicating with the plugin that serves this feature.", HTTP_RESP_INTERNAL_SERVER_ERROR); tmp->free_with_signal = true; @@ -398,7 +398,7 @@ int rrd_function_run(RRDHOST *host, BUFFER *result_wb, int timeout_s, rrd_function_result_callback_t result_cb, void *result_cb_data, rrd_function_progress_cb_t progress_cb, void *progress_cb_data, rrd_function_is_cancelled_cb_t is_cancelled_cb, void *is_cancelled_cb_data, - BUFFER *payload, const char *source, bool hidden) { + BUFFER *payload, const char *source, bool allow_restricted) { int code; char sanitized_cmd[PLUGINSD_LINE_MAX + 1]; @@ -412,7 +412,7 @@ int rrd_function_run(RRDHOST *host, BUFFER *result_wb, int timeout_s, if(!host) { code = HTTP_RESP_INTERNAL_SERVER_ERROR; - rrd_call_function_error(result_wb, "no host given for running the function", code); + rrd_call_function_error(result_wb, "No host given for routing this request to.", code); if(result_cb) result_cb(result_wb, code, result_cb_data); @@ -436,9 +436,9 @@ int rrd_function_run(RRDHOST *host, BUFFER *result_wb, int timeout_s, struct rrd_host_function *rdcf = dictionary_acquired_item_value(host_function_acquired); - if((rdcf->options & RRD_FUNCTION_HIDDEN) && !hidden) { + if((rdcf->options & RRD_FUNCTION_RESTRICTED) && !allow_restricted) { code = rrd_call_function_error(result_wb, - "You cannot access a hidden function like this. ", + "This feature is not available via this API.", HTTP_ACCESS_PERMISSION_DENIED_HTTP_CODE(user_access)); dictionary_acquired_item_release(host->functions, host_function_acquired); @@ -546,7 +546,7 @@ int rrd_function_run(RRDHOST *host, BUFFER *result_wb, int timeout_s, "FUNCTIONS: duplicate transaction '%s', function: '%s'", t.transaction, t.cmd); - code = rrd_call_function_error(result_wb, "duplicate transaction", HTTP_RESP_BAD_REQUEST); + code = rrd_call_function_error(result_wb, "Duplicate transaction.", HTTP_RESP_BAD_REQUEST); rrd_functions_inflight_cleanup(&t); dictionary_acquired_item_release(r->host->functions, t.host_function_acquired); diff --git a/src/database/rrdfunctions-internals.h b/src/database/rrdfunctions-internals.h index 08e1a089845426..134e3559e9a243 100644 --- a/src/database/rrdfunctions-internals.h +++ b/src/database/rrdfunctions-internals.h @@ -11,7 +11,7 @@ typedef enum __attribute__((packed)) { RRD_FUNCTION_LOCAL = (1 << 0), RRD_FUNCTION_GLOBAL = (1 << 1), RRD_FUNCTION_DYNCFG = (1 << 2), - RRD_FUNCTION_HIDDEN = (1 << 3), + RRD_FUNCTION_RESTRICTED = (1 << 3), // this function is restricted (hidden from user) // this is 8-bit } RRD_FUNCTION_OPTIONS; diff --git a/src/database/rrdfunctions.c b/src/database/rrdfunctions.c index 4f108a6aa67a03..a242e2f4a83908 100644 --- a/src/database/rrdfunctions.c +++ b/src/database/rrdfunctions.c @@ -161,7 +161,7 @@ void rrd_functions_host_destroy(RRDHOST *host) { // ---------------------------------------------------------------------------- -static inline bool is_function_hidden(const char *name, const char *tags) { +static inline bool is_function_restricted(const char *name, const char *tags) { return (name && name[0] == '_' && name[1] == '_') || (tags && strstr(tags, RRDFUNCTIONS_TAG_HIDDEN) != NULL); } @@ -185,7 +185,7 @@ static inline RRD_FUNCTION_OPTIONS get_function_options(RRDSET *st, const char * RRD_FUNCTION_OPTIONS options = st ? RRD_FUNCTION_LOCAL : RRD_FUNCTION_GLOBAL; - return options | (is_function_hidden(name, tags) ? RRD_FUNCTION_HIDDEN : 0); + return options | (is_function_restricted(name, tags) ? RRD_FUNCTION_RESTRICTED : 0); } void rrd_function_add(RRDHOST *host, RRDSET *st, const char *name, int timeout, int priority, @@ -283,11 +283,11 @@ int rrd_functions_find_by_name(RRDHOST *host, BUFFER *wb, const char *name, size if(!(*item)) { if(found) return rrd_call_function_error(wb, - "The collector that registered this function, is not currently running.", + "The plugin that registered this feature, is not currently running.", HTTP_RESP_SERVICE_UNAVAILABLE); else return rrd_call_function_error(wb, - "No collector is supplying this function on this host at this time.", + "This feature is not available on this host at this time.", HTTP_RESP_NOT_FOUND); } diff --git a/src/database/rrdfunctions.h b/src/database/rrdfunctions.h index 1c28d73cc24673..ed6f5dde36ced2 100644 --- a/src/database/rrdfunctions.h +++ b/src/database/rrdfunctions.h @@ -80,7 +80,7 @@ int rrd_function_run(RRDHOST *host, BUFFER *result_wb, int timeout_s, rrd_function_result_callback_t result_cb, void *result_cb_data, rrd_function_progress_cb_t progress_cb, void *progress_cb_data, rrd_function_is_cancelled_cb_t is_cancelled_cb, void *is_cancelled_cb_data, - BUFFER *payload, const char *source, bool hidden); + BUFFER *payload, const char *source, bool allow_restricted); bool rrd_function_available(RRDHOST *host, const char *function); diff --git a/src/libnetdata/json/json-c-parser-inline.c b/src/libnetdata/json/json-c-parser-inline.c index d46cb5d4bb2218..a17847a3ef94a5 100644 --- a/src/libnetdata/json/json-c-parser-inline.c +++ b/src/libnetdata/json/json-c-parser-inline.c @@ -16,13 +16,13 @@ int rrd_call_function_error(BUFFER *wb, const char *msg, int code) { struct json_object *json_parse_function_payload_or_error(BUFFER *output, BUFFER *payload, int *code, json_parse_function_payload_t cb, void *cb_data) { if(!payload || !buffer_strlen(payload)) { - *code = rrd_call_function_error(output, "No payload given", HTTP_RESP_BAD_REQUEST); + *code = rrd_call_function_error(output, "No payload given, but a payload is required for this feature.", HTTP_RESP_BAD_REQUEST); return NULL; } struct json_tokener *tokener = json_tokener_new(); if (!tokener) { - *code = rrd_call_function_error(output, "Cannot initialize json parser", HTTP_RESP_INTERNAL_SERVER_ERROR); + *code = rrd_call_function_error(output, "Failed to initialize json parser.", HTTP_RESP_INTERNAL_SERVER_ERROR); return NULL; } diff --git a/src/plugins.d/pluginsd_functions.c b/src/plugins.d/pluginsd_functions.c index 4ea6d4812ea421..99622a6ca424c4 100644 --- a/src/plugins.d/pluginsd_functions.c +++ b/src/plugins.d/pluginsd_functions.c @@ -59,7 +59,7 @@ static void inflight_functions_insert_callback(const DICTIONARY_ITEM *item, void pf->code = HTTP_RESP_SERVICE_UNAVAILABLE; netdata_log_error("FUNCTION '%s': failed to send it to the plugin, error %zd", string2str(pf->function), ret); - rrd_call_function_error(pf->result_body_wb, "Failed to communicate with collector", pf->code); + rrd_call_function_error(pf->result_body_wb, "Failed to send this request to the plugin that offered it.", pf->code); } else { pf->sent_successfully = true; @@ -75,7 +75,7 @@ static bool inflight_functions_conflict_callback(const DICTIONARY_ITEM *item __m struct inflight_function *pf = new_func; netdata_log_error("PLUGINSD_PARSER: duplicate UUID on pending function '%s' detected. Ignoring the second one.", string2str(pf->function)); - pf->code = rrd_call_function_error(pf->result_body_wb, "This request is already in progress", HTTP_RESP_BAD_REQUEST); + pf->code = rrd_call_function_error(pf->result_body_wb, "This transaction is already in progress.", HTTP_RESP_BAD_REQUEST); pf->result.cb(pf->result_body_wb, pf->code, pf->result.data); string_freez(pf->function); @@ -94,7 +94,7 @@ static void inflight_functions_delete_callback(const DICTIONARY_ITEM *item __may pf->sent_monotonic_ut - pf->started_monotonic_ut, now_realtime_usec() - pf->sent_monotonic_ut); if(pf->code == HTTP_RESP_SERVICE_UNAVAILABLE && !buffer_strlen(pf->result_body_wb)) - rrd_call_function_error(pf->result_body_wb, "The plugin exited while servicing this call.", pf->code); + rrd_call_function_error(pf->result_body_wb, "The plugin that was servicing this request, exited before responding.", pf->code); pf->result.cb(pf->result_body_wb, pf->code, pf->result.data); @@ -127,7 +127,7 @@ void pluginsd_inflight_functions_garbage_collect(PARSER *parser, usec_t now_ut) if(!buffer_strlen(pf->result_body_wb) || pf->code == HTTP_RESP_OK) pf->code = rrd_call_function_error(pf->result_body_wb, - "Timeout waiting for collector response.", + "Timeout waiting for a response.", HTTP_RESP_GATEWAY_TIMEOUT); dictionary_del(parser->inflight.functions, pf_dfe.name); diff --git a/src/streaming/sender_execute.c b/src/streaming/sender_execute.c index e6b7ccbb241681..158569cd2b30e6 100644 --- a/src/streaming/sender_execute.c +++ b/src/streaming/sender_execute.c @@ -84,7 +84,7 @@ static void execute_commands_function(struct sender_state *s, const char *comman if(code != HTTP_RESP_OK) { if (!buffer_strlen(wb)) - rrd_call_function_error(wb, "Failed to route request to collector", code); + rrd_call_function_error(wb, "Failed to route this request to the plugin that offered it.", code); } } } diff --git a/src/web/api/functions/function-bearer_get_token.c b/src/web/api/functions/function-bearer_get_token.c index 0ff3013f394e3b..8f14e68aed6860 100644 --- a/src/web/api/functions/function-bearer_get_token.c +++ b/src/web/api/functions/function-bearer_get_token.c @@ -28,7 +28,7 @@ static bool bearer_parse_json_payload(json_object *jobj, const char *path, void int function_bearer_get_token(BUFFER *wb, const char *function __maybe_unused, BUFFER *payload, const char *source) { if(!request_source_is_cloud(source)) return rrd_call_function_error( - wb, "You cannot access this function from outside Netdata Cloud", HTTP_RESP_BAD_REQUEST); + wb, "Bearer tokens can only be provided via NC.", HTTP_RESP_BAD_REQUEST); int code; struct bearer_token_request rq = { 0 }; diff --git a/src/web/api/v1/api_v1_config.c b/src/web/api/v1/api_v1_config.c index 9e71998d980f27..69bcde760d3880 100644 --- a/src/web/api/v1/api_v1_config.c +++ b/src/web/api/v1/api_v1_config.c @@ -46,12 +46,12 @@ int api_v1_config(RRDHOST *host, struct web_client *w, char *url __maybe_unused) else { DYNCFG_CMDS c = dyncfg_cmds2id(action); if(!id || !*id || !dyncfg_is_valid_id(id)) { - rrd_call_function_error(w->response.data, "invalid id given", HTTP_RESP_BAD_REQUEST); + rrd_call_function_error(w->response.data, "Invalid id", HTTP_RESP_BAD_REQUEST); return HTTP_RESP_BAD_REQUEST; } if(c == DYNCFG_CMD_NONE) { - rrd_call_function_error(w->response.data, "invalid action given", HTTP_RESP_BAD_REQUEST); + rrd_call_function_error(w->response.data, "Invalid action", HTTP_RESP_BAD_REQUEST); return HTTP_RESP_BAD_REQUEST; } @@ -68,7 +68,7 @@ int api_v1_config(RRDHOST *host, struct web_client *w, char *url __maybe_unused) } if(!add_name || !*add_name || !dyncfg_is_valid_id(add_name)) { - rrd_call_function_error(w->response.data, "invalid name given", HTTP_RESP_BAD_REQUEST); + rrd_call_function_error(w->response.data, "Invalid name", HTTP_RESP_BAD_REQUEST); return HTTP_RESP_BAD_REQUEST; } snprintfz(cmd, sizeof(cmd), PLUGINSD_FUNCTION_CONFIG " %s %s %s", id, dyncfg_id2cmd_one(c), add_name); diff --git a/src/web/api/v2/api_v2_bearer.c b/src/web/api/v2/api_v2_bearer.c index b195abd404d35d..312ca4e4888f24 100644 --- a/src/web/api/v2/api_v2_bearer.c +++ b/src/web/api/v2/api_v2_bearer.c @@ -71,10 +71,10 @@ int api_v2_bearer_protection(RRDHOST *host __maybe_unused, struct web_client *w int bearer_get_token_json_response(BUFFER *wb, RRDHOST *host, const char *claim_id, const char *machine_guid, const char *node_id, HTTP_USER_ROLE user_role, HTTP_ACCESS access, nd_uuid_t cloud_account_id, const char *client_name) { if(!claim_id_matches_any(claim_id)) - return rrd_call_function_error(wb, "The request is for a different claimed agent", HTTP_RESP_BAD_REQUEST); + return rrd_call_function_error(wb, "The request is for a different agent", HTTP_RESP_BAD_REQUEST); if(!verify_host_uuids(host, machine_guid, node_id)) - return rrd_call_function_error(wb, "The request is missing or not matching local UUIDs", HTTP_RESP_BAD_REQUEST); + return rrd_call_function_error(wb, "The request is missing or not matching local node UUIDs", HTTP_RESP_BAD_REQUEST); nd_uuid_t uuid; time_t expires_s = bearer_create_token(&uuid, user_role, access, cloud_account_id, client_name); diff --git a/src/web/api/v3/api_v3_settings.c b/src/web/api/v3/api_v3_settings.c index 56331ff4909b0c..3b02e6b61c0e2d 100644 --- a/src/web/api/v3/api_v3_settings.c +++ b/src/web/api/v3/api_v3_settings.c @@ -260,7 +260,7 @@ int api_v3_settings(RRDHOST *host, struct web_client *w, char *url) { if(web_client_flags_check_auth(w) != WEB_CLIENT_FLAG_AUTH_BEARER && strcmp(file, "default") != 0) return rrd_call_function_error( w->response.data, - "Only the 'default' settings file is allowed for unauthenticated users", + "Only the 'default' settings file is allowed for anonymous users", HTTP_RESP_BAD_REQUEST); switch(w->mode) {