add hostname to mirrored hosts (#13030)
Costa Tsaousis committed
May 28, 2022 at 16:39 UTC
acec17a9ee7b3fc6d27f6c9bbcd3785ffb4d8f2a
1 file changed
+10
-6
web/api/web_api_v1.c
+10
-6
@@ -915,23 +915,27 @@ static inline void web_client_api_request_v1_info_mirrored_hosts(BUFFER *wb) {
915
916
netdata_mutex_lock(&host->receiver_lock);
917
buffer_sprintf(
918
- wb, "\t\t{ \"guid\": \"%s\", \"reachable\": %s, \"hops\": %d, \"claim_id\": ", host->machine_guid,
919
- (host->receiver || host == localhost) ? "true" : "false", host->system_info ? host->system_info->hops : (host == localhost) ? 0 : 1);
918
+ wb, "\t\t{ \"guid\": \"%s\", \"hostname\": \"%s\", \"reachable\": %s, \"hops\": %d"
919
+ , host->machine_guid
920
+ , host->hostname
921
+ , (host->receiver || host == localhost) ? "true" : "false"
922
+ , host->system_info ? host->system_info->hops : (host == localhost) ? 0 : 1
923
+ );
924
netdata_mutex_unlock(&host->receiver_lock);
925
926
rrdhost_aclk_state_lock(host);
927
if (host->aclk_state.claimed_id)
924
- buffer_sprintf(wb, "\"%s\", ", host->aclk_state.claimed_id);
928
+ buffer_sprintf(wb, ", \"claim_id\": \"%s\"", host->aclk_state.claimed_id);
929
else
926
- buffer_strcat(wb, "null, ");
930
+ buffer_strcat(wb, ", \"claim_id\": null");
931
rrdhost_aclk_state_unlock(host);
932
933
if (host->node_id) {
934
char node_id_str[GUID_LEN + 1];
935
uuid_unparse_lower(*host->node_id, node_id_str);
932
- buffer_sprintf(wb, "\"node_id\": \"%s\" }", node_id_str);
936
+ buffer_sprintf(wb, ", \"node_id\": \"%s\" }", node_id_str);
937
} else
934
- buffer_strcat(wb, "\"node_id\": null }");
938
+ buffer_strcat(wb, ", \"node_id\": null }");
939
940
count++;
941
}