Module: check_mk
Branch: master
Commit: 42dc2f20cc3c8db186178b1ab40aa3ad807359e9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=42dc2f20cc3c8d…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed Nov 2 13:21:03 2016 +0100
Fetched Livestatus from downstream.
---
livestatus/src/DynamicEventConsoleReplicationColumn.cc | 11 +++++++----
livestatus/src/EventConsoleConnection.cc | 2 +-
livestatus/src/EventConsoleConnection.h | 3 +--
livestatus/src/MonitoringCore.h | 1 +
livestatus/src/TableEventConsole.cc | 7 +++++--
livestatus/src/module.cc | 3 +++
6 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/livestatus/src/DynamicEventConsoleReplicationColumn.cc
b/livestatus/src/DynamicEventConsoleReplicationColumn.cc
index ca1f35e..95e0df3 100644
--- a/livestatus/src/DynamicEventConsoleReplicationColumn.cc
+++ b/livestatus/src/DynamicEventConsoleReplicationColumn.cc
@@ -79,8 +79,11 @@
DynamicEventConsoleReplicationColumn::DynamicEventConsoleReplicationColumn(
Column *DynamicEventConsoleReplicationColumn::createColumn(
const std::string &name, const std::string &arguments) {
- ECTableConnection ec(_core, "REPLICATE " + arguments);
- ec.run();
- return new ReplicationColumn(name, "replication value", -1, -1,
- ec.getResult());
+ string result;
+ if (_core->mkeventdEnabled()) {
+ ECTableConnection ec(_core, "REPLICATE " + arguments);
+ ec.run();
+ result = ec.getResult();
+ }
+ return new ReplicationColumn(name, "replication value", -1, -1, result);
}
diff --git a/livestatus/src/EventConsoleConnection.cc
b/livestatus/src/EventConsoleConnection.cc
index 50e47cd..912775b 100644
--- a/livestatus/src/EventConsoleConnection.cc
+++ b/livestatus/src/EventConsoleConnection.cc
@@ -38,7 +38,7 @@ using std::string;
EventConsoleConnection::EventConsoleConnection(Logger *logger, string path)
: _path(move(path)), _socket(-1), _logger(logger, [this](ostream &os) {
- os << "[mkeventd at " << getPath() << "]
";
+ os << "[mkeventd at " << _path << "] ";
}) {}
void EventConsoleConnection::run() {
diff --git a/livestatus/src/EventConsoleConnection.h
b/livestatus/src/EventConsoleConnection.h
index ac63ab4..cb65078 100644
--- a/livestatus/src/EventConsoleConnection.h
+++ b/livestatus/src/EventConsoleConnection.h
@@ -32,8 +32,7 @@
class EventConsoleConnection {
public:
- explicit EventConsoleConnection(Logger *logger, std::string path);
- std::string getPath() const { return _path; }
+ EventConsoleConnection(Logger *logger, std::string path);
void run();
protected:
diff --git a/livestatus/src/MonitoringCore.h b/livestatus/src/MonitoringCore.h
index 83637c4..01a9d7a 100644
--- a/livestatus/src/MonitoringCore.h
+++ b/livestatus/src/MonitoringCore.h
@@ -45,6 +45,7 @@ public:
virtual bool is_contact_member_of_contactgroup(ContactGroup *group,
Contact *contact) = 0;
+ virtual bool mkeventdEnabled() = 0;
virtual std::string mkeventdSocketPath() = 0;
virtual Logger *loggerLivestatus() = 0;
diff --git a/livestatus/src/TableEventConsole.cc b/livestatus/src/TableEventConsole.cc
index 9b3280d..6448282 100644
--- a/livestatus/src/TableEventConsole.cc
+++ b/livestatus/src/TableEventConsole.cc
@@ -102,6 +102,9 @@ TableEventConsole::TableEventConsole(MonitoringCore *core)
: Table(core->loggerLivestatus()), _core(core) {}
void TableEventConsole::answerQuery(Query *query) {
- string internal_name = name().substr(12); // skip "eventconsole" prefix
:-P
- ECTableConnection(_core, internal_name, query).run();
+ if (_core->mkeventdEnabled()) {
+ string internal_name =
+ name().substr(12); // skip "eventconsole" prefix :-P
+ ECTableConnection(_core, internal_name, query).run();
+ }
}
diff --git a/livestatus/src/module.cc b/livestatus/src/module.cc
index a0becd5..e58eece 100644
--- a/livestatus/src/module.cc
+++ b/livestatus/src/module.cc
@@ -597,6 +597,9 @@ public:
toImpl(contact)) != 0;
}
+ // TODO(sp) Do we need a separate NEB argument for this?
+ bool mkeventdEnabled() override { return true; }
+
string mkeventdSocketPath() override { return g_mkeventd_socket_path; }
Logger *loggerLivestatus() override { return fl_logger_livestatus; }