Module: check_mk
Branch: master
Commit: b361fb7c7154565b93480b1b2b4ca82ce41bb5a7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b361fb7c715456…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Nov 12 10:58:54 2013 +0100
fileinfo.groups: Added minimum/maximum file size parameters
It is now possible to configure thresholds for the minimum and maximum
file size of all files found with a file grouping pattern.
---
.werks/208 | 9 +++++++++
ChangeLog | 1 +
checkman/fileinfo.groups | 16 +++++++++++++++
checks/fileinfo | 26 +++++++++++++++++++-----
web/plugins/wato/check_parameters.py | 36 ++++++++++++++++++++++++++++++++++
5 files changed, 83 insertions(+), 5 deletions(-)
diff --git a/.werks/208 b/.werks/208
new file mode 100644
index 0000000..f1eb56b
--- /dev/null
+++ b/.werks/208
@@ -0,0 +1,9 @@
+Title: fileinfo.groups: Added minimum/maximum file size parameters
+Level: 1
+Component: checks
+Version: 1.2.3i7
+Date: 1384250251
+Class: feature
+
+It is now possible to configure thresholds for the minimum and maximum
+file size of all files found with a file grouping pattern.
diff --git a/ChangeLog b/ChangeLog
index c68d710..e883fd5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@
* 0080 Added new checks for Brocade NetIron MLX switching / routing devices...
* 0091 apc_ats_output: new check for output measurements on APC ATS devices
* 0068 check_sql: support for mssql databases included
+ * 0208 fileinfo.groups: Added minimum/maximum file size parameters...
* 0024 FIX: cisco_wlc: removed configuration parameter ap_model
* 0065 FIX: veeam_client: check behaviour improved when backup is in progress
* 0066 FIX: veeam_jobs: check behaviour improved when backup is in progress
diff --git a/checkman/fileinfo.groups b/checkman/fileinfo.groups
index 5aa6d11..1c4eea8 100644
--- a/checkman/fileinfo.groups
+++ b/checkman/fileinfo.groups
@@ -37,6 +37,10 @@ examples:
"maxage_oldest": (100, 120),
"minage_newest": (10, 20),
"maxage_newest": (30, 40),
+ "minsize_largest": (2048, 1024),
+ "maxsize_largest": (2048, 1024),
+ "minsize_largest": (10240, 20480),
+ "maxsize_largest": (10240, 20480),
}, ALL_HOSTS, ["File group"]),
]
@@ -74,6 +78,18 @@ parameters (dict): This check uses dictionary based
{"maxage_newest"}: Pair of integers for the maximum file
age in seconds for the newest file found with file group pattern.
+ {"minsize_smallest"}: Pair of integers for the minimum file
+ size in bytes for the smallest file found with the file group pattern.
+
+ {"maxsize_smallest"}: Pair of integers for the maximum file
+ size in bytes for the smallest file found with the file group pattern.
+
+ {"minsize_largest"}: Pair of integers for the minimum file
+ size in bytes for the largest file found with the file group pattern.
+
+ {"maxsize_largest"}: Pair of integers for the maximum file
+ size in bytes for the largest file found with the file group pattern.
+
{"minsize"}: The minimum size for the aggregation of all files in bytes (pair of
integers).
diff --git a/checks/fileinfo b/checks/fileinfo
index 5aa9008..023ff92 100644
--- a/checks/fileinfo
+++ b/checks/fileinfo
@@ -121,11 +121,20 @@ def check_fileinfo_groups(item, params, info):
age_oldest = None
age_newest = 0
size_all = 0
+ size_smallest = None
+ size_largest = 0
# Start counting all values
for line in info[1:]:
for pattern in params['precompiled_patterns']:
if fnmatch.fnmatch(line[0], pattern) and str(line[1]) != 'missing':
- size_all += int(line[1])
+ size = int(line[1])
+ size_all += size
+ if size_smallest == None:
+ size_smallest = size
+ else:
+ size_smallest = min(size_smallest, size)
+ size_largest = max(size_largest, size)
+
age = reftime - int(line[2])
if age_oldest == None: # very first match
age_oldest = age
@@ -133,6 +142,7 @@ def check_fileinfo_groups(item, params, info):
else:
age_oldest = max(age_oldest, age)
age_newest = min(age_newest, age)
+
count_all += 1
if age_oldest == None:
@@ -140,10 +150,16 @@ def check_fileinfo_groups(item, params, info):
# Start Checking
check_definition = [
- ("age_oldest", age_oldest, get_age_human_readable),
- ("age_newest", age_newest, get_age_human_readable),
- ("count", count_all, saveint),
- ("size", size_all, get_filesize_human_readable)]
+ ("age_oldest", age_oldest, get_age_human_readable),
+ ("age_newest", age_newest, get_age_human_readable),
+ ("count", count_all, saveint),
+ ("size", size_all, get_filesize_human_readable),
+ ]
+
+ if size_smallest is not None:
+ check_definition.append(("size_smallest", size_smallest, get_filesize_human_readable))
+ if size_largest != 0:
+ check_definition.append(("size_largest", size_largest, get_filesize_human_readable))
return fileinfo_check_function(check_definition, params)
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 5260d38..e970bc3 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -969,6 +969,42 @@ register_check_parameters(
]
)
),
+ ("minsize_smallest",
+ Tuple(
+ title = _("Minimal size of smallest file"),
+ elements = [
+ Filesize(title = _("Warning if below")),
+ Filesize(title = _("Critical if below")),
+ ]
+ )
+ ),
+ ("maxsize_smallest",
+ Tuple(
+ title = _("Maximal size of smallest file"),
+ elements = [
+ Filesize(title = _("Warning if below")),
+ Filesize(title = _("Critical if below")),
+ ]
+ )
+ ),
+ ("minsize_largest",
+ Tuple(
+ title = _("Minimal size of largest file"),
+ elements = [
+ Filesize(title = _("Warning if above")),
+ Filesize(title = _("Critical if above")),
+ ]
+ )
+ ),
+ ("maxsize_largest",
+ Tuple(
+ title = _("Maximal size of largest file"),
+ elements = [
+ Filesize(title = _("Warning if above")),
+ Filesize(title = _("Critical if above")),
+ ]
+ )
+ ),
("minsize",
Tuple(
title = _("Minimal size"),
Module: check_mk
Branch: master
Commit: 23327145ebf6c678b3e5623c93ad2780af4a7203
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=23327145ebf6c6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Nov 12 15:33:07 2013 +0100
GUI Notify: Added notify method "popup" to really create popup windows
The messages were named popups before, but were not really poups, as they were
only shown at the bottom of the sidebar as small hints. Both functions are now
available as notification methods. Popups will show up as alert windows and be
marked as read after closing the alert window and hints are only shown at the
bottom of the sidebar now.
---
.werks/211 | 12 ++++++++++++
ChangeLog | 1 +
web/htdocs/js/sidebar.js | 31 +++++++++++++++++++++++--------
web/htdocs/notify.py | 33 +++++++++++++++++++--------------
web/htdocs/sidebar.py | 22 ++++++++++++++++------
5 files changed, 71 insertions(+), 28 deletions(-)
diff --git a/.werks/211 b/.werks/211
new file mode 100644
index 0000000..1277341
--- /dev/null
+++ b/.werks/211
@@ -0,0 +1,12 @@
+Title: GUI Notify: Added notify method "popup" to really create popup windows
+Level: 1
+Component: multisite
+Version: 1.2.3i7
+Date: 1384266662
+Class: feature
+
+The messages were named popups before, but were not really poups, as they were
+only shown at the bottom of the sidebar as small hints. Both functions are now
+available as notification methods. Popups will show up as alert windows and be
+marked as read after closing the alert window and hints are only shown at the
+bottom of the sidebar now.
diff --git a/ChangeLog b/ChangeLog
index 2b823af..938f481 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,7 @@
Multisite:
* 0001 New filters for selecting several host/service-groups at once...
* 0050 New concept of favorite hosts and services plus matching filters and views...
+ * 0211 GUI Notify: Added notify method "popup" to really create popup windows...
* 0043 FIX: LDAP: Improved error reporting during synchronisation...
* 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
diff --git a/web/htdocs/js/sidebar.js b/web/htdocs/js/sidebar.js
index 71009c1..62f57d9 100644
--- a/web/htdocs/js/sidebar.js
+++ b/web/htdocs/js/sidebar.js
@@ -940,6 +940,7 @@ function handle_update_messages(_unused, code) {
var c = document.getElementById('messages');
if (c) {
c.innerHTML = code;
+ executeJSbyObject(c);
update_message_trigger();
}
}
@@ -955,12 +956,21 @@ function update_messages() {
get_url('sidebar_get_messages.py', handle_update_messages);
}
+function get_hint_messages(c) {
+ var hints;
+ if (c.getElementsByClassName)
+ hints = c.getElementsByClassName('popup_msg');
+ else
+ hints = document.getElementsByClassName('popup_msg', c);
+ return hints;
+}
+
function update_message_trigger() {
var c = document.getElementById('messages');
if (c) {
var b = document.getElementById('msg_button');
- var num = c.children.length;
- if (c.children.length > 0) {
+ var hints = get_hint_messages(c);
+ if (hints.length > 0) {
// are there pending messages? make trigger visible
b.style.display = 'inline';
@@ -972,7 +982,7 @@ function update_message_trigger() {
b.appendChild(l);
}
- l.innerHTML = '' + c.children.length;
+ l.innerHTML = '' + hints.length;
} else {
// no messages: hide the trigger
b.style.display = 'none';
@@ -980,13 +990,21 @@ function update_message_trigger() {
}
}
+function mark_message_read(msg_id) {
+ get_url('sidebar_message_read.py?id=' + msg_id);
+
+ // Update the button state
+ update_message_trigger();
+}
+
function read_message() {
var c = document.getElementById('messages');
if (!c)
return;
// extract message from teh message container
- var msg = c.children[0];
+ var hints = get_hint_messages(c);
+ var msg = hints[0];
c.removeChild(msg);
// open the next message in a window
@@ -994,10 +1012,7 @@ function read_message() {
// tell server that the message has been read
var msg_id = msg.id.replace('message-', '');
- get_url('sidebar_message_read.py?id=' + msg_id);
-
- // Update the button state
- update_message_trigger();
+ mark_message_read(msg_id);
}
function message_close(msg_id) {
diff --git a/web/htdocs/notify.py b/web/htdocs/notify.py
index 664ba9e..061c483 100644
--- a/web/htdocs/notify.py
+++ b/web/htdocs/notify.py
@@ -27,7 +27,7 @@
import config, forms, time, lib, userdb
from valuespec import *
-def get_popup_messages(user_id = None):
+def get_gui_messages(user_id = None):
if user_id is None:
user_id = config.user_id
path = config.config_dir + "/" + user_id + '/messages.mk'
@@ -47,23 +47,23 @@ def get_popup_messages(user_id = None):
updated = True
if updated:
- save_popup_messages(messages)
+ save_gui_messages(messages)
return messages
-def delete_popup_message(msg_id):
- messages = get_popup_messages()
+def delete_gui_message(msg_id):
+ messages = get_gui_messages()
for index, msg in enumerate(messages):
if msg['id'] == msg_id:
messages.pop(index)
- save_popup_messages(messages)
+ save_gui_messages(messages)
-def save_popup_messages(messages, user_id = None):
+def save_gui_messages(messages, user_id = None):
if user_id is None:
user_id = config.user_id
path = config.config_dir + "/" + user_id + '/messages.mk'
make_nagios_directory(os.path.dirname(path))
- file(path, 'w').write(repr(messages))
+ file(path, 'w').write(repr(messages) + "\n")
loaded_with_language = False
def load_plugins():
@@ -76,9 +76,13 @@ def load_plugins():
global notify_methods
notify_methods = {
- 'popup': {
- 'title': _('Popup Message in the GUI'),
- 'handler': notify_popup,
+ 'gui_popup': {
+ 'title': _('Popup Message in the GUI (shows up alert window)'),
+ 'handler': notify_gui_msg,
+ },
+ 'gui_hint': {
+ 'title': _('Send hint to message inbox (bottom of sidebar)'),
+ 'handler': notify_gui_msg,
},
}
@@ -218,7 +222,8 @@ def page_notify():
# | |___/ |___/ |
# +----------------------------------------------------------------------+
-def notify_popup(user_id, msg):
- messages = get_popup_messages(user_id)
- messages.append(msg)
- save_popup_messages(messages, user_id)
+def notify_gui_msg(user_id, msg):
+ messages = get_gui_messages(user_id)
+ if msg not in messages:
+ messages.append(msg)
+ save_gui_messages(messages, user_id)
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index 31ea29a..6322c19 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -155,17 +155,27 @@ def sidebar_head():
'</div>\n' % (_("Go to main overview"), config.start_url, defaults.check_mk_version))
def render_messages():
- for msg in notify.get_popup_messages():
- html.write('<div class="popup_msg" id="message-%s">' % msg['id'])
- html.write('<a href="javascript:void(0)" class="close" onclick="message_close(\'%s\')">x</a>' % msg['id'])
- html.write(html.attrencode(msg['text']).replace('\n', '<br />\n'))
- html.write('</div>\n')
+ for msg in notify.get_gui_messages():
+ if 'gui_hint' in msg['methods']:
+ html.write('<div class="popup_msg" id="message-%s">' % msg['id'])
+ html.write('<a href="javascript:void(0)" class="close" onclick="message_close(\'%s\')">x</a>' % msg['id'])
+ html.write(html.attrencode(msg['text']).replace('\n', '<br />\n'))
+ html.write('</div>\n')
+ if 'gui_popup' in msg['methods']:
+ html.javascript('alert(\'%s\'); mark_message_read("%s")' %
+ (html.attrencode(msg['text']).replace('\n', '\\n'), msg['id']))
def ajax_get_messages():
render_messages()
def ajax_message_read():
- notify.delete_popup_message(html.var('id'))
+ try:
+ notify.delete_gui_message(html.var('id'))
+ html.write("OK")
+ except:
+ if config.debug:
+ raise
+ html.write("ERROR")
def sidebar_foot():
html.write('<div id="side_footer">')
Module: check_mk
Branch: master
Commit: 8fdd78a2206a985a44d74d47157c3caba0502a28
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8fdd78a2206a98…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Nov 12 14:03:21 2013 +0100
FIX LDAP: Fixed problem syncing contactgroups of a user with umlauts in CN
---
.werks/210 | 8 ++++++++
ChangeLog | 1 +
web/plugins/userdb/ldap.py | 4 ++--
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/.werks/210 b/.werks/210
new file mode 100644
index 0000000..a535af8
--- /dev/null
+++ b/.werks/210
@@ -0,0 +1,8 @@
+Title: LDAP: Fixed problem syncing contactgroups of a user with umlauts in CN
+Level: 1
+Component: multisite
+Version: 1.2.3i7
+Date: 1384261370
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 6344b76..2b823af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,7 @@
* 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...
+ * 0210 FIX: LDAP: Fixed problem syncing contactgroups of a user with umlauts in CN
WATO:
* 0053 New rule for configuring the display_name of a service...
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 92f4fd5..a73ca1d 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -532,7 +532,7 @@ def ldap_group_members(filters, filt_attr = 'cn', nested = False):
for dn, obj in ldap_search(ldap_replace_macros(config.ldap_groupspec['dn']), filt, ['cn', member_attr]):
groups[dn] = {
'cn' : obj['cn'][0],
- 'members' : obj.get(member_attr, []),
+ 'members' : [ m.encode('utf-8') for m in obj[member_attr] ],
}
else:
# Nested querying is more complicated. We have no option to simply do a query for group objects
@@ -560,7 +560,7 @@ def ldap_group_members(filters, filt_attr = 'cn', nested = False):
'cn' : cn,
}
for user_dn, obj in ldap_search(ldap_replace_macros(config.ldap_userspec['dn']), filt, columns = ['dn']):
- groups[dn]['members'].append(user_dn)
+ groups[dn]['members'].append(user_dn.encode('utf-8'))
g_ldap_group_cache[cache_key] = groups
return groups
Module: check_mk
Branch: master
Commit: 5506b9a57cac1b8c67787d520f19ea7bb03562be
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5506b9a57cac1b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Nov 12 14:02:00 2013 +0100
Availability: fix case where no data is available in timeline
---
web/plugins/views/availability.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index 1773bd6..c2c29e3 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -640,6 +640,9 @@ def do_render_availability(rows, what, avoptions, timeline, timewarpcode):
need_statistics = os_aggrs and os_states
show_timeline = avoptions["show_timeline"]
grouping = avoptions["grouping"]
+ timeline_rows = [] # Need this as a global variable if just one service is affected
+ total_duration = 0
+ considered_duration = 0
# Note: in case of timeline, we have data from exacly one host/service
for site_host, site_host_entry in by_host.iteritems():
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