|
@@ -58,7 +58,7 @@ static inline void registry_set_person_cookie(struct web_client *w, REGISTRY_PER
|
|
|
static inline void registry_json_header(RRDHOST *host, struct web_client *w, const char *action, const char *status) {
|
|
|
buffer_flush(w->response.data);
|
|
|
w->response.data->content_type = CT_APPLICATION_JSON;
|
|
|
- buffer_json_initialize(w->response.data, "\"", "\"", 0, true, true);
|
|
|
+ buffer_json_initialize(w->response.data, "\"", "\"", 0, true, false);
|
|
|
buffer_json_member_add_string(w->response.data, "action", action);
|
|
|
buffer_json_member_add_string(w->response.data, "status", status);
|
|
|
buffer_json_member_add_string(w->response.data, "hostname", rrdhost_registry_hostname(host));
|
|
@@ -190,25 +190,18 @@ int registry_request_hello_json(RRDHOST *host, struct web_client *w) {
|
|
|
buffer_json_member_add_boolean(w->response.data, "anonymous_statistics", netdata_anonymous_statistics_enabled);
|
|
|
|
|
|
buffer_json_member_add_array(w->response.data, "nodes");
|
|
|
- {
|
|
|
+ RRDHOST *h;
|
|
|
+ dfe_start_read(rrdhost_root_index, h) {
|
|
|
buffer_json_add_array_item_object(w->response.data);
|
|
|
- buffer_json_member_add_string(w->response.data, "machine_guid", host->machine_guid);
|
|
|
- buffer_json_member_add_string(w->response.data, "hostname", rrdhost_registry_hostname(host));
|
|
|
+ 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);
|
|
|
+
|
|
|
+ buffer_json_member_add_string(w->response.data, "hostname", rrdhost_registry_hostname(h));
|
|
|
+ buffer_json_object_close(w->response.data);
|
|
|
}
|
|
|
- buffer_json_object_close(w->response.data); // nodes
|
|
|
-
|
|
|
-// RRDHOST *h;
|
|
|
-// dfe_start_read(rrdhost_root_index, h) {
|
|
|
-// 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);
|
|
|
-//
|
|
|
-// buffer_json_member_add_string(w->response.data, "hostname", rrdhost_registry_hostname(h));
|
|
|
-// buffer_json_object_close(w->response.data);
|
|
|
-// }
|
|
|
-// dfe_done(h);
|
|
|
+ dfe_done(h);
|
|
|
buffer_json_array_close(w->response.data);
|
|
|
|
|
|
registry_json_footer(w);
|