Module: check_mk
Branch: master
Commit: c74f217038a80776d9de17654436d7937a5fdca8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c74f217038a807…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 10 12:10:31 2013 +0100
Improved handling of CTRL+C (SIGINT) to terminate long runnining tasks (e.g. inventory of
SNMP hosts)
---
.bugs/808 | 7 +++++--
ChangeLog | 8 ++++++--
modules/check_mk_base.py | 6 +++++-
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/.bugs/808 b/.bugs/808
index d553fdf..965c7c0 100644
--- a/.bugs/808
+++ b/.bugs/808
@@ -1,9 +1,9 @@
Title: Handle ctrl-c for inventory
Component: core
-State: open
+Class: nastiness
+State: done
Date: 2012-10-10 13:37:24
Targetversion: 1.2.2
-Class: nastiness
Currently, trying to abort an inventory only kills the current inventory. If you
have simply specified cmk -I you'll need to abort as many times as there are hosts
@@ -14,3 +14,6 @@ Currently we have the problem, that the snmp commands get the Ctrl-C and
not
Python. Can we start the snmp commands without a controlling terminal?
And the gracefully handle Ctrl-C in Check_MK.
+
+2013-01-10 12:09:04: changed state open -> done
+This could simply be solved by adding a SIGINT handler to check_mk
diff --git a/ChangeLog b/ChangeLog
index cf69e5e..4df185b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,15 @@
1.2.1i5
- Checks & Agents
+ Core:
+ * Improved handling of CTRL+C (SIGINT) to terminate long runnining tasks
+ (e.g. inventory of SNMP hosts)
+
+ Checks & Agents:
* Linux Agent, diskstat: Now supporting /dev/emcpower* devices (Thanks to Claas
Rockmann-Buchterkirche)
* FIX: winperf_processor: Showing 0% on "cmk -nv" now instead of 100%
* FIX: win_dhcp_pools: removed faulty output on non-german windows 2003 servers
with no dhcp server installed (Thanks to Mathias Decker)
- Multisite
+ Multisite:
* FIX: Fixed rendering of dashboard globes in opera
1.2.1i4:
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index d87eee8..bb45386 100755
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -75,7 +75,6 @@ else:
def tty(fg=-1, bg=-1, attr=-1):
return ''
-
# global variables used to cache temporary values
g_dns_cache = {}
g_infocache = {} # In-memory cache of host info.
@@ -105,6 +104,11 @@ opt_use_snmp_walk = False
opt_cleanup_autochecks = False
fake_dns = False
+# register SIGINT handler for consistenct CTRL+C handling
+def interrupt_handler(signum, frame):
+ sys.stderr.write('<Interrupted>\n')
+ sys.exit(1)
+signal.signal(signal.SIGINT, interrupt_handler)
class MKGeneralException(Exception):
def __init__(self, reason):