Module: check_mk
Branch: master
Commit: 3614736a064012ec64222ba36953f4cf475d61b8
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3614736a064012…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Nov 19 17:20:53 2014 +0100
parse_function: fixed exception when subchecks should use parsed data
---
modules/check_mk.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index f37deaf..8b1b58a 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -2926,7 +2926,7 @@ def make_inventory(checkname, hostnamelist, check_only=False, include_state=Fals
if checkname_base in check_info: # parse function must be define for base check
parse_function = check_info[checkname_base]["parse_function"]
if parse_function:
- info = check_info[checkname]["parse_function"](info)
+ info = check_info[checkname_base]["parse_function"](info)
except MKAgentError, e:
# This special handling is needed for the inventory check. It needs special
Module: check_mk
Branch: master
Commit: a8236feb565c1ced549ff10e1eb9716781367b04
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a8236feb565c1c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 19 17:17:08 2014 +0100
#1506 FIX Fixed randomly hidden dashboard title
When dashboards with title enabled and without title were opened after each other,
it could happen randomly, that the dashboard with a title was hiding the title
behind the dashlets.
---
.werks/1506 | 12 ++++++++++++
ChangeLog | 1 +
web/htdocs/dashboard.py | 5 +++--
web/plugins/dashboard/builtin.py | 3 +++
4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/.werks/1506 b/.werks/1506
new file mode 100644
index 0000000..5626eaf
--- /dev/null
+++ b/.werks/1506
@@ -0,0 +1,12 @@
+Title: Fixed randomly hidden dashboard title
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.5i7
+Date: 1416413736
+
+When dashboards with title enabled and without title were opened after each other,
+it could happen randomly, that the dashboard with a title was hiding the title
+behind the dashlets.
diff --git a/ChangeLog b/ChangeLog
index 66bd4b3..25aa3db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -56,6 +56,7 @@
* 1436 FIX: quicksearch: search with multiple patterns (h: / s:) no longer discards the host pattern...
* 1438 FIX: quicksearch: fixed various non-working quicksearch filters...
* 1501 FIX: Legacy view formats created with 2014-09 snapshots are now converted...
+ * 1506 FIX: Fixed randomly hidden dashboard title...
WATO:
* 1170 Added buttons to move rules to top/bottom of the list to ruleset edit dialog
diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index 20abdf6..77cd07c 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -47,7 +47,6 @@ MAX = -1
# These settings might go into the config module, sometime in future,
# in order to allow the user to customize this.
-header_height = 60 # Distance from top of the screen to the lower border of the heading
screen_margin = 5 # Distance from the left border of the main-frame to the dashboard area
dashlet_padding = 21, 5, 5, 0, 4 # Margin (N, E, S, W, N w/o title) between outer border of dashlet and its content
corner_overlap = 22
@@ -263,10 +262,12 @@ def render_dashboard(name):
title = visuals.visual_title('dashboard', board)
+ # Distance from top of the screen to the lower border of the heading
+ header_height = 60
+
# The title of the dashboard needs to be prefixed with the WATO path,
# in order to make it clear to the user, that he is seeing only partial
# data.
- global header_height
if not board.get('show_title'):
# Remove the whole header line
html.set_render_headfoot(False)
diff --git a/web/plugins/dashboard/builtin.py b/web/plugins/dashboard/builtin.py
index a7f6672..e486289 100644
--- a/web/plugins/dashboard/builtin.py
+++ b/web/plugins/dashboard/builtin.py
@@ -28,6 +28,7 @@ builtin_dashboards["main"] = {
"single_infos": [],
"context" : {},
"mtime" : 0,
+ "show_title" : True,
"title" : _("Main Overview"),
"topic" : _("Overview"),
"description" : _("This dashboard gives you a general overview on the state of your "
@@ -198,6 +199,7 @@ if defaults.omd_site:
"single_infos": [],
"context" : {},
"mtime" : 0,
+ "show_title" : True,
"title" : _("Network Topology"),
"topic" : _("Overview"),
"description" : _("This dashboard uses the parent relationships of your hosts to display a "
@@ -220,6 +222,7 @@ builtin_dashboards["simple_problems"] = {
"single_infos": [],
"context" : {},
"mtime" : 0,
+ "show_title" : True,
"title" : _("Host & Services Problems"),
"topic" : _("Overview"),
"description" : _("A compact dashboard which lists your unhandled host and service problems."),
Module: check_mk
Branch: master
Commit: 4922b9f49696a0c2cacdb78c722a5b02f3c25ff6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4922b9f49696a0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 19 14:20:51 2014 +0100
#1505 FIX Snapshots are now bound to the used monitoring core
Snapshots created with CMC can not be restored on sites currently
using another core and vice versa. If you need to restore a snapshot
using another core, you might switch to this core, restore the snapshot
and then switch back to your former core.
---
.werks/1505 | 13 +++++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 21 +++++++++++++++++++--
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/.werks/1505 b/.werks/1505
new file mode 100644
index 0000000..5a3edb3
--- /dev/null
+++ b/.werks/1505
@@ -0,0 +1,13 @@
+Title: Snapshots are now bound to the used monitoring core
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.5i7
+Date: 1416403159
+
+Snapshots created with CMC can not be restored on sites currently
+using another core and vice versa. If you need to restore a snapshot
+using another core, you might switch to this core, restore the snapshot
+and then switch back to your former core.
diff --git a/ChangeLog b/ChangeLog
index b43a02d..66bd4b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -68,6 +68,7 @@
* 1492 FIX: Fixed too long URL bug when deleting a timeperiod right after creating one
* 1498 FIX: Fixed displaying of global settings titles / help texts...
* 1502 FIX: Fixed removing elements from ListOf choices during complain phase
+ * 1505 FIX: Snapshots are now bound to the used monitoring core...
Notifications:
* 1512 Bulk notification can now be grouped according to custom macro values...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 432691f..c411961 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -6436,6 +6436,22 @@ def get_snapshot_status(snapshot, validate_checksums = False):
else:
raise MKGeneralException(_("Invalid snapshot (missing file: %s)") % entry)
+ def check_core():
+ if not defaults.omd_root:
+ return # Do not perform this check in non OMD environments
+ cmk_tar = cStringIO.StringIO(access_snapshot(lambda x: multitar.get_file_content(x, 'check_mk.tar.gz')))
+ files = multitar.list_tar_content(cmk_tar)
+ using_cmc = os.path.exists(defaults.omd_root + '/etc/check_mk/conf.d/microcore.mk')
+ snapshot_cmc = 'conf.d/microcore.mk' in files
+ if using_cmc and not snapshot_cmc:
+ raise MKGeneralException(_('You are currently using the Check_MK Microcore, but this snapshot does not use the '
+ 'Check_MK Microcore. If you need to migrate your data, you could consider changing '
+ 'the core, restoring the snapshot and changing the core back again.'))
+ elif not using_cmc and snapshot_cmc:
+ raise MKGeneralException(_('You are currently not using the Check_MK Microcore, but this snapshot uses the '
+ 'Check_MK Microcore. If you need to migrate your data, you could consider changing '
+ 'the core, restoring the snapshot and changing the core back again.'))
+
def snapshot_secret():
path = defaults.default_config_dir + '/snapshot.secret'
try:
@@ -6525,6 +6541,7 @@ def get_snapshot_status(snapshot, validate_checksums = False):
check_size()
check_extension()
check_content()
+ check_core()
if validate_checksums:
check_checksums()
@@ -6606,10 +6623,10 @@ def mode_snapshot_detail(phase):
html.write("<td>")
if verify_checksum:
- if values['checksum'] == True:
+ if values.get('checksum') == True:
checksum_title = _('Checksum valid and signed')
checksum_icon = ''
- elif values['checksum'] == False:
+ elif values.get('checksum') == False:
checksum_title = _('Checksum invalid and not signed')
checksum_icon = 'p'
else:
Module: check_mk
Branch: master
Commit: 18b269f2af45cd48d2284f96a20773c1521169c5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=18b269f2af45cd…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Nov 19 11:06:50 2014 +0100
Updated bug entries #2226
---
.bugs/2226 | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/.bugs/2226 b/.bugs/2226
new file mode 100644
index 0000000..7dd552e
--- /dev/null
+++ b/.bugs/2226
@@ -0,0 +1,12 @@
+Title: Remove update-alternatives stuff on Debuntu packages
+Component: core
+State: open
+Date: 2014-11-19 11:04:56
+Targetversion: 1.2.5i1
+Class: nastiness
+
+Currently the *.deb packages use the alternatives-mechanism in order to
+select the current default version and for handling the symlink of /usr/bin/omd.
+Remove this and use the same mechanism as with RPM. Our deb packages anyway
+can never adhere to the Debian package guidelines. So better make sure that
+they exactly behave like on rpm based systems.
Module: check_mk
Branch: master
Commit: 20257385f74b982a2778ddbe0a1d0dd506591853
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=20257385f74b98…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 19 10:43:26 2014 +0100
#1504 WATO makes host tag and group information available for NagVis
NagVis can now (till version 1.8rc1) handle Check_MK's host tag and tag group information.
These information can be added to the hover menus of the NagVis objects.
WATO exports the host tag and tag group definitions to a PHP file which is then read by
NagVis to gather the needed information. The PHP file is located at var/check_mk/wato/php-api/hosttags.php
in OMD environments.
---
.werks/1504 | 14 ++++++
ChangeLog | 1 +
web/htdocs/wato.py | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 137 insertions(+)
diff --git a/.werks/1504 b/.werks/1504
new file mode 100644
index 0000000..af52a89
--- /dev/null
+++ b/.werks/1504
@@ -0,0 +1,14 @@
+Title: WATO makes host tag and group information available for NagVis
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.2.5i7
+Date: 1416390031
+Class: feature
+
+NagVis can now (till version 1.8rc1) handle Check_MK's host tag and tag group information.
+These information can be added to the hover menus of the NagVis objects.
+
+WATO exports the host tag and tag group definitions to a PHP file which is then read by
+NagVis to gather the needed information. The PHP file is located at var/check_mk/wato/php-api/hosttags.php
+in OMD environments.
diff --git a/ChangeLog b/ChangeLog
index f80562c..6c2e509 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -60,6 +60,7 @@
* 1170 Added buttons to move rules to top/bottom of the list to ruleset edit dialog
* 1489 Added iCalendar import for generating timeperiods e.g. for holidays...
* 1495 Most WATO tables can now be sorted (where useful)...
+ * 1504 WATO makes host tag and group information available for NagVis...
* 1165 FIX: Fixed exception in service discovery of logwatch event console forwarding checks...
* 1490 FIX: Timperiod excludes can now even be configured when creating a timeperiod...
* 1491 FIX: Fixed bug in dynamic lists where removing an item was not always possible...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index c56d451..432691f 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -123,6 +123,7 @@ sites_mk = defaults.default_config_dir + "/multisite.d/sites.mk"
var_dir = defaults.var_dir + "/wato/"
log_dir = var_dir + "log/"
snapshot_dir = var_dir + "snapshots/"
+php_api_dir = var_dir + "php-api/"
repstatus_file = var_dir + "replication_status.mk"
@@ -13080,6 +13081,126 @@ def show_localization_hint():
html.message("<sup>*</sup>" + _("These texts may be localized depending on the users' "
"language. You can configure the localizations <a href=\"%s\">in the global settings</a>.") % url)
+def format_php(data, lvl = 1):
+ s = ''
+ if isinstance(data, tuple) or isinstance(data, list):
+ s += 'array(\n'
+ for item in data:
+ s += ' ' * lvl + format_php(item, lvl + 1) + ',\n'
+ s += ' ' * (lvl - 1) + ')'
+ elif isinstance(data, dict):
+ s += 'array(\n'
+ for key, val in data.iteritems():
+ s += ' ' * lvl + format_php(key, lvl + 1) + ' => ' + format_php(val, lvl + 1) + ',\n'
+ s += ' ' * (lvl - 1) + ')'
+ elif isinstance(data, str):
+ s += '\'%s\'' % data.replace('\'', '\\\'')
+ elif isinstance(data, unicode):
+ s += '\'%s\'' % data.encode('utf-8').replace('\'', '\\\'')
+ elif isinstance(data, bool):
+ s += data and 'true' or 'false'
+ elif data is None:
+ s += 'null'
+ else:
+ s += str(data)
+
+ return s
+
+# Creates a includable PHP file which provides some functions which
+# can be used by the calling program, for example NagVis. It declares
+# the following API:
+#
+# taggroup_title(group_id)
+# Returns the title of a WATO tag group
+#
+# taggroup_choice(group_id, list_of_object_tags)
+# Returns either
+# false: When taggroup does not exist in current config
+# null: When no choice can be found for the given taggroup
+# array(tag, title): When a tag of the taggroup
+#
+# all_taggroup_choices(object_tags):
+# Returns an array of elements which use the tag group id as key
+# and have an assiciative array as value, where 'title' contains
+# the tag group title and the value contains the value returned by
+# taggroup_choice() for this tag group.
+#
+def export_hosttags(hosttags, auxtags):
+ path = php_api_dir + '/hosttags.php'
+ make_nagios_directory(php_api_dir)
+
+ # need an extra lock file, since we move the auth.php.tmp file later
+ # to auth.php. This move is needed for not having loaded incomplete
+ # files into php.
+ tempfile = path + '.tmp'
+ lockfile = path + '.state'
+ file(lockfile, 'a')
+ aquire_lock(lockfile)
+
+ # Transform WATO internal data structures into easier usable ones
+ hosttags_dict = {}
+ for id, title, choices in hosttags:
+ tags = {}
+ for tag_id, tag_title, auxtags in choices:
+ tags[tag_id] = tag_title, auxtags
+ topic, title = parse_hosttag_title(title)
+ hosttags_dict[id] = topic, title, tags
+ auxtags_dict = dict(auxtags)
+
+ # First write a temp file and then do a move to prevent syntax errors
+ # when reading half written files during creating that new file
+ file(tempfile, 'w').write('''<?php
+// Created by WATO
+global $mk_hosttags, $mk_auxtags;
+$mk_hosttags = %s;
+$mk_auxtags = %s;
+
+function taggroup_title($group_id) {
+ global $mk_hosttags;
+ if (isset($mk_hosttags[$group_id]))
+ return $mk_hosttags[$group_id][0];
+ else
+ return $taggroup;
+}
+
+function taggroup_choice($group_id, $object_tags) {
+ global $mk_hosttags;
+ if (!isset($mk_hosttags[$group_id]))
+ return false;
+ foreach ($object_tags AS $tag) {
+ if (isset($mk_hosttags[$group_id][2][$tag])) {
+ // Found a match of the objects tags with the taggroup
+ // now return an array of the matched tag and its alias
+ return array($tag, $mk_hosttags[$group_id][2][$tag][0]);
+ }
+ }
+ // no match found. Test whether or not a "None" choice is allowed
+ if (isset($mk_hosttags[$group_id][2][null]))
+ return array(null, $mk_hosttags[$group_id][2][null][0]);
+ else
+ return null; // no match found
+}
+
+function all_taggroup_choices($object_tags) {
+ global $mk_hosttags;
+ $choices = array();
+ foreach ($mk_hosttags AS $group_id => $group) {
+ $choices[$group_id] = array(
+ 'topic' => $group[0],
+ 'title' => $group[1],
+ 'value' => taggroup_choice($group_id, $object_tags),
+ );
+ }
+ return $choices;
+}
+
+?>
+''' % (format_php(hosttags_dict), format_php(auxtags_dict)))
+ # Now really replace the destination file
+ os.rename(tempfile, path)
+ release_lock(lockfile)
+ os.unlink(lockfile)
+
# Current specification for hosttag entries: One tag definition is stored
# as tuple of at least three elements. The elements are used as follows:
# taggroup_id, group_title, list_of_choices, depends_on_tags, depends_on_roles, editable
@@ -13112,6 +13233,7 @@ def save_hosttags(hosttags, auxtags):
out.write("# Written by WATO\n# encoding: utf-8\n\n")
out.write("wato_host_tags += \\\n%s\n\n" % pprint.pformat(hosttags))
out.write("wato_aux_tags += \\\n%s\n" % pprint.pformat(auxtags))
+ export_hosttags(hosttags, auxtags)
# Handle renaming and deletion of host tags: find affected
# hosts, folders and rules. Remove or fix those rules according