Module: check_mk
Branch: master
Commit: 1f9fb2a4a1c5e385da656891319c80f1a8ffc405
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1f9fb2a4a1c5e3…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Mon Nov 11 16:52:36 2013 +0100
livedump: new option to mark the mode at the beginning of the dump and documentation fixes
livedump now has an option to mark the mode of the dump (config or status) in the first
line of the dump to be read by the livedump receiver livedump-ssh-recv
---
.werks/67 | 9 +++++++++
ChangeLog | 1 +
doc/treasures/livedump/README | 4 ++--
doc/treasures/livedump/livedump | 15 +++++++++++++--
doc/treasures/livedump/livedump-ssh-recv | 2 +-
5 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/.werks/67 b/.werks/67
new file mode 100644
index 0000000..a8bd992
--- /dev/null
+++ b/.werks/67
@@ -0,0 +1,9 @@
+Title: livedump: new option to mark the mode at the beginning of the dump and documentation fixes
+Level: 1
+Component: livestatus
+Version: 1.2.3i7
+Date: 1384184962
+Class: feature
+
+livedump now has an option to mark the mode of the dump (config or status) in the first
+line of the dump to be read by the livedump receiver livedump-ssh-recv
diff --git a/ChangeLog b/ChangeLog
index 74ee996..73fbc7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -40,6 +40,7 @@
* 0026 FIX: snmpd_mkevent.py: fixed crash on startup
Livestatus:
+ * 0067 livedump: new option to mark the mode at the beginning of the dump and documentation fixes...
* 0023 FIX: table statehist: code cleanup / minor performance improvements
diff --git a/doc/treasures/livedump/README b/doc/treasures/livedump/README
index 797adb2..3f478ab 100644
--- a/doc/treasures/livedump/README
+++ b/doc/treasures/livedump/README
@@ -30,10 +30,10 @@ NSCA users will now this. This is easily done by:
./livedump -TC > some_file.cfg
and then copying that file to your objects or conf.d directory on
-your target nagios. Note: The option -C will add some templates
+your target nagios. Note: The option -T will add some templates
to the configuration that are used by the created host and service
definitions. If you import data from more than on source those
-template will be duplicate. Use -T in that case in order to avoid
+template will be duplicate. Use -C only in that case in order to avoid
duplication.
Now restart your target system and new hosts and services will appear
diff --git a/doc/treasures/livedump/livedump b/doc/treasures/livedump/livedump
index b784262..ad391cc 100755
--- a/doc/treasures/livedump/livedump
+++ b/doc/treasures/livedump/livedump
@@ -33,9 +33,11 @@ def dump_templates():
sys.stdout.write("""
define host {
name livedump-host
+ use check_mk_default
register 0
active_checks_enabled 0
passive_checks_enabled 1
+
}
define service {
@@ -226,6 +228,8 @@ def usage():
-h, --help Show this cruft
-V, --version Show version and exit
-T, --dump-templates Also dump host/service templates
+ -M, --mark-mode Puts the mode (state/configuration dump) in the first
+ line for use with livedump-ssh-recv and similar scripts
-s, --socket S connect to Livestatus-socket at S
-s tcp:10.11.0.55:6557
@@ -255,14 +259,15 @@ def print_version():
# | Main entry point, getopt, etc. |
# '----------------------------------------------------------------------'
-short_options = 'hVvc:H:S:O:TC'
+short_options = 'hVvc:H:S:O:TCM'
long_options = [ "help", "version", "verbose", "debug", "socket=",
"host-header=", "host-only-header=", "service-header=",
- "dump-templates", "config", "state" ]
+ "dump-templates", "config", "state", "mark-mode" ]
opt_verbose = False
opt_debug = False
opt_socket = None
+opt_mark_mode = False
opt_host_headers = ""
opt_host_only_headers = ""
opt_service_headers = ""
@@ -299,6 +304,8 @@ for o,a in opts:
opt_service_headers += a + "\n"
elif o in [ '-T', '--dump-templates' ]:
opt_dump_templates = True
+ elif o in [ '-M', '--mark-mode' ]:
+ opt_mark_mode = True
# Main modes
@@ -306,8 +313,12 @@ try:
connect()
for o, a in opts:
if o in [ '-C', '--config' ]:
+ if opt_mark_mode:
+ print "config"
livedump_config()
sys.exit(0)
+ if opt_mark_mode:
+ print "status"
livedump_state()
except Exception, e:
diff --git a/doc/treasures/livedump/livedump-ssh-recv b/doc/treasures/livedump/livedump-ssh-recv
old mode 100644
new mode 100755
index b8d69ae..7d76172
--- a/doc/treasures/livedump/livedump-ssh-recv
+++ b/doc/treasures/livedump/livedump-ssh-recv
@@ -4,7 +4,7 @@
# a) a header (specificing if its the configuration or status info)
# b) the real data as generated by livedump
#
-# When the first line contains the string "state", the following lines
+# When the first line contains the string "status", the following lines
# are all treated as checkresult information. If the line contains the
# string "config", the following lines are treated as nagios configuration
# definitions. All chars after the config string in the subject are used
Module: check_mk
Branch: master
Commit: 4f2f88b61df403fc288def028b73f10eff81a88d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4f2f88b61df403…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 11 16:15:27 2013 +0100
FIX Fixed logwatch permission check when using liveproxy
When using the liveproxy daemon and logwatch together, the
permission check for non administrative users always failed.
As a result normal users could not access logfiles, which
they should be allowed to see.
---
.werks/206 | 11 +++++++++++
ChangeLog | 1 +
web/htdocs/livestatus.py | 2 +-
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/.werks/206 b/.werks/206
new file mode 100644
index 0000000..337f305
--- /dev/null
+++ b/.werks/206
@@ -0,0 +1,11 @@
+Title: Fixed logwatch permission check when using liveproxy
+Level: 1
+Component: multisite
+Version: 1.2.3i7
+Date: 1384182853
+Class: fix
+
+When using the liveproxy daemon and logwatch together, the
+permission check for non administrative users always failed.
+As a result normal users could not access logfiles, which
+they should be allowed to see.
diff --git a/ChangeLog b/ChangeLog
index b7cdd8e..734c5d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,7 @@
* 0049 FIX: Fixed check-mk-automation call on each new created apache thread...
* 0203 FIX: Changed sidebar reload interval to be more random...
* 0204 FIX: Reduced I/O on logins with access time recording or failed login counts...
+ * 0206 FIX: Fixed logwatch permission check when using liveproxy...
WATO:
* 0053 New rule for configuring the display_name of a service...
diff --git a/web/htdocs/livestatus.py b/web/htdocs/livestatus.py
index 8c5ba3b..f0de1c4 100644
--- a/web/htdocs/livestatus.py
+++ b/web/htdocs/livestatus.py
@@ -672,7 +672,7 @@ class MultiSiteConnection(Helpers):
# Return connection to localhost (UNIX), if available
def local_connection(self):
for sitename, site, connection in self.connections:
- if site["socket"].startswith("unix:"):
+ if site["socket"].startswith("unix:") and "liveproxy" not in site["socket"]:
return connection
raise MKLivestatusConfigError("No livestatus connection to local host")
Module: check_mk
Branch: master
Commit: 3ed9eda63fbba1f6b4f181b764954acf989897f4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3ed9eda63fbba1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 11 09:28:02 2013 +0100
FIX Reduced I/O on logins with access time recording or failed login counts
In previous versions, these optional features were loading the whole user
configuration just to read / change one attribute of one user, which is kept
in a single file. This mechanism has been recoded to only use this single
custom attribute file. Should reduce I/O in large installations during
multisite processing.
---
.werks/204 | 12 +++++++++++
ChangeLog | 1 +
web/htdocs/userdb.py | 55 +++++++++++++++++++++++++-------------------------
3 files changed, 40 insertions(+), 28 deletions(-)
diff --git a/.werks/204 b/.werks/204
new file mode 100644
index 0000000..fbc2294
--- /dev/null
+++ b/.werks/204
@@ -0,0 +1,12 @@
+Title: Reduced I/O on logins with access time recording or failed login counts
+Level: 1
+Component: multisite
+Version: 1.2.3i7
+Date: 1384158368
+Class: fix
+
+In previous versions, these optional features were loading the whole user
+configuration just to read / change one attribute of one user, which is kept
+in a single file. This mechanism has been recoded to only use this single
+custom attribute file. Should reduce I/O in large installations during
+multisite processing.
diff --git a/ChangeLog b/ChangeLog
index 22dfc1f..6df9d74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,7 @@
* 0046 FIX: Allowing "-" chars in var names again...
* 0049 FIX: Fixed check-mk-automation call on each new created apache thread...
* 0203 FIX: Changed sidebar reload interval to be more random...
+ * 0204 FIX: Reduced I/O on logins with access time recording or failed login counts...
WATO:
* 0053 New rule for configuring the display_name of a service...
diff --git a/web/htdocs/userdb.py b/web/htdocs/userdb.py
index dab736f..794e64a 100644
--- a/web/htdocs/userdb.py
+++ b/web/htdocs/userdb.py
@@ -124,25 +124,14 @@ def user_locked(username):
def update_user_access_time():
if not config.save_user_access_times:
return
-
- users = load_users(lock = True)
- users[html.user]['last_seen'] = time.time()
- save_users(users)
+ save_custom_attr(html.user, 'last_seen', repr(time.time()))
def on_succeeded_login(username):
- users = load_users(lock = True)
- changed = False
+ num_failed = load_custom_attr(username, 'num_failed', saveint)
+ if num_failed != None and num_failed != 0:
+ save_custom_attr(username, 'num_failed', '0')
- if users[username].get('num_failed', 0) != 0:
- users[username]["num_failed"] = 0
- changed = True
-
- if config.save_user_access_times:
- users[username]['last_seen'] = time.time()
- changed = True
-
- if changed:
- save_users(users)
+ update_user_access_time()
def on_failed_login(username):
users = load_users(lock = True)
@@ -303,12 +292,14 @@ def load_users(lock = False):
id = d
# read special values from own files
- for val, conv_func in [ ('num_failed', saveint), ('last_seen', savefloat) ]:
- if id in result:
- try:
- result[id][val] = conv_func(file(dir + d + '/' + val + '.mk').read().strip())
- except IOError:
- pass
+ if id in result:
+ num_failed = load_custom_attr(d, 'num_failed', saveint)
+ if num_failed != None:
+ result[id]['num_failed'] = num_failed
+
+ last_seen = load_custom_attr(d, 'last_seen', savefloat)
+ if last_seen != None:
+ result[id]['last_seen'] = last_seen
# read automation secrets and add them to existing
# users or create new users automatically
@@ -327,6 +318,17 @@ def load_users(lock = False):
return result
+def load_custom_attr(userid, key, conv_func, default = None):
+ basedir = defaults.var_dir + "/web/" + userid
+ try:
+ return conv_func(file(basedir + '/' + key + '.mk').read().strip())
+ except IOError:
+ return default
+
+def save_custom_attr(userid, key, val):
+ basedir = defaults.var_dir + "/web/" + userid
+ create_user_file('%s/%s.mk' % (basedir, key), 'w').write('%s\n' % val)
+
def get_online_user_ids():
online_threshold = time.time() - config.user_online_maxage
users = []
@@ -422,17 +424,14 @@ def save_users(profiles):
os.remove(auth_file)
# Write out the users serial
- serial_file = user_dir + '/serial.mk'
- create_user_file(serial_file, 'w').write('%d\n' % user.get('serial', 0))
+ save_custom_attr(id, 'serial', str(user.get('serial', 0)))
# Write out the users number of failed login
- failed_file = user_dir + '/num_failed.mk'
- create_user_file(failed_file, 'w').write('%d\n' % user.get('num_failed', 0))
+ save_custom_attr(id, 'num_failed', str(user.get('num_failed', 0)))
# Write out the last seent time
if 'last_seen' in user:
- last_seen_file = user_dir + '/last_seen.mk'
- create_user_file(last_seen_file, 'w').write(repr(user['last_seen']) + '\n')
+ save_custom_attr(id, 'last_seen', repr(user['last_seen']))
# Remove settings directories of non-existant users.
# Beware: we removed this since it leads to violent destructions
Module: check_mk
Branch: master
Commit: 1973e8ad61b8c7e8eb1b30ad4b3e2b86c44a5a9b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1973e8ad61b8c7…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 11 08:39:01 2013 +0100
FIX Changed sidebar reload interval to be more random
The sidebar is refreshed every 30 seconds. In the past, the
sidebar has been refreshed at the 0th and 30th second of a
minute. With many users, there occured load peaks during
sidebar refresh. This changes the reload to be more random.
---
.werks/203 | 11 +++++++++++
ChangeLog | 1 +
2 files changed, 12 insertions(+)
diff --git a/.werks/203 b/.werks/203
new file mode 100644
index 0000000..bc06b38
--- /dev/null
+++ b/.werks/203
@@ -0,0 +1,11 @@
+Title: Changed sidebar reload interval to be more random
+Level: 1
+Component: multisite
+Version: 1.2.3i7
+Date: 1384155428
+Class: fix
+
+The sidebar is refreshed every 30 seconds. In the past, the
+sidebar has been refreshed at the 0th and 30th second of a
+minute. With many users, there occured load peaks during
+sidebar refresh. This changes the reload to be more random.
diff --git a/ChangeLog b/ChangeLog
index aefd5d7..22dfc1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,7 @@
* 0045 FIX: LDAP: Fixed error when synchronizing non nested groups to roles
* 0046 FIX: Allowing "-" chars in var names again...
* 0049 FIX: Fixed check-mk-automation call on each new created apache thread...
+ * 0203 FIX: Changed sidebar reload interval to be more random...
WATO:
* 0053 New rule for configuring the display_name of a service...
Module: check_mk
Branch: master
Commit: d19d616b50afd4972947496b790fd5c4e6863217
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d19d616b50afd4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Nov 8 14:39:10 2013 +0100
FIX Fixed check-mk-automation call on each new created apache thread
Especially for large installation, with a lot of active users, this
could really lead into performance problems
---
.werks/49 | 9 +++++++++
ChangeLog | 3 ++-
web/plugins/wato/check_mk_configuration.py | 4 ++--
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/.werks/49 b/.werks/49
new file mode 100644
index 0000000..d06b2f0
--- /dev/null
+++ b/.werks/49
@@ -0,0 +1,9 @@
+Title: Fixed check-mk-automation call on each new created apache thread
+Level: 1
+Component: multisite
+Version: 1.2.3i7
+Date: 1383917888
+Class: fix
+
+Especially for large installation, with a lot of active users, this
+could really lead into performance problems
diff --git a/ChangeLog b/ChangeLog
index 83964bd..6c7c4a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,10 +18,11 @@
* 0044 FIX: LDAP: Fixed error with empty groups during non nested group sync...
* 0045 FIX: LDAP: Fixed error when synchronizing non nested groups to roles
* 0046 FIX: Allowing "-" chars in var names again...
+ * 0049 FIX: Fixed check-mk-automation call on each new created apache thread...
WATO:
* 0053 New rule for configuring the display_name of a service...
- * 0048 FIX: Fixed locking issue on host diagnose page...
+ * 0048 FIX: Fixed locking issue on host diagnose page
Reporting & Availability:
* 0051 Option for showing timeline directly in availability table...
diff --git a/web/plugins/wato/check_mk_configuration.py b/web/plugins/wato/check_mk_configuration.py
index f769830..819720a 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -1493,7 +1493,7 @@ def get_snmp_checktypes():
types = [ (cn, (c['title'] != cn and '%s: ' % cn or '') + c['title'])
for (cn, c) in checks.items() if c['snmp'] ]
types.sort()
- return types
+ return [ (None, _('All SNMP Checks')) ] + types
register_rule(group,
"snmp_check_interval",
@@ -1505,7 +1505,7 @@ register_rule(group,
elements = [
DropdownChoice(
title = _("Checktype"),
- choices = [ (None, _('All SNMP Checks')) ] + get_snmp_checktypes(),
+ choices = get_snmp_checktypes,
),
Integer(
title = _("Do check every"),