added missing fields to alerts instances (#15442)
Costa Tsaousis committed
Jul 18, 2023 at 18:41 UTC
7c2acb3b244aa93a37a3dcc71d14ee84c343f87b
2 files changed
+13
database/contexts/api_v2.c
+9
@@ -346,6 +346,10 @@ static void alert_instances_v2_insert_callback(const DICTIONARY_ITEM *item __may
346
t->chart_name = rc->rrdset->name;
347
t->family = rc->rrdset->family;
348
t->units = rc->units;
349
+ t->classification = rc->classification;
350
+ t->type = rc->type;
351
+ t->recipient = rc->recipient;
352
+ t->component = rc->component;
353
t->name = rc->name;
354
t->source = rc->source;
355
t->status = rc->status;
@@ -1336,6 +1340,11 @@ static int contexts_v2_alert_instance_to_json_callback(const DICTIONARY_ITEM *it
1340
buffer_json_member_add_uuid(wb, "cfg", &t->config_hash_id);
1341
buffer_json_member_add_string(wb, "src", string2str(t->source));
1342
1343
+ buffer_json_member_add_string(wb, "to", string2str(t->recipient));
1344
+ buffer_json_member_add_string(wb, "tp", string2str(t->type));
1345
+ buffer_json_member_add_string(wb, "cm", string2str(t->component));
1346
+ buffer_json_member_add_string(wb, "cl", string2str(t->classification));
1347
+
1348
// Agent specific fields
1349
buffer_json_member_add_uint64(wb, "gi", t->global_id);
1350
// rrdcalc_flags_to_json_array (wb, "flags", t->flags);
database/contexts/rrdcontext.h
+4
@@ -523,6 +523,10 @@ struct sql_alert_instance_v2_entry {
523
STRING *family;
524
STRING *units;
525
STRING *source;
526
+ STRING *classification;
527
+ STRING *type;
528
+ STRING *component;
529
+ STRING *recipient;
530
RRDCALC_STATUS status;
531
RRDCALC_FLAGS flags;
532
STRING *info;