Module: check_mk
Branch: master
Commit: dffe883b7c20b80eb38f72cc53df032aca4ff80a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dffe883b7c20b8…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Oct 9 12:34:28 2017 +0200
Query EC only for non-host columns.
Change-Id: I2c00da81a36c26289849c9b17726f3205be571a0
---
livestatus/src/TableEventConsole.cc | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/livestatus/src/TableEventConsole.cc b/livestatus/src/TableEventConsole.cc
index ac441a5..9f126c4 100644
--- a/livestatus/src/TableEventConsole.cc
+++ b/livestatus/src/TableEventConsole.cc
@@ -33,15 +33,10 @@
#include "Logger.h"
#include "Query.h"
-using std::ostream;
-using std::static_pointer_cast;
-using std::string;
-using std::vector;
-
namespace {
class ECTableConnection : public EventConsoleConnection {
public:
- ECTableConnection(MonitoringCore *mc, string table_name, Query *query)
+ ECTableConnection(MonitoringCore *mc, std::string table_name, Query *query)
: EventConsoleConnection(mc->loggerLivestatus(),
mc->mkeventdSocketPath())
, _mc(mc)
@@ -54,21 +49,23 @@ private:
os << std::nounitbuf << "GET " << _table_name
<< "\nOutputFormat: plain\nColumns:";
for (const auto &c : _query->allColumns()) {
- os << " " << c->name();
+ if (!mk::starts_with(c->name(), "host_")) {
+ os << " " << c->name();
+ }
}
os << std::endl;
}
void receiveReply(std::istream &is) override {
bool is_header = true;
- vector<string> headers;
+ std::vector<std::string> headers;
do {
- string line;
+ std::string line;
std::getline(is, line);
if (!is || line.empty()) {
return;
}
- vector<string> columns = mk::split(line, '\t');
+ std::vector<std::string> columns = mk::split(line, '\t');
if (is_header) {
headers = std::move(columns);
is_header = false;
@@ -115,7 +112,7 @@ bool TableEventConsole::isAuthorizedForEvent(Row row,
auto r = rowData<ECRow>(row);
// NOTE: Further filtering in the GUI for mkeventd.seeunrelated permission
bool result = true;
- auto precedence = static_pointer_cast<StringEventConsoleColumn>(
+ auto precedence = std::static_pointer_cast<StringEventConsoleColumn>(
column("event_contact_groups_precedence"))
->getValue(row);
if (precedence == "rule") {
@@ -134,7 +131,7 @@ bool TableEventConsole::isAuthorizedForEvent(Row row,
bool TableEventConsole::isAuthorizedForEventViaContactGroups(
const MonitoringCore::Contact *ctc, const ECRow *row, bool &result) const {
- auto col = static_pointer_cast<ListEventConsoleColumn>(
+ auto col = std::static_pointer_cast<ListEventConsoleColumn>(
column("event_contact_groups"));
if (col->isNone(row)) {
return false;