Module: check_mk
Branch: master
Commit: c90556c74e17f2e1882a2f2a01a2a7996aa07fde
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c90556c74e17f2…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Apr 5 14:57:47 2016 +0200
Synched headrify with reality.
---
doc/helpers/headrify | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/doc/helpers/headrify b/doc/helpers/headrify
index a5438c9..6c39ca9 100755
--- a/doc/helpers/headrify
+++ b/doc/helpers/headrify
@@ -18,20 +18,18 @@ header ()
cat <<EOF
This file is part of Check_MK.
-Copyright by Mathias Kettner and Mathias Kettner GmbH. All rights reserved.
+The official homepage is at http://mathias-kettner.de/check_mk.
-Check_MK is free software; you can redistribute it and/or modify it
+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; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public
-License along with Check_MK. If not, email to mk(a)mathias-kettner.de
-or write to the postal address provided at www.mathias-kettner.de
+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.
EOF
if [ -n "$lastline" ] ; then
echo
Module: check_mk
Branch: master
Commit: 806c0c171a6fe8f33463cb52cb6338cd29ec43c3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=806c0c171a6fe8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Apr 4 16:21:23 2016 +0200
Cleaned up registration of SIGINT handler
---
modules/check_mk.py | 5 +++++
modules/check_mk_base.py | 13 +++++++++++--
modules/nagios.py | 3 +++
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index db652bb..d8f16a9 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -4897,6 +4897,7 @@ def output_profile():
# | Main entry point and option parsing. Here is where all begins. |
# '----------------------------------------------------------------------'
+register_sigint_handler()
load_checks()
opt_nowiki = False
@@ -5222,6 +5223,10 @@ try:
output_profile()
sys.exit(exit_status)
+except MKTerminate, e:
+ # At top level this exception means the process has been terminated without issues.
+ sys.exit(0)
+
except (MKGeneralException, MKBailOut), e:
sys.stderr.write("%s\n" % e)
if opt_debug:
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index b09d8dc..89f3ff3 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -262,13 +262,19 @@ class MKSNMPError(Exception):
class MKSkipCheck(Exception):
pass
-# This signal is raised when a previously configured timeout is reached.
+# This exception is raised when a previously configured timeout is reached.
# It is used during keepalive mode. It is also used by the automations
# which have a timeout set.
class MKTimeout(Exception):
pass
+# This exception is raises when the current Check_MK execution should be
+# terminated. Currently it is raised by the SIGINT signal handler to propagate
+# the termination up the callstack.
+class MKTerminate(Exception):
+ pass
+
#.
# .--Get data------------------------------------------------------------.
@@ -2515,8 +2521,11 @@ def submit_check_mk_aggregation(hostname, status, output):
# '----------------------------------------------------------------------'
# register SIGINT handler for consistent CTRL+C handling
+# TODO: use MKTermiante() signal instead and handle output and exit code in check_mk.py
def interrupt_handler(signum, frame):
sys.stderr.write('<Interrupted>\n')
sys.exit(1)
-signal.signal(signal.SIGINT, interrupt_handler)
+
+def register_sigint_handler():
+ signal.signal(signal.SIGINT, interrupt_handler)
diff --git a/modules/nagios.py b/modules/nagios.py
index 2b152d1..debe7f1 100644
--- a/modules/nagios.py
+++ b/modules/nagios.py
@@ -986,6 +986,9 @@ if os.path.islink(%(dst)r):
output.write(stripped_python_file(modules_dir + "/check_mk_base.py"))
+ # Register default Check_MK signal handler
+ output.write("register_sigint_handler()\n")
+
# TODO: can we avoid adding this module if no predictive monitoring
# is being used?
output.write(stripped_python_file(modules_dir + "/prediction.py"))