Module: check_mk
Branch: master
Commit: 08367e81b68c8e87e426b6d17a1d79a9cf676cc5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=08367e81b68c8e…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Oct 10 12:30:07 2013 +0200
esx_vsphere_vm: fixed exception when memory info for vm is missing
---
ChangeLog | 1 +
checks/esx_vsphere_vm | 24 ++++++++++++++----------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0a841b6..08806d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,7 @@
* FIX: netapp_volumes: better output when volume is missing
* FIX: winperf_phydisk: handle case where not performance counters are available
* FIX: check_mk_agent.linux: limit Livestatus check to 3 seconds
+ * FIX: esx_vsphere_vm: fixed exception when memory info for vm is missing
Multisite:
* FIX: add missing service icons to view "All Services with this descr..."
diff --git a/checks/esx_vsphere_vm b/checks/esx_vsphere_vm
index 7cdd45d..8813c0f 100644
--- a/checks/esx_vsphere_vm
+++ b/checks/esx_vsphere_vm
@@ -53,16 +53,20 @@ def check_esx_vsphere_vm_mem(_no_item, _no_params, info):
if powerstate != "poweredOn":
raise MKCounterWrapped("", "VM is %s, skipping this check" % powerstate)
- #consumed host memory
- host_memory_usage = savefloat(data["summary.quickStats.hostMemoryUsage"][0]) * 1024 * 1024
- #active guest memory
- guest_memory_usage = savefloat(data["summary.quickStats.guestMemoryUsage"][0]) * 1024 * 1024
- #size of the balloon driver in the VM
- ballooned_memory = savefloat(data["summary.quickStats.balloonedMemory"][0]) * 1024 * 1024
- #The portion of memory, in MB, that is granted to this VM from non-shared host memor(musst not be set)
- shared_memory = savefloat(data["summary.quickStats.sharedMemory"][0]) * 1024 * 1024
- #The portion of memory, in MB, that is granted to this VM from host memory that is shared between VMs.
- private_memory = savefloat(data.get("summary.quickStats.privateMemory",[0])[0]) * 1024 * 1024
+
+ try:
+ #consumed host memory
+ host_memory_usage = savefloat(data["summary.quickStats.hostMemoryUsage"][0]) * 1024 * 1024
+ #active guest memory
+ guest_memory_usage = savefloat(data["summary.quickStats.guestMemoryUsage"][0]) * 1024 * 1024
+ #size of the balloon driver in the VM
+ ballooned_memory = savefloat(data["summary.quickStats.balloonedMemory"][0]) * 1024 * 1024
+ #The portion of memory, in MB, that is granted to this VM from non-shared host memor(musst not be set)
+ shared_memory = savefloat(data["summary.quickStats.sharedMemory"][0]) * 1024 * 1024
+ #The portion of memory, in MB, that is granted to this VM from host memory that is shared between VMs.
+ private_memory = savefloat(data.get("summary.quickStats.privateMemory",[0])[0]) * 1024 * 1024
+ except:
+ raise MKCounterWrapped("", "Hostsystem did not provide memory information (reason may be high load)")
perf = [
("host", host_memory_usage ),
Module: check_mk
Branch: master
Commit: 439491daaeb7bfbf96cadc981e77cec7ed9b3515
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=439491daaeb7bf…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Oct 9 23:53:15 2013 +0200
services: Windows inventory now also matches against display names
---
ChangeLog | 1 +
checks/services | 25 +++++++++++++++----------
web/plugins/wato/check_parameters.py | 5 +++--
3 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b172afd..67b71d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,7 @@
* check_icmp: New WATO rule for custom PING checks
* agent_vsphere: now able to handle < > & ' " in login credentials
* if/if64 and friends: add 95% percentiles to graphs
+ * services: inventory now also matches against display names of services
* FIX: windows_agent: fixed bug in cleanup of open thread handles
* FIX: cups default printer is now monitored again in linux agent
* FIX: host notification email in html format: fixed formating error
diff --git a/checks/services b/checks/services
index 6eb9b02..b08146f 100644
--- a/checks/services
+++ b/checks/services
@@ -67,7 +67,7 @@ inventory_services_rules = []
def inventory_windows_services(info):
# Handle single entries (type str)
- def add_matching_services(name, state, start_type, entry):
+ def add_matching_services(name, description, state, start_type, entry):
if type(entry) == tuple:
# New wato rule handling
svc = entry[0]
@@ -80,12 +80,14 @@ def inventory_windows_services(info):
svc = entry
statespec = "running"
- # First match name (optional since rule based config option available)
+ # First match name or description (optional since rule based config option available)
+ use_as_item = None
if svc:
if svc.startswith("~"):
- if not get_regex(svc[1:]).match(name):
+ r = get_regex(svc[1:])
+ if not r.match(name) and not r.match(description):
return []
- elif svc != name:
+ elif svc != name and svc != description:
return []
if type(statespec) == tuple:
@@ -102,7 +104,7 @@ def inventory_windows_services(info):
return [(name, {})]
# Handle entries like ( [ "term" ], ALL_HOSTS, [ "FooBar auto", ".*TEST running" ] )
- def add_services_with_tags(name, state, start_type, entry):
+ def add_services_with_tags(name, description, state, start_type, entry):
matching = []
if len(entry) == 2:
entry = ( [], ) + entry
@@ -110,7 +112,7 @@ def inventory_windows_services(info):
if hosttags_match_taglist(tags_of_host(g_hostname), taglist):
if in_extraconf_hostlist(hostlist, g_hostname):
for svc in svclist:
- matching += add_matching_services(name, state, start_type, svc)
+ matching += add_matching_services(name, description, state, start_type, svc)
return matching
# Filter WATO compatible rules by tags/hostlist
@@ -136,6 +138,7 @@ def inventory_windows_services(info):
inventory = []
for line in info:
name = line[1]
+ description = " ".join(line[3:])
if '/' in line[2]:
state, start_type = line[2].split('/')
else:
@@ -147,9 +150,9 @@ def inventory_windows_services(info):
#
for entry in inventory_services:
if type(entry) == str:
- inventory += add_matching_services(name, state, start_type, entry)
+ inventory += add_matching_services(name, description, state, start_type, entry)
elif type(entry) == tuple:
- inventory += add_services_with_tags(name, state, start_type, entry)
+ inventory += add_services_with_tags(name, description, tate, start_type, entry)
else:
raise MKGeneralException("Invalid entry %r in inventory_services" % entry)
@@ -158,7 +161,7 @@ def inventory_windows_services(info):
#
for rule in rules:
- inventory += add_matching_services(name, state, start_type, rule)
+ inventory += add_matching_services(name, description, state, start_type, rule)
return inventory
@@ -180,7 +183,9 @@ def check_windows_services(item, params, info):
# states
found = []
for line in info:
- if item == line[1]:
+ # allow to match agains the internal name or agains the display name
+ # of the service
+ if item == line[1] or item == " ".join(line[3:]):
# newer agents also send start type as part of state,
# e.g. running/auto
if '/' in line[2]:
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index f37416f..db0ae8f 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -107,8 +107,9 @@ register_rule(group + '/' + subgroup_inventory,
elements = [
('services', ListOfStrings(
title = _("Services (Regular Expressions)"),
- help = _('Matching the begining of the service names (regular expression). '
- 'If no service is given, this rule will match all services. The '
+ help = _('Regular expressions matching the begining of the internal name '
+ 'or the description of the service. '
+ 'If no name is given then this rule will match all services. The '
'match is done on the <i>beginning</i> of the service name. It '
'is done <i>case sensitive</i>. You can do a case insensitive match '
'by prefixing the regular expression with <tt>(?i)</tt>. Example: '
Module: check_mk
Branch: master
Commit: 13f07ef1c2dda98307b61ba599eddbeca82af898
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=13f07ef1c2dda9…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Oct 9 23:09:06 2013 +0200
Better help text for windows service inventory
---
web/plugins/wato/check_parameters.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 54f87be..f37416f 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -108,7 +108,12 @@ register_rule(group + '/' + subgroup_inventory,
('services', ListOfStrings(
title = _("Services (Regular Expressions)"),
help = _('Matching the begining of the service names (regular expression). '
- 'If no service is given, this rule will match all services.'),
+ 'If no service is given, this rule will match all services. The '
+ 'match is done on the <i>beginning</i> of the service name. It '
+ 'is done <i>case sensitive</i>. You can do a case insensitive match '
+ 'by prefixing the regular expression with <tt>(?i)</tt>. Example: '
+ '<tt>(?i).*mssql</tt> matches all services that contain <tt>MSSQL</tt> '
+ 'or <tt>MsSQL</tt> or <tt>mssql</tt> or...'),
orientation = "horizontal",
)),
('state', DropdownChoice(
Module: check_mk
Branch: master
Commit: bf4f960e97a07c67e931292892d5c51991f03052
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bf4f960e97a07c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Oct 9 22:39:32 2013 +0200
Bulk inventory: checkbox for skipping hosts where the agent is critical
---
ChangeLog | 2 ++
web/htdocs/wato.py | 28 ++++++++++++++++++++++------
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2221ff0..b172afd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -43,6 +43,8 @@
* Added title of tests to LDAP diagnose table
* Bulk inventory: new checkbox to only include hosts that have a failed
inventory check.
+ * Bulk inventory: yet another checkbox for skipping hosts where the
+ Check_MK service is currently critical
* FIX: The rule "State and count of processes" is no longer available
in "Parameters for inventorized check". This rule was solely
intented for "Manual checks" configuration
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 34d6e0e..208afaf 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -2657,9 +2657,14 @@ def mode_bulk_inventory(phase):
config.need_permission("wato.services")
if html.get_checkbox("only_failed_invcheck"):
- failed_invcheck_hosts = find_hosts_with_failed_inventory_check()
+ restrict_to_hosts = find_hosts_with_failed_inventory_check()
else:
- failed_invcheck_hosts = None
+ restrict_to_hosts = None
+
+ if html.get_checkbox("only_ok_agent"):
+ skip_hosts = find_hosts_with_failed_agent()
+ else:
+ skip_hosts = []
# 'all' not set -> only inventorize checked hosts
if not html.var("all"):
@@ -2672,7 +2677,8 @@ def mode_bulk_inventory(phase):
hostnames = get_hostnames_from_checkboxes(filterfunc)
items = [ "%s|%s" % (g_folder[".path"], hostname)
for hostname in hostnames
- if (failed_invcheck_hosts == None or hostname in failed_invcheck_hosts) ]
+ if (restrict_to_hosts == None or hostname in restrict_to_hosts) and
+ hostname not in skip_hosts ]
for hostname in hostnames:
check_host_permissions(hostname)
@@ -2683,7 +2689,9 @@ def mode_bulk_inventory(phase):
items = []
hostnames = []
for hostname, folder in entries:
- if failed_invcheck_hosts != None and hostname not in failed_invcheck_hosts:
+ if restrict_to_hosts != None and hostname not in restrict_to_hosts:
+ continue
+ if hostname in skip_hosts:
continue
check_host_permissions(hostname, folder=folder)
items.append("%s|%s" % (folder[".path"], hostname))
@@ -2730,18 +2738,26 @@ def mode_bulk_inventory(phase):
html.checkbox("only_failed", False, label=_("Only include hosts that failed on previous inventory"))
html.write("<br>")
html.checkbox("only_failed_invcheck", False, label=_("Only include hosts with a failed inventory check"))
+ html.write("<br>")
+ html.checkbox("only_ok_agent", False, label=_("Exclude hosts where the agent is unreachable"))
# Start button
forms.end()
html.button("_start", _("Start"))
def find_hosts_with_failed_inventory_check():
- hosts = html.live.query_column(
+ return html.live.query_column(
"GET services\n"
"Filter: description = Check_MK inventory\n"
"Filter: state > 0\n"
"Columns: host_name")
- return hosts
+
+def find_hosts_with_failed_agent():
+ return html.live.query_column(
+ "GET services\n"
+ "Filter: description = Check_MK\n"
+ "Filter: state >= 2\n"
+ "Columns: host_name")
#.
# .-Bulk-Edit------------------------------------------------------------.