summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorEmmanuel Vasilakis <mrzammler@mm.st>2023-10-16 17:09:41 +0300
committerGitHub <noreply@github.com>2023-10-16 17:09:41 +0300
commitbdf83311c317b32d72eaa4b59ab77e5d9fe8b37c (patch)
tree41c64565a323e83195af3d64c35c1f0cb27b2c9a /database
parent145aad2703ff6de8363b6b38774dfa7337bb8bfb (diff)
Add summary to /alerts (#16213)
Diffstat (limited to 'database')
-rw-r--r--database/contexts/api_v2.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/database/contexts/api_v2.c b/database/contexts/api_v2.c
index 5d2eb68d2c..d0b27a2aa4 100644
--- a/database/contexts/api_v2.c
+++ b/database/contexts/api_v2.c
@@ -184,6 +184,7 @@ struct alert_v2_entry {
RRDCALC *tmp;
STRING *name;
+ STRING *summary;
size_t ati;
@@ -315,6 +316,7 @@ static void alerts_v2_insert_callback(const DICTIONARY_ITEM *item __maybe_unused
struct alert_v2_entry *t = value;
RRDCALC *rc = t->tmp;
t->name = rc->name;
+ t->summary = rc->summary;
t->ati = ctl->alerts.ati++;
t->nodes = dictionary_create(DICT_OPTION_SINGLE_THREADED|DICT_OPTION_VALUE_LINK_DONT_CLONE|DICT_OPTION_NAME_LINK_DONT_CLONE);
@@ -1400,6 +1402,7 @@ static void contexts_v2_alerts_to_json(BUFFER *wb, struct rrdcontext_to_json_v2_
{
buffer_json_member_add_uint64(wb, "ati", t->ati);
buffer_json_member_add_string(wb, "nm", string2str(t->name));
+ buffer_json_member_add_string(wb, "sum", string2str(t->summary));
buffer_json_member_add_uint64(wb, "cr", t->critical);
buffer_json_member_add_uint64(wb, "wr", t->warning);