Module: check_mk
Branch: master
Commit: 1c1f9cbd1850017443e5c177dc5d18752292cbd2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1c1f9cbd185001…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed Aug 29 11:04:05 2018 +0200
CMK-871 Export notification/alert queue lengths via Livestatus
Change-Id: I6ee5cb51e6922894838986432306db6627261bf4
---
livestatus/src/MonitoringCore.h | 3 +++
livestatus/src/StatusSpecialIntColumn.cc | 4 ++++
livestatus/src/StatusSpecialIntColumn.h | 6 +++++-
livestatus/src/module.cc | 3 +++
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/livestatus/src/MonitoringCore.h b/livestatus/src/MonitoringCore.h
index 09f0892..9cc4c45 100644
--- a/livestatus/src/MonitoringCore.h
+++ b/livestatus/src/MonitoringCore.h
@@ -112,6 +112,9 @@ public:
virtual Triggers &triggers() = 0;
+ virtual size_t numQueuedNotifications() = 0;
+ virtual size_t numQueuedAlerts() = 0;
+
// Our escape hatch, this should die in the long run...
template <typename T>
T *impl() const {
diff --git a/livestatus/src/StatusSpecialIntColumn.cc
b/livestatus/src/StatusSpecialIntColumn.cc
index c518d62..fe7d091 100644
--- a/livestatus/src/StatusSpecialIntColumn.cc
+++ b/livestatus/src/StatusSpecialIntColumn.cc
@@ -35,6 +35,10 @@ int32_t StatusSpecialIntColumn::getValue(Row /* row */,
// Check_MK Inventory touches the file ".last" after each
inventory
return static_cast<int32_t>(
mk_inventory_last(_mc->mkInventoryPath() + "/.last"));
+ case Type::num_queued_notifications:
+ return static_cast<int32_t>(_mc->numQueuedNotifications());
+ case Type::num_queued_alerts:
+ return static_cast<int32_t>(_mc->numQueuedAlerts());
}
// never reached, make -Wall happy
return 0;
diff --git a/livestatus/src/StatusSpecialIntColumn.h
b/livestatus/src/StatusSpecialIntColumn.h
index e022b18..c923a97 100644
--- a/livestatus/src/StatusSpecialIntColumn.h
+++ b/livestatus/src/StatusSpecialIntColumn.h
@@ -35,7 +35,11 @@ class Row;
class StatusSpecialIntColumn : public IntColumn {
public:
- enum class Type { mk_inventory_last };
+ enum class Type {
+ mk_inventory_last,
+ num_queued_notifications,
+ num_queued_alerts
+ };
StatusSpecialIntColumn(const std::string& name,
const std::string& description, int indirect_offset,
diff --git a/livestatus/src/module.cc b/livestatus/src/module.cc
index 5995f57..5745f88 100644
--- a/livestatus/src/module.cc
+++ b/livestatus/src/module.cc
@@ -673,6 +673,9 @@ public:
Triggers &triggers() override { return fl_triggers; }
+ size_t numQueuedNotifications() override { return 0; }
+ size_t numQueuedAlerts() override { return 0; }
+
private:
void *implInternal() const override { return fl_store; }