Module: check_mk
Branch: master
Commit: 0566e6048406cc45649de9161cdc31560377f318
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0566e6048406cc…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed May 11 08:23:45 2016 +0200
Updated lib comment
---
lib/__init__.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/__init__.py b/lib/__init__.py
index 6da5380..1a9ed1d 100644
--- a/lib/__init__.py
+++ b/lib/__init__.py
@@ -24,4 +24,7 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-"""Check_MK's library for code used by different components of Check_MK."""
+"""Check_MK's library for code used by different components of Check_MK.
+
+This library is currently handled as internal module of Check_MK and
+does not offer stable APIs. The code may change at any time."""
Module: check_mk
Branch: master
Commit: 7a1126959a9dfa0c19fb3d3796605fb326b33710
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7a1126959a9dfa…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue May 10 17:09:52 2016 +0200
check_mk can be called from git again (at least some commands work)
---
check_mk | 8 +++++++-
cmk | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/check_mk b/check_mk
deleted file mode 120000
index 4f85dd1..0000000
--- a/check_mk
+++ /dev/null
@@ -1 +0,0 @@
-modules/check_mk.py
\ No newline at end of file
diff --git a/check_mk b/check_mk
new file mode 100755
index 0000000..14408a3
--- /dev/null
+++ b/check_mk
@@ -0,0 +1,7 @@
+#!/usr/bin/python
+# Small wrapper for being able to start check_mk from git directory
+
+import sys
+sys.path.insert(0, "")
+
+execfile("modules/check_mk.py")
diff --git a/cmk b/cmk
new file mode 120000
index 0000000..7951405
--- /dev/null
+++ b/cmk
@@ -0,0 +1 @@
+lib
\ No newline at end of file
Module: check_mk
Branch: master
Commit: 27ec0135df65955494fe73cf427c556d2e7d0576
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=27ec0135df6595…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue May 10 16:07:40 2016 +0200
3572 Added user login session idle timeout
It is now possible to configure a login session idle timeout globally or for each user
individually. When a user logs in and leaves the GUI open without interacting with it,
Check_MK does not invalidate the users login session. The login is valid until the user
closes the window or logs out. With the new option enabled, it is possible to configure
a maximum allowed idle time after which each user has to renew the login.
---
.werks/3572 | 13 +++++++++++++
ChangeLog | 1 +
2 files changed, 14 insertions(+)
diff --git a/.werks/3572 b/.werks/3572
new file mode 100644
index 0000000..d4beb15
--- /dev/null
+++ b/.werks/3572
@@ -0,0 +1,13 @@
+Title: Added user login session idle timeout
+Level: 2
+Component: multisite
+Compatible: compat
+Version: 1.2.9i1
+Date: 1462889110
+Class: feature
+
+It is now possible to configure a login session idle timeout globally or for each user
+individually. When a user logs in and leaves the GUI open without interacting with it,
+Check_MK does not invalidate the users login session. The login is valid until the user
+closes the window or logs out. With the new option enabled, it is possible to configure
+a maximum allowed idle time after which each user has to renew the login.
diff --git a/ChangeLog b/ChangeLog
index 288b391..d7a6e93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -226,6 +226,7 @@
* 3127 new icon on services that are outside their check period
* 3466 Logwatch pages now work in distributed environment without HTTH reverse proxy...
* 3129 new view and datasource containing the results of the last periodic discovery check...
+ * 3572 Added user login session idle timeout...
* 3059 FIX: Fixed highlighting of availability timeline time slices
* 3175 FIX: Fix timeranges of graphs that are embedded in a dashboard...
* 3076 FIX: fixed broken views in check_mk raw edition
Module: check_mk
Branch: master
Commit: 29b83b42cf5db4d493b4ae95ed6e9d59f149b366
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=29b83b42cf5db4…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue May 10 15:31:18 2016 +0200
Fixed typo in comment.
---
bin/mkeventd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/mkeventd b/bin/mkeventd
index c1b4558..134e33e 100755
--- a/bin/mkeventd
+++ b/bin/mkeventd
@@ -102,7 +102,7 @@ def decode_from_bytes(string_as_bytes):
except:
return string_as_bytes.decode("latin-1")
-# Rip out/replace any characters which have a special meaning see in the UTF-8
+# Rip out/replace any characters which have a special meaning in the UTF-8
# encoded history files, see e.g. quote_tab. In theory this shouldn't be
# necessary, because there are a bunch of bytes which are not contained in any
# valid UTF-8 string, but following Murphy's Law, those are not used in
Module: check_mk
Branch: master
Commit: 669b0ec67a33e1b8c9e61bb2b4527cdc85b0b918
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=669b0ec67a33e1…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue May 10 15:11:37 2016 +0200
Improved the Unicode story in mkeventd.
---
bin/mkeventd | 70 ++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 46 insertions(+), 24 deletions(-)
diff --git a/bin/mkeventd b/bin/mkeventd
index 0393d9f..c1b4558 100755
--- a/bin/mkeventd
+++ b/bin/mkeventd
@@ -2,7 +2,7 @@
# encoding: utf-8
import socket, os, time, sys, getopt, signal, thread, pprint, re, \
- select, subprocess, stat
+ select, subprocess, stat, string
import cmk.daemon
VERSION="1.4.0i1"
@@ -94,6 +94,39 @@ history_columns = [
( "history_addinfo", "" ),
] + event_columns
+# Alas, we often have no clue about the actual encoding, so we have to guess:
+# Initially we assume UTF-8, but fall back to latin-1 if it didn't work.
+def decode_from_bytes(string_as_bytes):
+ try:
+ return string_as_bytes.decode("utf-8")
+ except:
+ return string_as_bytes.decode("latin-1")
+
+# Rip out/replace any characters which have a special meaning see in the UTF-8
+# encoded history files, see e.g. quote_tab. In theory this shouldn't be
+# necessary, because there are a bunch of bytes which are not contained in any
+# valid UTF-8 string, but following Murphy's Law, those are not used in
+# Check_MK. To keep backwards compatibility with old history files, we have no
+# choice and continue to do it wrong... :-/
+def scrub_string(s):
+ if type(s) == str:
+ return s.translate(scrub_string.str_table, "\0\1\2\n")
+ if type(s) == unicode:
+ return s.translate(scrub_string.unicode_table)
+ raise TypeError("scrub_string expects a string argument")
+
+scrub_string.str_table = string.maketrans("\t", " ")
+scrub_string.unicode_table = {
+ 0: None,
+ 1: None,
+ 2: None,
+ ord("\n"): None,
+ ord("\t"): ord(" ")
+}
+
+def scrub_and_decode(s):
+ return decode_from_bytes(scrub_string(s))
+
def unsplit(s):
if not isinstance(s, basestring):
return s
@@ -694,9 +727,9 @@ def log_event_history_to_file(event, what, who, addinfo):
with lock_logging:
columns = [
str(time.time()),
- what,
- who,
- addinfo ]
+ scrub_string(what),
+ scrub_string(who),
+ scrub_string(addinfo) ]
columns += [ quote_tab(event.get(colname[6:], defval)) # drop "event_"
for colname, defval in event_columns ]
@@ -1323,28 +1356,23 @@ class EventServer:
def create_event_from_trap(self, trap, ipaddress):
# use the trap-oid as application
- application = ''
+ application = u''
for index, (oid, val) in enumerate(trap):
if oid in ['1.3.6.1.6.3.1.1.4.1.0', 'SNMPv2-MIB::snmpTrapOID.0']:
- application = trap.pop(index)[1]
+ application = scrub_and_decode(trap.pop(index)[1])
break
# once we got here we have a real parsed trap which we convert to an event now
- text = ', '.join([ '%s: %s' % (item[0], str(item[1]).replace('\n', '')) for item in trap ])
-
- # Convert to Unicode, first assume UTF-8, then latin-1
- try:
- text = text.decode("utf-8")
- except:
- text = text.decode("latin-1")
+ safe_ipaddress = scrub_and_decode(ipaddress)
+ text = scrub_and_decode(', '.join([ '%s: %s' % (item[0], str(item[1])) for item in trap ]))
event = {
'time' : time.time(),
- 'host' : ipaddress,
- 'ipaddress' : ipaddress,
+ 'host' : safe_ipaddress,
+ 'ipaddress' : safe_ipaddress,
'priority' : 5, # notice
'facility' : 31, # not used by syslog -> we use this for all traps
- 'application' : application.replace('\n', ''),
+ 'application' : application,
'text' : text
}
@@ -1509,13 +1537,7 @@ class EventServer:
def process_raw_lines(self, data, address = None):
lines = data.splitlines()
for line in lines:
- line = line.rstrip().replace('\0', '')
- # Convert to Unicode, first assume UTF-8, then latin-1
- try:
- line = line.decode("utf-8")
- except:
- line = line.decode("latin-1")
-
+ line = scrub_and_decode(line.rstrip())
if line:
try:
self.process_raw_data(self.process_line, (line, address))
@@ -2608,7 +2630,7 @@ class StatusServer:
def handle_client(self, socket, allow_commands, client_ip):
- query = socket.recv(8192).splitlines()
+ query = decode_from_bytes(socket.recv(8192)).splitlines()
parts = query[0].split(None, 1)
if len(parts) != 2:
raise MKClientError("Invalid query. Need GET/COMMAND plus argument(s)")
Module: check_mk
Branch: master
Commit: 4291b081bcfe4045981376af557ce8ec3a914426
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4291b081bcfe40…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue May 10 11:13:09 2016 +0200
Make localized strings work in non localized context
---
lib/exceptions.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lib/exceptions.py b/lib/exceptions.py
index 3f6ab91..fe74d3b 100644
--- a/lib/exceptions.py
+++ b/lib/exceptions.py
@@ -24,6 +24,16 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
+# TODO: Clean this up one day by using the way recommended by gettext.
+# (See https://docs.python.org/2/library/gettext.html). For this we
+# need the path to the locale files here.
+try:
+ _
+except NameError:
+ _ = lambda x: x # Fake i18n when not available
+
+
# never used directly in the code. Just some wrapper to make all of our
# exceptions handleable with one call
class MKException(Exception):