summaryrefslogtreecommitdiffstats
path: root/src/registry/registry.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-25 17:33:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-11-25 17:34:10 +0000
commit83ba6762cc43d9db581b979bb5e3445669e46cc2 (patch)
tree2e69833b43f791ed253a7a20318b767ebe56cdb8 /src/registry/registry.c
parentReleasing debian version 1.47.5-1. (diff)
downloadnetdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.tar.xz
netdata-83ba6762cc43d9db581b979bb5e3445669e46cc2.zip
Merging upstream version 2.0.3+dfsg (Closes: #923993, #1042533, #1045145).
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/registry/registry.c')
-rw-r--r--src/registry/registry.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/registry/registry.c b/src/registry/registry.c
index 803115231..be8d6948f 100644
--- a/src/registry/registry.c
+++ b/src/registry/registry.c
@@ -154,8 +154,8 @@ static inline int registry_person_url_callback_verify_machine_exists(REGISTRY_PE
// that could make this safe, so try to be as atomic as possible.
void registry_update_cloud_base_url() {
- registry.cloud_base_url = appconfig_get(&cloud_config, CONFIG_SECTION_GLOBAL, "cloud base url", DEFAULT_CLOUD_BASE_URL);
- setenv("NETDATA_REGISTRY_CLOUD_BASE_URL", registry.cloud_base_url, 1);
+ registry.cloud_base_url = cloud_config_url_get();
+ nd_setenv("NETDATA_REGISTRY_CLOUD_BASE_URL", registry.cloud_base_url, 1);
}
// ----------------------------------------------------------------------------
@@ -164,21 +164,19 @@ void registry_update_cloud_base_url() {
int registry_request_hello_json(RRDHOST *host, struct web_client *w, bool do_not_track) {
registry_json_header(host, w, "hello", REGISTRY_STATUS_OK);
- if(host->node_id)
- buffer_json_member_add_uuid(w->response.data, "node_id", host->node_id);
+ if(!UUIDiszero(host->node_id))
+ buffer_json_member_add_uuid(w->response.data, "node_id", host->node_id.uuid);
buffer_json_member_add_object(w->response.data, "agent");
{
buffer_json_member_add_string(w->response.data, "machine_guid", localhost->machine_guid);
- if(localhost->node_id)
- buffer_json_member_add_uuid(w->response.data, "node_id", localhost->node_id);
+ if(!UUIDiszero(localhost->node_id))
+ buffer_json_member_add_uuid(w->response.data, "node_id", localhost->node_id.uuid);
- char *claim_id = get_agent_claimid();
- if (claim_id) {
- buffer_json_member_add_string(w->response.data, "claim_id", claim_id);
- freez(claim_id);
- }
+ CLAIM_ID claim_id = claim_id_get();
+ if (claim_id_is_set(claim_id))
+ buffer_json_member_add_string(w->response.data, "claim_id", claim_id.str);
buffer_json_member_add_boolean(w->response.data, "bearer_protection", netdata_is_protected_by_bearer);
}
@@ -198,8 +196,8 @@ int registry_request_hello_json(RRDHOST *host, struct web_client *w, bool do_not
buffer_json_add_array_item_object(w->response.data);
buffer_json_member_add_string(w->response.data, "machine_guid", h->machine_guid);
- if(h->node_id)
- buffer_json_member_add_uuid(w->response.data, "node_id", h->node_id);
+ if(!UUIDiszero(h->node_id))
+ buffer_json_member_add_uuid(w->response.data, "node_id", h->node_id.uuid);
buffer_json_member_add_string(w->response.data, "hostname", rrdhost_registry_hostname(h));
buffer_json_object_close(w->response.data);
@@ -519,16 +517,16 @@ void registry_statistics(void) {
rrddim_add(stm, "machines_urls", NULL, 1, 1024, RRD_ALGORITHM_ABSOLUTE);
}
- struct aral_statistics *p_aral_stats = aral_statistics(registry.persons_aral);
+ struct aral_statistics *p_aral_stats = aral_get_statistics(registry.persons_aral);
rrddim_set(stm, "persons", (collected_number)p_aral_stats->structures.allocated_bytes + (collected_number)p_aral_stats->malloc.allocated_bytes + (collected_number)p_aral_stats->mmap.allocated_bytes);
- struct aral_statistics *m_aral_stats = aral_statistics(registry.machines_aral);
+ struct aral_statistics *m_aral_stats = aral_get_statistics(registry.machines_aral);
rrddim_set(stm, "machines", (collected_number)m_aral_stats->structures.allocated_bytes + (collected_number)m_aral_stats->malloc.allocated_bytes + (collected_number)m_aral_stats->mmap.allocated_bytes);
- struct aral_statistics *pu_aral_stats = aral_statistics(registry.person_urls_aral);
+ struct aral_statistics *pu_aral_stats = aral_get_statistics(registry.person_urls_aral);
rrddim_set(stm, "persons_urls", (collected_number)pu_aral_stats->structures.allocated_bytes + (collected_number)pu_aral_stats->malloc.allocated_bytes + (collected_number)pu_aral_stats->mmap.allocated_bytes);
- struct aral_statistics *mu_aral_stats = aral_statistics(registry.machine_urls_aral);
+ struct aral_statistics *mu_aral_stats = aral_get_statistics(registry.machine_urls_aral);
rrddim_set(stm, "machines_urls", (collected_number)mu_aral_stats->structures.allocated_bytes + (collected_number)mu_aral_stats->malloc.allocated_bytes + (collected_number)mu_aral_stats->mmap.allocated_bytes);
rrdset_done(stm);