Module: check_mk
Branch: master
Commit: fd836b6422aa88b6ad5b60fcab3bc66cf5e06fae
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fd836b6422aa88…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Jun 1 17:17:02 2016 +0200
better rule handling
---
web/plugins/wato/check_parameters.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 118c82b..6a43aa3 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -6479,11 +6479,16 @@ register_check_parameters(
default_value = 2,
)),
( "defaultincrement",
- Checkbox(
- title = _("Default Increment"),
- label = _("State is WARNING in case the next extent has the default size."),
- help = "")),
- ]),
+ DropdownChoice(
+ title = _("Default Increment"),
+ choices = [
+ ( True, _("State is WARNING in case the next extent has the default size.")),
+ ( False, _("Ignore default increment")),
+ ]
+ )
+ ),
+ ],
+ ),
TextAscii(
title = _("Explicit tablespaces"),
help = _("Here you can set explicit tablespaces by defining them via SID and the tablespace name, separated by a dot, for example <b>pengt.TEMP</b>"),
Module: check_mk
Branch: master
Commit: 0062ed33e50a248b54abb338709481d7ba753b71
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0062ed33e50a24…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed Jun 1 13:22:00 2016 +0200
Better matching for hosts while joining the EC tables, Livestatus part.
This is basically handled like it is in CMC, but note one detail: The
initialization of some parts had to be moved to a later point in time in the
broker module lifecycle, because only then we know the hosts.
We should really introduce a kind of "resolver" object for stuff like this
and make it accessible to the parts which need it. Currently this is all
global stuff :-P in Livestatus, while in CMC it is part of the World.
Passing the World (or even the whole Core to which it belongs) around just
to access a tiny bit of it needlessly increases coupling, so this is a bit
ugly.
---
livestatus/src/TableEventConsole.cc | 5 +++--
livestatus/src/module.c | 2 +-
livestatus/src/store_c.cc | 27 +++++++++++++++++++++++++++
livestatus/src/store_c.h | 1 +
4 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/livestatus/src/TableEventConsole.cc b/livestatus/src/TableEventConsole.cc
index e9dd5dc..b1cfc04 100644
--- a/livestatus/src/TableEventConsole.cc
+++ b/livestatus/src/TableEventConsole.cc
@@ -54,6 +54,8 @@
#ifdef CMC
#include "Core.h"
#include "World.h"
+#else
+#include "store_c.h"
#endif
// using boost::asio::local::stream_protocol;
@@ -268,10 +270,9 @@ bool TableEventConsole::receiveReply(int sock, Query *query) {
? nullptr
: _core->_world->getHostByDesignation(it->second);
#else
- // Older Nagios headers are not const-correct... :-P
row._host = it == row._map.end()
? nullptr
- : find_host(const_cast<char *>(it->second.c_str()));
+ : getHostByDesignation(it->second.c_str());
#endif
query->processDataset(&row);
}
diff --git a/livestatus/src/module.c b/livestatus/src/module.c
index 1f61045..d58b5bc 100644
--- a/livestatus/src/module.c
+++ b/livestatus/src/module.c
@@ -515,6 +515,7 @@ int broker_process(int event_type __attribute__((__unused__)), void *data) {
struct nebstruct_process_struct *ps =
(struct nebstruct_process_struct *)data;
if (ps->type == NEBTYPE_PROCESS_EVENTLOOPSTART) {
+ store_init();
update_timeperiods_cache(time(0));
start_threads();
}
@@ -874,7 +875,6 @@ int nebmodule_init(int flags __attribute__((__unused__)), char *args,
"the overall nagios performance");
}
- store_init();
register_callbacks();
/* Unfortunately, we cannot start our socket thread right now.
diff --git a/livestatus/src/store_c.cc b/livestatus/src/store_c.cc
index c5b8148..c9bc395 100644
--- a/livestatus/src/store_c.cc
+++ b/livestatus/src/store_c.cc
@@ -23,17 +23,39 @@
// Boston, MA 02110-1301 USA.
#include "store_c.h"
+#include <string>
+#include <unordered_map>
+#include <utility>
#include "ClientQueue.h"
#include "InputBuffer.h"
#include "OutputBuffer.h"
#include "Store.h"
+#include "StringUtils.h"
#include "TimeperiodsCache.h"
+extern host *host_list;
+
+using mk::unsafe_tolower;
+using std::string;
+using std::unordered_map;
+
+// Map to speed up access via name/alias/address
+unordered_map<string, host *> fl_hosts_by_designation;
+
static Store *fl_store = nullptr;
static ClientQueue *fl_client_queue = nullptr;
TimeperiodsCache *g_timeperiods_cache = nullptr;
void store_init() {
+ for (host *hst = host_list; hst != nullptr; hst = hst->next) {
+ if (const char *address = hst->address) {
+ fl_hosts_by_designation[unsafe_tolower(address)] = hst;
+ }
+ if (const char *alias = hst->alias) {
+ fl_hosts_by_designation[unsafe_tolower(alias)] = hst;
+ }
+ fl_hosts_by_designation[unsafe_tolower(hst->name)] = hst;
+ }
fl_store = new Store();
fl_client_queue = new ClientQueue();
g_timeperiods_cache = new TimeperiodsCache();
@@ -86,3 +108,8 @@ void delete_inputbuffer(void *ib) { delete static_cast<InputBuffer *>(ib); }
void update_timeperiods_cache(time_t now) { g_timeperiods_cache->update(now); }
void log_timeperiods_cache() { g_timeperiods_cache->logCurrentTimeperiods(); }
+
+host *getHostByDesignation(const char *designation) {
+ auto it = fl_hosts_by_designation.find(unsafe_tolower(designation));
+ return it == fl_hosts_by_designation.end() ? nullptr : it->second;
+}
diff --git a/livestatus/src/store_c.h b/livestatus/src/store_c.h
index 7b18ed5..c3ac4c5 100644
--- a/livestatus/src/store_c.h
+++ b/livestatus/src/store_c.h
@@ -48,6 +48,7 @@ int queue_pop_connection();
void queue_terminate();
void update_timeperiods_cache(time_t);
void log_timeperiods_cache();
+host *getHostByDesignation(const char *designation);
#ifdef __cplusplus
}
Module: check_mk
Branch: master
Commit: 9c6393cb10090195ad26eafb0ccec48301de12b3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9c6393cb100901…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jun 1 12:21:41 2016 +0200
3617 FIX cmk -I without host specification now (again) always uses cache files
If you do a discovery of all hosts then <tt>cmk -I</tt> always defaulted to
using cache files (like an implicit <tt>--cache</tt>). This behaviour has
gone lost recently and is no revived. You always can use <tt>--no-cache</tt>
if you want fresh data.
---
.werks/3617 | 13 +++++++++++++
ChangeLog | 1 +
modules/check_mk.py | 2 ++
3 files changed, 16 insertions(+)
diff --git a/.werks/3617 b/.werks/3617
new file mode 100644
index 0000000..dd12b5f
--- /dev/null
+++ b/.werks/3617
@@ -0,0 +1,13 @@
+Title: cmk -I without host specification now (again) always uses cache files
+Level: 2
+Component: core
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1464776419
+
+If you do a discovery of all hosts then <tt>cmk -I</tt> always defaulted to
+using cache files (like an implicit <tt>--cache</tt>). This behaviour has
+gone lost recently and is no revived. You always can use <tt>--no-cache</tt>
+if you want fresh data.
diff --git a/ChangeLog b/ChangeLog
index 2eb7e44..6c15638 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,7 @@
* 3437 FIX: Improved performance of "activate changes", especially in distributed environments
* 3471 FIX: Repair ignoring discovery errors when bogus %s is contained in service description...
* 3616 FIX: Fix cmk -I ignoring the option --cache...
+ * 3617 FIX: cmk -I without host specification now (again) always uses cache files...
Checks & Agents:
* 3183 aruba_wlc_aps: new check which monitors the provisioned accesspoints of an Aruba Network WLAN Controller
diff --git a/modules/check_mk.py b/modules/check_mk.py
index c5c1de1..3303019 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -5255,6 +5255,8 @@ try:
# handle -I / -II
if not done and seen_I > 0:
hostnames = parse_hostname_list(args)
+ if not hostnames:
+ opt_use_cachefile = not opt_no_cache
do_discovery(hostnames, check_types, seen_I == 1)
done = True