Module: check_mk
Branch: master
Commit: 4ac28dfaae043a4f15ae422417f15dadf38ba26a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4ac28dfaae043a…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon May 8 14:34:13 2017 +0200
Nuked yet another global variable.
Change-Id: Iaad26b8b4c94313afe2da6cbe4c022715945b0e4
---
livestatus/src/MonitoringCore.h | 1 +
livestatus/src/TableStateHistory.cc | 4 +---
livestatus/src/module.cc | 7 +++++--
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/livestatus/src/MonitoringCore.h b/livestatus/src/MonitoringCore.h
index c950604..dd37922 100644
--- a/livestatus/src/MonitoringCore.h
+++ b/livestatus/src/MonitoringCore.h
@@ -90,6 +90,7 @@ public:
virtual Encoding dataEncoding() = 0;
virtual size_t maxResponseSize() = 0;
virtual size_t maxCachedMessages() = 0;
+ virtual bool stateHistoryFilteringEnabled() = 0;
virtual Logger *loggerLivestatus() = 0;
diff --git a/livestatus/src/TableStateHistory.cc b/livestatus/src/TableStateHistory.cc
index dde51e5..5a9739f 100644
--- a/livestatus/src/TableStateHistory.cc
+++ b/livestatus/src/TableStateHistory.cc
@@ -84,8 +84,6 @@ constexpr unsigned classmask_statehist =
(1u << static_cast<int>(LogEntry::Class::text));
} // namespace
-int g_disable_statehist_filtering = 0;
-
#ifndef CMC
namespace {
string getCustomVariable(customvariablesmember *cvm, const char *name) {
@@ -283,7 +281,7 @@ void TableStateHistory::answerQuery(Query *query) {
// check attributes of current hosts and services
deque<Filter *> object_filter;
- if (g_disable_statehist_filtering == 0) {
+ if (core()->stateHistoryFilteringEnabled()) {
for (const auto &filter : *query->filter()) {
IsObjectFilter is_obj;
filter->accept(is_obj);
diff --git a/livestatus/src/module.cc b/livestatus/src/module.cc
index 63715cc..1b03e2b 100644
--- a/livestatus/src/module.cc
+++ b/livestatus/src/module.cc
@@ -98,7 +98,7 @@ int g_num_queued_connections = 0;
// current number of active connections (for statistics)
int g_livestatus_active_connections = 0;
size_t g_thread_stack_size = 1024 * 1024; /* stack size of threads */
-extern int g_disable_statehist_filtering;
+static int fl_disable_statehist_filtering;
void *g_nagios_handle;
int g_unix_socket = -1;
@@ -655,6 +655,9 @@ public:
Encoding dataEncoding() override { return fl_data_encoding; }
size_t maxResponseSize() override { return fl_max_response_size; }
size_t maxCachedMessages() override { return fl_max_cached_messages; }
+ bool stateHistoryFilteringEnabled() override {
+ return fl_disable_statehist_filtering == 0;
+ }
Logger *loggerLivestatus() override { return fl_logger_livestatus; }
@@ -1031,7 +1034,7 @@ void livestatus_parse_arguments(const char *args_orig) {
Warning(fl_logger_nagios)
<< "livecheck has been removed from Livestatus,
sorry.";
} else if (strcmp(left, "disable_statehist_filtering") == 0) {
- g_disable_statehist_filtering = atoi(right);
+ fl_disable_statehist_filtering = atoi(right);
} else {
Warning(fl_logger_nagios) << "ignoring invalid option "
<< left
<< "=" << right;