summaryrefslogtreecommitdiffstats
path: root/aclk/aclk_alarm_api.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 02:57:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 02:57:58 +0000
commitbe1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 (patch)
tree9754ff1ca740f6346cf8483ec915d4054bc5da2d /aclk/aclk_alarm_api.c
parentInitial commit. (diff)
downloadnetdata-upstream.tar.xz
netdata-upstream.zip
Adding upstream version 1.44.3.upstream/1.44.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'aclk/aclk_alarm_api.c')
-rw-r--r--aclk/aclk_alarm_api.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/aclk/aclk_alarm_api.c b/aclk/aclk_alarm_api.c
new file mode 100644
index 00000000..664671f7
--- /dev/null
+++ b/aclk/aclk_alarm_api.c
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "aclk_alarm_api.h"
+
+#include "aclk_query_queue.h"
+
+#include "aclk_util.h"
+
+#include "aclk.h"
+
+void aclk_send_provide_alarm_checkpoint(struct alarm_checkpoint *checkpoint)
+{
+ aclk_query_t query = aclk_query_new(ALARM_PROVIDE_CHECKPOINT);
+ query->data.bin_payload.payload = generate_alarm_checkpoint(&query->data.bin_payload.size, checkpoint);
+ query->data.bin_payload.topic = ACLK_TOPICID_ALARM_CHECKPOINT;
+ query->data.bin_payload.msg_name = "AlarmCheckpoint";
+ QUEUE_IF_PAYLOAD_PRESENT(query);
+}
+
+void aclk_send_alarm_log_entry(struct alarm_log_entry *log_entry)
+{
+ size_t payload_size;
+ char *payload = generate_alarm_log_entry(&payload_size, log_entry);
+
+ aclk_send_bin_msg(payload, payload_size, ACLK_TOPICID_ALARM_LOG, "AlarmLogEntry");
+}
+
+void aclk_send_provide_alarm_cfg(struct provide_alarm_configuration *cfg)
+{
+ aclk_query_t query = aclk_query_new(ALARM_PROVIDE_CFG);
+ query->data.bin_payload.payload = generate_provide_alarm_configuration(&query->data.bin_payload.size, cfg);
+ query->data.bin_payload.topic = ACLK_TOPICID_ALARM_CONFIG;
+ query->data.bin_payload.msg_name = "ProvideAlarmConfiguration";
+ QUEUE_IF_PAYLOAD_PRESENT(query);
+}
+
+void aclk_send_alarm_snapshot(alarm_snapshot_proto_ptr_t snapshot)
+{
+ aclk_query_t query = aclk_query_new(ALARM_SNAPSHOT);
+ query->data.bin_payload.payload = generate_alarm_snapshot_bin(&query->data.bin_payload.size, snapshot);
+ query->data.bin_payload.topic = ACLK_TOPICID_ALARM_SNAPSHOT;
+ query->data.bin_payload.msg_name = "AlarmSnapshot";
+ QUEUE_IF_PAYLOAD_PRESENT(query);
+}