summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--Makefile.am4
-rw-r--r--aclk/aclk_capas.c36
-rw-r--r--database/contexts/api_v2.c30
4 files changed, 38 insertions, 36 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 19c4c7c047..2d472c6c2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -886,6 +886,8 @@ set(ACLK_ALWAYS_BUILD
aclk/aclk_proxy.h
aclk/aclk.c
aclk/aclk.h
+ aclk/aclk_capas.c
+ aclk/aclk_capas.h
)
set(ACLK_FILES
@@ -909,8 +911,6 @@ set(ACLK_FILES
aclk/aclk_alarm_api.h
aclk/aclk_contexts_api.c
aclk/aclk_contexts_api.h
- aclk/aclk_capas.c
- aclk/aclk_capas.h
aclk/schema-wrappers/connection.cc
aclk/schema-wrappers/connection.h
aclk/schema-wrappers/node_connection.cc
diff --git a/Makefile.am b/Makefile.am
index 05efd16983..9b38168871 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -696,8 +696,6 @@ ACLK_FILES = \
aclk/aclk_alarm_api.h \
aclk/aclk_contexts_api.c \
aclk/aclk_contexts_api.h \
- aclk/aclk_capas.c \
- aclk/aclk_capas.h \
aclk/helpers/mqtt_wss_pal.h \
aclk/helpers/ringbuffer_pal.h \
aclk/schema-wrappers/connection.cc \
@@ -843,6 +841,8 @@ ACLK_ALWAYS_BUILD_FILES = \
aclk/aclk_proxy.h \
aclk/aclk.c \
aclk/aclk.h \
+ aclk/aclk_capas.c \
+ aclk/aclk_capas.h \
$(NULL)
SPAWN_PLUGIN_FILES = \
diff --git a/aclk/aclk_capas.c b/aclk/aclk_capas.c
index 290e7d8f4d..e25088e231 100644
--- a/aclk/aclk_capas.c
+++ b/aclk/aclk_capas.c
@@ -7,13 +7,14 @@
const struct capability *aclk_get_agent_capas()
{
static struct capability agent_capabilities[] = {
- { .name = "json", .version = 2, .enabled = 0 },
- { .name = "proto", .version = 1, .enabled = 1 },
- { .name = "ml", .version = 0, .enabled = 0 },
- { .name = "mc", .version = 0, .enabled = 0 },
- { .name = "ctx", .version = 1, .enabled = 1 },
- { .name = "funcs", .version = 1, .enabled = 1 },
- { .name = NULL, .version = 0, .enabled = 0 }
+ { .name = "json", .version = 2, .enabled = 0 },
+ { .name = "proto", .version = 1, .enabled = 1 },
+ { .name = "ml", .version = 0, .enabled = 0 },
+ { .name = "mc", .version = 0, .enabled = 0 },
+ { .name = "ctx", .version = 1, .enabled = 1 },
+ { .name = "funcs", .version = 1, .enabled = 1 },
+ { .name = "http_api_v2", .version = 1, .enabled = 1 },
+ { .name = NULL, .version = 0, .enabled = 0 }
};
agent_capabilities[2].version = ml_capable() ? 1 : 0;
agent_capabilities[2].enabled = ml_enabled(localhost);
@@ -27,21 +28,24 @@ const struct capability *aclk_get_agent_capas()
struct capability *aclk_get_node_instance_capas(RRDHOST *host)
{
struct capability ni_caps[] = {
- { .name = "proto", .version = 1, .enabled = 1 },
- { .name = "ml", .version = ml_capable(), .enabled = ml_enabled(host) },
+ { .name = "proto", .version = 1, .enabled = 1 },
+ { .name = "ml", .version = ml_capable(), .enabled = ml_enabled(host) },
{ .name = "mc",
.version = enable_metric_correlations ? metric_correlations_version : 0,
.enabled = enable_metric_correlations },
- { .name = "ctx", .version = 1, .enabled = 1 },
- { .name = "funcs", .version = 0, .enabled = 0 },
- { .name = NULL, .version = 0, .enabled = 0 }
+ { .name = "ctx", .version = 1, .enabled = 1 },
+ { .name = "funcs", .version = 0, .enabled = 0 },
+ { .name = "http_api_v2", .version = 1, .enabled = 1 },
+ { .name = NULL, .version = 0, .enabled = 0 }
};
- if (host == localhost || (host->receiver && stream_has_capability(host->receiver, STREAM_CAP_FUNCTIONS))) {
- ni_caps[4].version = 1;
- ni_caps[4].enabled = 1;
- }
struct capability *ret = mallocz(sizeof(ni_caps));
memcpy(ret, ni_caps, sizeof(ni_caps));
+
+ if (host == localhost || (host->receiver && stream_has_capability(host->receiver, STREAM_CAP_FUNCTIONS))) {
+ ret[4].version = 1;
+ ret[4].enabled = 1;
+ }
+
return ret;
}
diff --git a/database/contexts/api_v2.c b/database/contexts/api_v2.c
index 5808018df4..6d5d104994 100644
--- a/database/contexts/api_v2.c
+++ b/database/contexts/api_v2.c
@@ -2,6 +2,7 @@
#include "internal.h"
+#include "aclk/aclk_capas.h"
// ----------------------------------------------------------------------------
// /api/v2/contexts API
@@ -306,23 +307,20 @@ static ssize_t rrdcontext_to_json_v2_add_host(void *data, RRDHOST *host, bool qu
buffer_json_member_add_array(wb, "services");
buffer_json_array_close(wb);
- buffer_json_member_add_array(wb, "capabilities");
- buffer_json_add_array_item_object(wb);
- buffer_json_member_add_string(wb, "name", "funcs");
- buffer_json_member_add_uint64(wb, "version", 1);
- buffer_json_member_add_boolean(wb, "enabled", true);
- buffer_json_object_close(wb);
- buffer_json_add_array_item_object(wb);
- buffer_json_member_add_string(wb, "name", "mc");
- buffer_json_member_add_uint64(wb, "version", 1);
- buffer_json_member_add_boolean(wb, "enabled", true);
- buffer_json_object_close(wb);
- buffer_json_add_array_item_object(wb);
- buffer_json_member_add_string(wb, "name", "ml");
- buffer_json_member_add_uint64(wb, "version", 1);
- buffer_json_member_add_boolean(wb, "enabled", true);
- buffer_json_object_close(wb);
+ buffer_json_member_add_array(wb, "nodeInstanceCapabilities");
+
+ struct capability *capas = aclk_get_node_instance_capas(host);
+ struct capability *capa = capas;
+ while(capa->name != NULL) {
+ buffer_json_add_array_item_object(wb);
+ buffer_json_member_add_string(wb, "name", capa->name);
+ buffer_json_member_add_uint64(wb, "version", capa->version);
+ buffer_json_member_add_boolean(wb, "enabled", capa->enabled);
+ buffer_json_object_close(wb);
+ capa++;
+ }
buffer_json_array_close(wb);
+ freez(capas);
web_client_api_request_v1_info_summary_alarm_statuses(host, wb, "alarmCounters");