Module: check_mk
Branch: master
Commit: a4443cd72ef6bff7af26ba3126ae327cb73e4d7b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a4443cd72ef6bf…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jul 3 11:02:27 2014 +0200
Rule based notifications: allow matching on host groups
In the rule based notifications you can now use host group membership
for matching. It is allowed to select severel groups at once, one of
which the host must be member of.
---
.werks/1042 | 10 ++++++++++
ChangeLog | 3 +++
check_mk_templates.cfg | 1 +
modules/notify.py | 22 ++++++++++++++++++++++
web/htdocs/valuespec.py | 4 ++++
web/htdocs/wato.py | 25 ++++++++++++++++++++-----
6 files changed, 60 insertions(+), 5 deletions(-)
diff --git a/.werks/1042 b/.werks/1042
new file mode 100644
index 0000000..1ab41e6
--- /dev/null
+++ b/.werks/1042
@@ -0,0 +1,10 @@
+Title: Rule based notifications: allow matching on host groups
+Level: 2
+Component: notifications
+Version: 1.2.5i5
+Date: 1404378080
+Class: feature
+
+In the rule based notifications you can now use host group membership
+for matching. It is allowed to select severel groups at once, one of
+which the host must be member of.
diff --git a/ChangeLog b/ChangeLog
index 0d6e465..0f2e3e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -42,6 +42,9 @@
* 0947 FIX: WATO snapshots: fixed missing files on restoring nagvis backup domains
* 0826 FIX: Fixed problem where user access times were not updated correctly
+ Notifications:
+ * 1042 Rule based notifications: allow matching on host groups...
+
Reporting & Availability:
* 0991 FIX: Availability: optionally show time stamps as UNIX epoch time...
diff --git a/check_mk_templates.cfg b/check_mk_templates.cfg
index 406fc57..117cd50 100644
--- a/check_mk_templates.cfg
+++ b/check_mk_templates.cfg
@@ -395,6 +395,7 @@ define command {
NOTIFY_NOTIFICATIONAUTHOR='$NOTIFICATIONAUTHOR$' \
NOTIFY_NOTIFICATIONAUTHORNAME='$NOTIFICATIONAUTHORNAME$' \
NOTIFY_NOTIFICATIONAUTHORALIAS='$NOTIFICATIONAUTHORALIAS$' \
+ NOTIFY_HOSTGROUPNAMES='$HOSTGROUPNAMES$' \
NOTIFY_HOSTTAGS='$_HOSTTAGS$' \
NOTIFY_HOST_SL='$_HOSTEC_SL$' \
NOTIFY_SVC_SL='$_SERVICEEC_SL$' \
diff --git a/modules/notify.py b/modules/notify.py
index b39c8da..d9db00e 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -617,6 +617,7 @@ def rbn_match_rule(rule, context):
return \
rbn_match_folder(rule, context) or \
rbn_match_hosttags(rule, context) or \
+ rbn_match_hostgroups(rule, context) or \
rbn_match_hosts(rule, context) or \
rbn_match_exclude_hosts(rule, context) or \
rbn_match_services(rule, context) or \
@@ -662,6 +663,27 @@ def rbn_match_hosttags(rule, context):
"|".join(tags), "|".join(required))
+def rbn_match_hostgroups(rule, context):
+ required_groups = rule.get("match_hostgroups")
+ if required_groups != None:
+ hgn = context.get("HOSTGROUPNAMES")
+ if hgn == None:
+ return "No information about host groups is in the context, but host " \
+ "must be in group %s" % ( " or ".join(required_groups))
+ if hgn:
+ hostgroups = hgn.split(",")
+ else:
+ return "The host is in no group, but %s is required" % (
+ " or ".join(required_groups))
+
+ for group in required_groups:
+ if group in hostgroups:
+ return
+
+ return "The host only is the groups %s, but %s is required" % (
+ hgn, " or ".join(required_groups))
+
+
def rbn_match_hosts(rule, context):
if "match_hosts" in rule:
hostlist = rule["match_hosts"]
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index c3997b5..cbd72f5 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -1372,6 +1372,10 @@ class DualListChoice(ListChoice):
def render_input(self, varprefix, value):
self.load_elements()
+ if not self._elements:
+ html.write(_("There are no elements for selection."))
+ return
+
selected = []
unselected = []
if self._custom_order:
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index d8ac8ca..4fb4a60 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -8057,6 +8057,17 @@ def FolderChoice(**kwargs):
return DropdownChoice(**kwargs)
+class HostgroupChoice(DualListChoice):
+ def __init__(self, **kwargs):
+ DualListChoice.__init__(self, **kwargs)
+ self._choices = lambda: self.load_groups()
+
+ def load_groups(self):
+ all_groups = userdb.load_group_information()
+ this_group = all_groups.get("host", {})
+ return [ (k, t and t or k) for (k, t) in this_group.items() ]
+
+
def vs_notification_bulkby():
return ListChoice(
title = _("Create separate notification bulks based on"),
@@ -8193,6 +8204,13 @@ def vs_notification_rule(userid = None):
HostTagCondition(
title = _("Match Host Tags"))
),
+ ( "match_hostgroups",
+ HostgroupChoice(
+ title = _("Match Host Groups"),
+ help = _("The host must be in one of the selected host groups"),
+ allow_empty = False,
+ )
+ ),
( "match_hosts",
ListOfStrings(
title = _("Match only the following hosts"),
@@ -8423,7 +8441,7 @@ def vs_notification_rule(userid = None):
),
],
- optional_keys = [ "match_folder", "match_hosttags", "match_hosts", "match_exclude_hosts",
+ optional_keys = [ "match_folder", "match_hosttags", "match_hostgroups", "match_hosts", "match_exclude_hosts",
"match_services", "match_exclude_services", "match_plugin_output",
"match_timeperiod", "match_escalation", "match_escalation_throttle",
"match_sl", "match_host_event", "match_service_event",
@@ -8433,7 +8451,7 @@ def vs_notification_rule(userid = None):
( _("Notification Method"), [ "notify_plugin", "notify_method", "bulk" ] ),]
+ contact_headers
+ [
- ( _("Conditions"), [ "match_folder", "match_hosttags", "match_hosts", "match_exclude_hosts",
+ ( _("Conditions"), [ "match_folder", "match_hosttags", "match_hostgroups", "match_hosts", "match_exclude_hosts",
"match_services", "match_exclude_services", "match_plugin_output",
"match_checktype", "match_timeperiod",
"match_escalation", "match_escalation_throttle",
@@ -15791,8 +15809,6 @@ class HostTagCondition(ValueSpec):
raise MKUserError(varprefix, _("The list of host tags must only contain strings "
"but also contains %r") % x)
-
-
def validate_value(self, value, varprefix):
pass
@@ -15800,7 +15816,6 @@ class HostTagCondition(ValueSpec):
-
# We need to replace the BI constants internally with something
# that we can replace back after writing the BI-Rules out
# with pprint.pformat
Module: check_mk
Branch: master
Commit: f9c0fea8cf6d7abf033801b7b4d357353a8b8c7d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f9c0fea8cf6d7a…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Jul 2 18:08:13 2014 +0200
First steps in Wato global configuration cleanup
---
web/plugins/wato/check_mk_configuration.py | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/web/plugins/wato/check_mk_configuration.py b/web/plugins/wato/check_mk_configuration.py
index 4a0aaac..b7ea47e 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -25,6 +25,7 @@
# Boston, MA 02110-1301 USA.
+deprecated = _("Deprecated")
# .--Global Settings-----------------------------------------------------.
# | ____ _ _ _ ____ _ _ _ |
# | / ___| | ___ | |__ __ _| | / ___| ___| |_| |_(_)_ __ __ _ ___ |
@@ -1304,7 +1305,7 @@ register_configvar(group,
"option. This will retain the old service descriptions and the old "
"performance data.")))
-register_configvar(group,
+register_configvar(deprecated,
"if_inventory_uses_description",
Checkbox(title = _("Use description as service name for network interface checks"),
label = _("use description"),
@@ -1312,7 +1313,7 @@ register_configvar(group,
"of the port number. If no description is available then the port number is "
"used anyway.")))
-register_configvar(group,
+register_configvar(deprecated,
"if_inventory_uses_alias",
Checkbox(title = _("Use alias as service name for network interface checks"),
label = _("use alias"),
@@ -1320,14 +1321,14 @@ register_configvar(group,
"of the port number. If no alias is available then the port number is used "
"anyway.")))
-register_configvar(group,
+register_configvar(deprecated,
"if_inventory_portstates",
ListChoice(title = _("Network interface port states to inventorize"),
help = _("When doing inventory on switches or other devices with network interfaces "
"then only ports found in one of the configured port states will be added to the monitoring."),
choices = _if_portstate_choices))
-register_configvar(group,
+register_configvar(deprecated,
"if_inventory_porttypes",
ListChoice(title = _("Network interface port types to inventorize"),
help = _("When doing inventory on switches or other devices with network interfaces "
@@ -1335,7 +1336,7 @@ register_configvar(group,
choices = _if_porttype_choices,
columns = 3))
-register_configvar(group,
+register_configvar(deprecated,
"diskstat_inventory_mode",
DropdownChoice(
title = _("Inventory mode for disk IO checks"),
@@ -1365,7 +1366,7 @@ register_configvar(group,
group = _("Check configuration")
-register_configvar(group,
+register_configvar(deprecated,
"if_inventory_monitor_state",
Checkbox(title = _("Monitor port state of network interfaces"),
label = _("monitor port state"),
@@ -1376,7 +1377,7 @@ register_configvar(group,
"by overridden on a per-host and per-port base by defining special check "
"parameters via a rule.")))
-register_configvar(group,
+register_configvar(deprecated,
"if_inventory_monitor_speed",
Checkbox(title = _("Monitor port speed of network interfaces"),
label = _("monitor port speed"),
@@ -1420,7 +1421,7 @@ register_configvar(group,
),
)
-register_configvar(group,
+register_configvar(deprecated,
"printer_supply_default_levels",
Tuple(
title = _("Printer supply default levels"),
Module: check_mk
Branch: master
Commit: 1ae3f62efd6dcfd04c1f4ae20fc6f78fd725c046
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1ae3f62efd6dcf…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jul 2 16:04:34 2014 +0200
aix_memory: new check for RAM and SWAP on AIX
---
.werks/1041 | 8 +++
ChangeLog | 5 +-
agents/check_mk_agent.aix | 3 +-
checkman/aix_memory | 39 ++++++++++++++
checkman/mem.used | 2 +-
checks/aix_memory | 94 +++++++++++++++++++++++++++++++++
pnp-templates/check_mk-aix_memory.php | 1 +
web/plugins/perfometer/check_mk.py | 1 +
8 files changed, 149 insertions(+), 4 deletions(-)
diff --git a/.werks/1041 b/.werks/1041
new file mode 100644
index 0000000..6cc46cd
--- /dev/null
+++ b/.werks/1041
@@ -0,0 +1,8 @@
+Title: aix_memory: new check for RAM and SWAP on AIX
+Level: 2
+Component: checks
+Version: 1.2.5i5
+Date: 1404309861
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index dfa3ed5..561e058 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,7 +4,7 @@
NOTE: Please refer to the migration notes!
* 1038 Massive speedup of cmk --snmptranslate
* 1035 FIX: Do not fail on errors in *.mk files anymore - except in interactive mode...
- * 0174 FIX: FIX: Fixed appending of --keepalive-fd parameters to checkhelps...
+ * 0174 FIX: Fixed appending of --keepalive-fd parameters to checkhelpers...
Checks & Agents:
* 0168 f5_bigip_pool: Added Wato configuration...
@@ -12,9 +12,10 @@
* 0169 websphere_mq_channels,ebsphere_mq_queues: New Checks to monitor IBM Websphere MQ Queues and Channels...
* 1034 Always provide also 64 bit version of Windows agent
* 0170 hp_proliant_power: New check to monitor the Power Meter on Prolaint Servers and iLO Boards
- * 0997 New checks and an special agent for ALLNET IP Sensoric devices...
* 0172 zfsget: Check is now usable in cluster_mode...
* 1039 aix_diskiod: new check for disk IO on AIX
+ * 0997 New checks and an special agent for ALLNET IP Sensoric devices...
+ * 1041 aix_memory: new check for RAM and SWAP on AIX
* 0994 FIX: agent plugin smart: fixed syntax error
* 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
* 0943 FIX: if.include: fixed incorrect traffic percentage values in the check output of if checks...
diff --git a/agents/check_mk_agent.aix b/agents/check_mk_agent.aix
index 401b858..b6f97ca 100755
--- a/agents/check_mk_agent.aix
+++ b/agents/check_mk_agent.aix
@@ -74,7 +74,8 @@ echo '<<<aix_diskiod>>>'
iostat -d | tr -s ' ' | grep hdisk
echo '<<<aix_memory>>>'
-vmstat -v | tr -s ' ' | cut -d " " -f 2
+vmstat -v | tr -s ' '
+swap -s
echo '<<<mpstat_aix>>>'
mpstat -a | tail -n1
diff --git a/checkman/aix_memory b/checkman/aix_memory
new file mode 100644
index 0000000..6297d00
--- /dev/null
+++ b/checkman/aix_memory
@@ -0,0 +1,39 @@
+title: Usage of physical and virtual RAM
+agents: aix
+catalog: os/kernel
+license: GPL
+distribution: check_mk
+description:
+ This check measures the current usage of physical RAM and
+ virtual memory used by processes on AIX. You can define a warning
+ and critical level for the usage of virtual memory,
+ {not} for the usage of RAM.
+
+ This check uses the same logic as {mem.used} - the memory check
+ for Linux. Please see details there.
+
+inventory:
+ One check is created if a non-empty {<<<aix_memory>>>} section is
+ present in the agent output.
+
+perfdata:
+ Three variables are stored: the physical RAM,
+ the used swap space and the sum of both. Maximum
+ values for both variables are also transmitted, so that
+ they can be visualized. All values are in Megabytes (1024 * 1024 bytes).
+
+ The template for PNP4Nagios that is shipped with Check_MK
+ stacks swap usage on top of RAM usage und thus shows
+ the amount of virtual RAM that is used by processes.
+
+[parameters]
+parameters (dict):
+ {"levels"}: A pair of two int or float values: if these are
+ float it means the the percentage of virtual memory used
+ by processes at which WARNING/CRIT state is triggered. If the
+ two numbers are defined as an integer value then they are interpreted
+ as an absolute value in megabytes.
+
+ {"average"}: This key is optional. If set (integer), it means
+ a number of minutes. The levels are then applied to the
+ averaged value over that time horizon.
diff --git a/checkman/mem.used b/checkman/mem.used
index 9d469fd..0284cc5 100644
--- a/checkman/mem.used
+++ b/checkman/mem.used
@@ -71,7 +71,7 @@ perfdata:
If averaging is turned on, then a value {memusedavg} is added.
[parameters]
-parameters (dict): The check previous used a pair of
+parameters (dict): The check previously used a pair of
two numbers as a parameter. While this is internally still
supported, the new format is a dictionary with the following
keys:
diff --git a/checks/aix_memory b/checks/aix_memory
new file mode 100644
index 0000000..78e8412
--- /dev/null
+++ b/checks/aix_memory
@@ -0,0 +1,94 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA
+
+# Example output from agent:
+# <<<aix_memory>>>
+# 32702464 memory pages
+# 31736528 lruable pages
+# 858141 free pages
+# 4 memory pools
+# 6821312 pinned pages
+# 80.0 maxpin percentage
+# 3.0 minperm percentage
+# 90.0 maxperm percentage
+# 8.8 numperm percentage
+# 2808524 file pages
+# 0.0 compressed percentage
+# 0 compressed pages
+# 8.8 numclient percentage
+# 90.0 maxclient percentage
+# 2808524 client pages
+# 0 remote pageouts scheduled
+# 354 pending disk I/Os blocked with no pbuf
+# 860832 paging space I/Os blocked with no psbuf
+# 2228 filesystem I/Os blocked with no fsbuf
+# 508 client filesystem I/Os blocked with no fsbuf
+# 1372 external pager filesystem I/Os blocked with no fsbuf
+# 88.8 percentage of memory used for computational pages
+# allocated = 8257536 blocks used = 1820821 blocks free = 6436715 blocks
+#
+# The first part is the output of vmstat -v, the last line is the output
+# of swap -s and show the swap space usage
+
+# Parse AIX vmstat output into something compatible with the Linux
+# output from /proc/meminfo. AIX speaks of 4k pages while Linux of kilobytes.
+def parse_aix_memory(info):
+ parsed = {}
+ for line in info:
+ if line[0] == "allocated": # Swap space
+ parsed["SwapTotal"] = int(line[2]) * 4
+ parsed["SwapFree"] = int(line[10]) * 4
+ else:
+ varname = " ".join(line[1:])
+ if varname == "memory pages":
+ parsed["MemTotal"] = int(line[0]) * 4
+ elif varname == "free pages":
+ parsed["MemFree"] = int(line[0]) * 4
+ elif varname == "file pages":
+ parsed["Cached"] = int(line[0]) * 4
+ return parsed
+
+
+def check_aix_memory(_no_item, params, info):
+ meminfo = parse_aix_memory(info)
+ return check_memory(params, meminfo)
+
+
+def inventory_aix_memory(info):
+ meminfo = parse_aix_memory(info)
+ if "MemFree" in meminfo:
+ return [(None, {})]
+
+
+check_info['aix_memory'] = {
+ "check_function" : check_aix_memory,
+ "inventory_function" : inventory_aix_memory,
+ "service_description" : "Memory used",
+ "has_perfdata" : True,
+ "group" : "memory",
+ "default_levels_variable" : "memory_default_levels",
+ "includes" : [ "mem.include" ],
+}
diff --git a/pnp-templates/check_mk-aix_memory.php b/pnp-templates/check_mk-aix_memory.php
new file mode 120000
index 0000000..0a74994
--- /dev/null
+++ b/pnp-templates/check_mk-aix_memory.php
@@ -0,0 +1 @@
+check_mk-mem.used.php
\ No newline at end of file
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 549eaa2..ce4958c 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -206,6 +206,7 @@ def perfometer_check_mk_mem_used(row, check_command, perf_data):
return "%d%%" % (100 * (virt_used / ram_total)), h
perfometers["check_mk-mem.used"] = perfometer_check_mk_mem_used
+perfometers["check_mk-aix_memory"] = perfometer_check_mk_mem_used
perfometers["check_mk-hr_mem"] = perfometer_check_mk_mem_used
def perfometer_check_mk_mem_win(row, check_command, perf_data):
Module: check_mk
Branch: master
Commit: 3adcbc97de3464b44b2e8faa37c4d3d02d33d52d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3adcbc97de3464…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jul 2 16:06:00 2014 +0200
Fixed typo in werk
---
.werks/997 | 2 +-
ChangeLog | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.werks/997 b/.werks/997
index a642269..89275b2 100644
--- a/.werks/997
+++ b/.werks/997
@@ -1,4 +1,4 @@
-Title: New checks and an special agent for ALLNET IP Sensoric devices
+Title: New checks and a special agent for ALLNET IP Sensoric devices
Level: 2
Component: checks
Version: 1.2.5i5
diff --git a/ChangeLog b/ChangeLog
index 9e5b0e1..0d6e465 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,7 +14,7 @@
* 0170 hp_proliant_power: New check to monitor the Power Meter on Prolaint Servers and iLO Boards
* 0172 zfsget: Check is now usable in cluster_mode...
* 1039 aix_diskiod: new check for disk IO on AIX
- * 0997 New checks and an special agent for ALLNET IP Sensoric devices...
+ * 0997 New checks and a special agent for ALLNET IP Sensoric devices...
* 0175 logwatch.groups: New logwatch subcheck who can be used to group logfiles together....
* 1041 aix_memory: new check for RAM and SWAP on AIX
* 0994 FIX: agent plugin smart: fixed syntax error
Module: check_mk
Branch: master
Commit: 6a069acf5b7e13e1bf677513f23621e26407b7f7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6a069acf5b7e13…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Jul 2 15:56:10 2014 +0200
quicksearch: now able to search for multiple hosts at once
In the quicksearch snapin you can now enter the following syntax
C+:
h:firsthost h:otherhost h:testhost
C-:
The quicksearch dropdown will show the matches for the given names (case insensitive, no exact match).
If you want an exact hostname match you need to finish the name with $.<br>
When you press enter a host search formular will show up with the hosts given in the quicksearch field.<br>
The feature also works with host ip addresses<br>
In the quicksearch dropdown you can mix hostnames and ipaddresses - they will both show up in the dropdown.
However, the search formular is only able to display either one or the other.
---
.werks/949 | 21 +++++++++++++++++++++
ChangeLog | 3 ++-
web/plugins/sidebar/search.py | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/.werks/949 b/.werks/949
new file mode 100644
index 0000000..9e0c832
--- /dev/null
+++ b/.werks/949
@@ -0,0 +1,21 @@
+Title: quicksearch: now able to search for multiple hosts at once
+Level: 1
+Component: multisite
+Version: 1.2.5i5
+Date: 1404308868
+Class: feature
+
+In the quicksearch snapin you can now enter the following syntax
+C+:
+h:firsthost h:otherhost h:testhost
+C-:
+
+The quicksearch dropdown will show the matches for the given names (case insensitive, no exact match).
+If you want an exact hostname match you need to finish the name with $.<br>
+
+When you press enter a host search formular will show up with the hosts given in the quicksearch field.<br>
+The feature also works with host ip addresses<br>
+
+In the quicksearch dropdown you can mix hostnames and ipaddresses - they will both show up in the dropdown.
+However, the search formular is only able to display either one or the other.
+
diff --git a/ChangeLog b/ChangeLog
index 2dc1629..56a49f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,7 +15,7 @@
* 0172 zfsget: Check is now usable in cluster_mode...
* 1039 aix_diskiod: new check for disk IO on AIX
* 0997 New checks and an special agent for ALLNET IP Sensoric devices...
- * 0175 logwatch.groups: New logwatch subcheck who can be used to group logfiles together.
+ * 0175 logwatch.groups: New logwatch subcheck who can be used to group logfiles together....
* 0994 FIX: agent plugin smart: fixed syntax error
* 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
* 0943 FIX: if.include: fixed incorrect traffic percentage values in the check output of if checks...
@@ -30,6 +30,7 @@
Multisite:
* 1013 Sort host names naturally, e.g. foobar11 comes after foobar2...
* 1033 New Mutisite filter for the number of services a host has...
+ * 0949 quicksearch: now able to search for multiple hosts at once...
* 0945 FIX: Sidebar snapin "Problem hosts": Now excludes hosts and services in downtime
* 1036 FIX: doc/treasures/downtime: fix --url option, better error output
diff --git a/web/plugins/sidebar/search.py b/web/plugins/sidebar/search.py
index c9ca971..5590f46 100644
--- a/web/plugins/sidebar/search.py
+++ b/web/plugins/sidebar/search.py
@@ -164,6 +164,19 @@ search_plugins.append({
'match_url_tmpl' : 'view.py?view_name=searchhost&hostalias=%(search)s&filled_in=filter'
})
+def search_hosts_filter(filters, host_is_ip = False):
+ lq_filter = ""
+ filter_template = host_is_ip and "Filter: host_address ~~ %s\n" or "Filter: host_name ~~ %s\n"
+ for name, value in filters:
+ lq_filter += filter_template % value
+ if len(filters) > 1:
+ lq_filter += 'Or: %d\n' % len(filters)
+
+ return lq_filter
+
+def search_hosts_url_tmpl(used_filters, data, host_is_ip = False):
+ filter_field = host_is_ip and "host_address=(%s)" or "host=(%s)" % "|".join(map(lambda x: x[1], used_filters))
+ return 'view.py?view_name=searchhost&filled_in=filter&' + filter_field
def search_host_service_filter(filters, host_is_ip = False):
def get_filters(filter_type):
@@ -262,3 +275,25 @@ search_plugins.append({
"match_url_tmpl_func" : lambda x,y: match_host_service_url_tmpl(x, y, host_is_ip = True),
"search_url_tmpl_func" : lambda x,y: search_host_service_url_tmpl(x, y, host_is_ip = True),
})
+
+search_plugins.append({
+ "id" : "host_multi",
+ "qs_show" : "host_name",
+ "required_types" : ["hosts"],
+ "lq_table" : "hosts",
+ "lq_columns" : ["host_name", "host_address"],
+ "filter_func" : lambda x: search_hosts_filter(x),
+ "match_url_tmpl_func" : lambda x,y: "view.py?view_name=host&host=%(host_name)s&site=%(site)s" % y,
+ "search_url_tmpl_func" : lambda x,y: search_hosts_url_tmpl(x, y),
+})
+
+search_plugins.append({
+ "id" : "host_multi_address",
+ "qs_show" : "host_address",
+ "required_types" : ["hosts"],
+ "lq_table" : "hosts",
+ "lq_columns" : ["host_address", "host_name"],
+ "filter_func" : lambda x: search_hosts_filter(x, True),
+ "match_url_tmpl_func" : lambda x,y: "view.py?view_name=host&host_address=%(host_address)s&site=%(site)s" % y,
+ "search_url_tmpl_func" : lambda x,y: search_hosts_url_tmpl(x, y, True),
+})
Module: check_mk
Branch: master
Commit: f41c5c27333b0ef021e02fa01010fc4c4cfa2ade
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f41c5c27333b0e…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Jul 2 14:58:55 2014 +0200
typos
---
.werks/175 | 2 ++
checkman/logwatch.groups | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/.werks/175 b/.werks/175
index 39710f0..56bd00c 100644
--- a/.werks/175
+++ b/.werks/175
@@ -5,4 +5,6 @@ Version: 1.2.5i5
Date: 1404305698
Class: feature
+This check is used to group multiple logfiles together. This is usefull in cases when a logrotation mechanism is used,
+with no permanent name for the current logfile.
diff --git a/checkman/logwatch.groups b/checkman/logwatch.groups
index 4422ab8..dc508de 100644
--- a/checkman/logwatch.groups
+++ b/checkman/logwatch.groups
@@ -4,8 +4,8 @@ catalog: os/files
license: GPL
distribution: check_mk
description:
- This check is used to group multiple logfiles together. This is for example usefall in cases
- when a logrotation mechanism is in use, but there is no permanent name for the current logfile.
+ This check is used to group multiple logfiles together. This is usefull in cases when a logrotation mechanism is used,
+ with no permanent name for the current logfile.
Please refer to to manpage of {{logwatch}} for more details about logfile monitoring.