Module: check_mk
Branch: master
Commit: f4700da13dc3848e7f525f350c562b8e5e24f9fb
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f4700da13dc384…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Jun 3 14:41:25 2016 +0200
Fetched Livestatus from downstream plus associated fixes.
---
.../src/DynamicEventConsoleReplicationColumn.cc | 35 ++++++++++++++++
.../src/DynamicEventConsoleReplicationColumn.h | 42 ++++++++++++++++++++
livestatus/src/Makefile.am | 3 +-
livestatus/src/TableEventConsoleReplication.cc | 10 ++++-
livestatus/src/TableEventConsoleReplication.h | 3 +-
5 files changed, 88 insertions(+), 5 deletions(-)
diff --git a/livestatus/src/DynamicEventConsoleReplicationColumn.cc b/livestatus/src/DynamicEventConsoleReplicationColumn.cc
new file mode 100644
index 0000000..c1af0ea
--- /dev/null
+++ b/livestatus/src/DynamicEventConsoleReplicationColumn.cc
@@ -0,0 +1,35 @@
+// +------------------------------------------------------------------+
+// | ____ _ _ __ __ _ __ |
+// | / ___| |__ ___ ___| | __ | \/ | |/ / |
+// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+// | | |___| | | | __/ (__| < | | | | . \ |
+// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+// | |
+// | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+// +------------------------------------------------------------------+
+//
+// This file is part of Check_MK.
+// The official homepage is at http://mathias-kettner.de/check_mk.
+//
+// check_mk is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation in version 2. check_mk is distributed
+// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+// PARTICULAR PURPOSE. See the GNU General Public License for more de-
+// ails. You should have received a copy of the GNU General Public
+// License along with GNU Make; see the file COPYING. If not, write
+// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+#include "DynamicEventConsoleReplicationColumn.h"
+
+DynamicEventConsoleReplicationColumn::DynamicEventConsoleReplicationColumn(
+ std::string name, std::string description, int indirect_offset,
+ int extra_offset)
+ : DynamicColumn(name, description, indirect_offset, extra_offset) {}
+
+Column *DynamicEventConsoleReplicationColumn::createColumn(
+ int indirect_offset, int extra_offset, const char *arguments) {
+ return nullptr;
+}
diff --git a/livestatus/src/DynamicEventConsoleReplicationColumn.h b/livestatus/src/DynamicEventConsoleReplicationColumn.h
new file mode 100644
index 0000000..360d0ac
--- /dev/null
+++ b/livestatus/src/DynamicEventConsoleReplicationColumn.h
@@ -0,0 +1,42 @@
+// +------------------------------------------------------------------+
+// | ____ _ _ __ __ _ __ |
+// | / ___| |__ ___ ___| | __ | \/ | |/ / |
+// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+// | | |___| | | | __/ (__| < | | | | . \ |
+// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+// | |
+// | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+// +------------------------------------------------------------------+
+//
+// This file is part of Check_MK.
+// The official homepage is at http://mathias-kettner.de/check_mk.
+//
+// check_mk is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation in version 2. check_mk is distributed
+// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+// PARTICULAR PURPOSE. See the GNU General Public License for more de-
+// ails. You should have received a copy of the GNU General Public
+// License along with GNU Make; see the file COPYING. If not, write
+// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+#ifndef DynamicEventConsoleReplicationColumn_h
+#define DynamicEventConsoleReplicationColumn_h
+
+#include "config.h" // IWYU pragma: keep
+#include <string>
+#include "DynamicColumn.h"
+class Column;
+
+class DynamicEventConsoleReplicationColumn : public DynamicColumn {
+public:
+ DynamicEventConsoleReplicationColumn(std::string name,
+ std::string description,
+ int indirect_offset, int extra_offset);
+ Column *createColumn(int indirect_offset, int extra_offset,
+ const char *arguments) override;
+};
+
+#endif // DynamicEventConsoleReplicationColumn_h
diff --git a/livestatus/src/Makefile.am b/livestatus/src/Makefile.am
index 90452b9..687cbf4 100644
--- a/livestatus/src/Makefile.am
+++ b/livestatus/src/Makefile.am
@@ -53,6 +53,8 @@ livestatus_so_SOURCES = \
DowntimeOrComment.cc \
DowntimesOrComments.cc \
DynamicColumn.cc \
+ DynamicEventConsoleReplicationColumn.cc \
+ DynamicLogwatchFileColumn.cc \
EmptyColumn.cc \
EventConsoleConnection.cc \
Filter.cc \
@@ -76,7 +78,6 @@ livestatus_so_SOURCES = \
LogEntry.cc \
Logfile.cc \
LogwatchListColumn.cc \
- DynamicLogwatchFileColumn.cc \
MetricsColumn.cc \
NullColumn.cc \
OffsetDoubleColumn.cc \
diff --git a/livestatus/src/TableEventConsoleReplication.cc b/livestatus/src/TableEventConsoleReplication.cc
index 4b025b0..78e5357 100644
--- a/livestatus/src/TableEventConsoleReplication.cc
+++ b/livestatus/src/TableEventConsoleReplication.cc
@@ -23,13 +23,19 @@
// Boston, MA 02110-1301 USA.
#include "TableEventConsoleReplication.h"
+#include "DynamicEventConsoleReplicationColumn.h"
+
+TableEventConsoleReplication::TableEventConsoleReplication() {
+ addDynamicColumn(new DynamicEventConsoleReplicationColumn(
+ "value", "The replication value", -1, -1));
+}
const char *TableEventConsoleReplication::name() const {
- return "eventconsoleevents";
+ return "eventconsolereplication";
}
const char *TableEventConsoleReplication::namePrefix() const {
- return "eventconsoleevents_";
+ return "eventconsolereplication_";
}
void TableEventConsoleReplication::answerQuery(Query *query) {}
diff --git a/livestatus/src/TableEventConsoleReplication.h b/livestatus/src/TableEventConsoleReplication.h
index 3bc6144..76f6d42 100644
--- a/livestatus/src/TableEventConsoleReplication.h
+++ b/livestatus/src/TableEventConsoleReplication.h
@@ -30,11 +30,10 @@
class TableEventConsoleReplication : public Table {
public:
+ TableEventConsoleReplication();
const char *name() const override;
const char *namePrefix() const override;
void answerQuery(Query *query) override;
-
-private:
};
#endif // TableEventConsoleReplication_h
Module: check_mk
Branch: master
Commit: b9d59f5e3331ac572d5fd57932f74f78fda86a5e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b9d59f5e3331ac…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Jun 3 13:53:38 2016 +0200
Fetched Livestatus from downstream plus associated fixes.
---
livestatus/src/Makefile.am | 1 +
livestatus/src/Store.cc | 1 +
livestatus/src/Store.h | 2 ++
livestatus/src/TableEventConsoleReplication.cc | 35 +++++++++++++++++++++
livestatus/src/TableEventConsoleReplication.h | 40 ++++++++++++++++++++++++
5 files changed, 79 insertions(+)
diff --git a/livestatus/src/Makefile.am b/livestatus/src/Makefile.am
index aa20510..90452b9 100644
--- a/livestatus/src/Makefile.am
+++ b/livestatus/src/Makefile.am
@@ -114,6 +114,7 @@ livestatus_so_SOURCES = \
TableEventConsole.cc \
TableEventConsoleEvents.cc \
TableEventConsoleHistory.cc \
+ TableEventConsoleReplication.cc \
TableEventConsoleStatus.cc \
TableHostgroups.cc \
TableHosts.cc \
diff --git a/livestatus/src/Store.cc b/livestatus/src/Store.cc
index 6100d5d..9487427 100644
--- a/livestatus/src/Store.cc
+++ b/livestatus/src/Store.cc
@@ -92,6 +92,7 @@ Store::Store()
addTable(&_table_eventconsoleevents);
addTable(&_table_eventconsolehistory);
addTable(&_table_eventconsolestatus);
+ addTable(&_table_eventconsolereplication);
g_table_hosts = &_table_hosts;
g_table_services = &_table_services;
diff --git a/livestatus/src/Store.h b/livestatus/src/Store.h
index 26f6a2c..bac7e08 100644
--- a/livestatus/src/Store.h
+++ b/livestatus/src/Store.h
@@ -40,6 +40,7 @@
#include "TableDownComm.h"
#include "TableEventConsoleEvents.h"
#include "TableEventConsoleHistory.h"
+#include "TableEventConsoleReplication.h"
#include "TableEventConsoleStatus.h"
#include "TableHostgroups.h"
#include "TableHosts.h"
@@ -90,6 +91,7 @@ private:
TableEventConsoleEvents _table_eventconsoleevents;
TableEventConsoleHistory _table_eventconsolehistory;
TableEventConsoleStatus _table_eventconsolestatus;
+ TableEventConsoleReplication _table_eventconsolereplication;
std::map<std::string, Table *> _tables;
diff --git a/livestatus/src/TableEventConsoleReplication.cc b/livestatus/src/TableEventConsoleReplication.cc
new file mode 100644
index 0000000..4b025b0
--- /dev/null
+++ b/livestatus/src/TableEventConsoleReplication.cc
@@ -0,0 +1,35 @@
+// +------------------------------------------------------------------+
+// | ____ _ _ __ __ _ __ |
+// | / ___| |__ ___ ___| | __ | \/ | |/ / |
+// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+// | | |___| | | | __/ (__| < | | | | . \ |
+// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+// | |
+// | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+// +------------------------------------------------------------------+
+//
+// This file is part of Check_MK.
+// The official homepage is at http://mathias-kettner.de/check_mk.
+//
+// check_mk is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation in version 2. check_mk is distributed
+// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+// PARTICULAR PURPOSE. See the GNU General Public License for more de-
+// ails. You should have received a copy of the GNU General Public
+// License along with GNU Make; see the file COPYING. If not, write
+// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+#include "TableEventConsoleReplication.h"
+
+const char *TableEventConsoleReplication::name() const {
+ return "eventconsoleevents";
+}
+
+const char *TableEventConsoleReplication::namePrefix() const {
+ return "eventconsoleevents_";
+}
+
+void TableEventConsoleReplication::answerQuery(Query *query) {}
diff --git a/livestatus/src/TableEventConsoleReplication.h b/livestatus/src/TableEventConsoleReplication.h
new file mode 100644
index 0000000..3bc6144
--- /dev/null
+++ b/livestatus/src/TableEventConsoleReplication.h
@@ -0,0 +1,40 @@
+// +------------------------------------------------------------------+
+// | ____ _ _ __ __ _ __ |
+// | / ___| |__ ___ ___| | __ | \/ | |/ / |
+// | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+// | | |___| | | | __/ (__| < | | | | . \ |
+// | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+// | |
+// | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+// +------------------------------------------------------------------+
+//
+// This file is part of Check_MK.
+// The official homepage is at http://mathias-kettner.de/check_mk.
+//
+// check_mk is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation in version 2. check_mk is distributed
+// in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+// out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+// PARTICULAR PURPOSE. See the GNU General Public License for more de-
+// ails. You should have received a copy of the GNU General Public
+// License along with GNU Make; see the file COPYING. If not, write
+// to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+#ifndef TableEventConsoleReplication_h
+#define TableEventConsoleReplication_h
+
+#include "config.h" // IWYU pragma: keep
+#include "Table.h"
+
+class TableEventConsoleReplication : public Table {
+public:
+ const char *name() const override;
+ const char *namePrefix() const override;
+ void answerQuery(Query *query) override;
+
+private:
+};
+
+#endif // TableEventConsoleReplication_h
Module: check_mk
Branch: master
Commit: 406129d26d4689bc35830aea971dceeba54b6ffb
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=406129d26d4689…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jun 3 10:08:09 2016 +0200
Ensure parent directory exists during locking of files
---
web/htdocs/lib.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index 9d1b847..38e1f03 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -390,7 +390,8 @@ def aquire_lock(path):
if path in g_locked_paths:
return # No recursive locking
- # Create file for locking if not existant yet
+ # Create file (and base dir) for locking if not existant yet
+ make_nagios_directory(os.path.dirname(path))
fd = os.open(path, os.O_RDONLY | os.O_CREAT)
# Handle the case where the file has been renamed in the meantime
Module: check_mk
Branch: master
Commit: 47579c9de582199dd6731445b43b1d4c0e7f30c6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=47579c9de58219…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Thu Jun 2 16:54:53 2016 +0200
3139 FIX fixed a couple of minor issues in call to notification scripts
The fixed issues are as follows:
- in case of a timeout of the notification script, the script is supposed to be
terminated. This worked only on python 2.6 and newer
- due to timing there was a good chance the exit code of the notification script
was ignored
- the output of the notification script was buffered in memory until the process
exited before being written. Theoretically this could cause high memory usage
in the notification processes
---
.werks/3139 | 17 +++++++++++++++++
ChangeLog | 1 +
modules/notify.py | 22 ++++++++++++++--------
3 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/.werks/3139 b/.werks/3139
new file mode 100644
index 0000000..b13bdc7
--- /dev/null
+++ b/.werks/3139
@@ -0,0 +1,17 @@
+Title: fixed a couple of minor issues in call to notification scripts
+Level: 1
+Component: notifications
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1464879023
+
+The fixed issues are as follows:
+ - in case of a timeout of the notification script, the script is supposed to be
+ terminated. This worked only on python 2.6 and newer
+ - due to timing there was a good chance the exit code of the notification script
+ was ignored
+ - the output of the notification script was buffered in memory until the process
+ exited before being written. Theoretically this could cause high memory usage
+ in the notification processes
diff --git a/ChangeLog b/ChangeLog
index 2dfe84c..9b8b66d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -426,6 +426,7 @@
* 3418 FIX: Do not send host notifications if a service group is required...
NOTE: Please refer to the migration notes!
* 3426 FIX: sms: fixed wrong message handling after message was quoted and therefore too long
+ * 3139 FIX: fixed a couple of minor issues in call to notification scripts...
BI:
* 3271 New option in aggregation for tuning aggregation of downtimes...
diff --git a/modules/notify.py b/modules/notify.py
index 6aff383..7ef1915 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -1164,21 +1164,27 @@ def call_notification_script(plugin, plugin_context):
p = subprocess.Popen([path], shell=False, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, env=notification_script_env(plugin_context))
- for line in p.stdout:
- plugin_log("Output: %s" % line.rstrip().decode('utf-8'))
-
- exitcode = p.returncode
+ while True:
+ # read and output stdout linewise to ensure we don't force python to produce
+ # one - potentially huge - memory buffer
+ line = p.stdout.readline()
+ if line != '':
+ plugin_log("Output: %s" % line.rstrip().decode('utf-8'))
+ else:
+ break
+ # the stdout is closed but the return code may not be available just yet - wait for the
+ # process to actually finish
+ exitcode = p.wait()
clear_notification_timeout()
except NotificationTimeout:
plugin_log("Notification plugin did not finish within %d seconds. Terminating." %
notification_plugin_timeout)
- p.kill()
+ # p.kill() requires python 2.6!
+ os.kill(p.pid, signal.SIGTERM)
exitcode = 1
- if exitcode:
+ if exitcode != 0:
plugin_log("Plugin exited with code %d" % exitcode)
- else:
- exitcode = 0
return exitcode