Module: check_mk
Branch: master
Commit: 9cbb1212592cd651a4ac0b37f2cd5b65c32cbd3a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9cbb1212592cd6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Mar 10 11:03:16 2015 +0100
Hack for handling UnicodeWarnings during new service matching
---
modules/check_mk.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 8f99421..f027f39 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -34,6 +34,12 @@
import os, sys, socket, time, getopt, glob, re, stat, py_compile, urllib, inspect
import subprocess
+# Hack needed to fix UnicodeWarning in in_extraconf_servicelist(). This
+# can be removed once the encoding of autocheck's items are handled correctly
+# as unicode strings
+import warnings
+warnings.simplefilter("error", UnicodeWarning)
+
# These variable will be substituted at 'make dist' time
check_mk_version = '(inofficial)'
@@ -1881,7 +1887,6 @@ def in_extraconf_servicelist(service_matchers, item):
try:
result = func(item)
except (UnicodeDecodeError, UnicodeWarning), e:
- print 'catched', type(e), item
# FIXME: items in autochecks might contain umlauts, the strings
# are saved as UTF-8 encoded ascii strings. should be saved as
# unicode strings in this case or at least converted after reading.
Preconverting regex patterns to match functions
Message-ID: <54fef466.b410Ho9VIRKC7mMn%lm(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 412be37da578222933314e6f527c91b0a7a17f8f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=412be37da57822…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Mar 10 09:08:55 2015 +0100
Prep for next improvement: Preconverting regex patterns to match functions
---
modules/check_mk.py | 82 +++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 70 insertions(+), 12 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 7684584..8f99421 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1611,7 +1611,7 @@ def host_extra_conf_merged(hostname, conf):
def in_binary_hostlist(hostname, conf):
# if we have just a list of strings just take it as list of hostnames
- if len(conf) > 0 and type(conf[0]) == str:
+ if conf and type(conf[0]) == str:
return hostname in conf
for entry in conf:
@@ -1660,6 +1660,53 @@ def get_rule_options(entry):
else:
return entry, {}
+
+# Converts a regex pattern which is used to e.g. match services within Check_MK
+# to a function reference to a matching function which takes one parameter to
+# perform the matching and returns a two item tuple where the first element
+# tells wether or not the pattern is negated and the second element the outcome
+# of the match.
+# This function tries to parse the pattern and return different kind of matching
+# functions which can then be performed faster than just using the regex match.
+def convert_pattern(pattern):
+ def is_regex(pattern):
+ for c in pattern:
+ if c in '*$|[':
+ return True
+ return False
+
+ def is_infix_string_search(pattern):
+ return pattern.startswith('.*') and not is_regex(pattern[2:])
+
+ def is_exact_match(pattern):
+ return pattern[-1] == '$' and not is_regex(pattern[:-1])
+
+ if pattern == '':
+ return False, lambda txt: True # empty patterns match always
+
+ negate, pattern = parse_negated(pattern)
+
+ if is_exact_match(pattern):
+ # Exact string match
+ return negate, lambda txt: pattern[:-1] == txt
+
+ elif is_infix_string_search(pattern):
+ # Using regex to search a substring within text
+ return negate, lambda txt: pattern[2:] in txt
+
+ elif is_regex(pattern):
+ # Non specific regex. Use real prefix regex matching
+ return negate, lambda txt: regex(pattern).match(txt) != None
+
+ else:
+ # prefix match
+ return negate, lambda txt: txt.startswith(pattern)
+
+
+def convert_pattern_list(patterns):
+ return [ convert_pattern(p) for p in patterns ]
+
+
g_hostlist_match_cache = {}
def all_matching_hosts(tags, hostlist):
cache_id = tuple(tags), tuple(hostlist)
@@ -1701,11 +1748,14 @@ def convert_service_ruleset(ruleset):
# Directly compute set of all matching hosts here, this
# will avoid recomputation later
hosts = all_matching_hosts(tags, hostlist)
- new_rules.append((item, hosts, servlist))
+
+ # And now preprocess the configured patterns in the servlist
+ new_rules.append((item, hosts, convert_pattern_list(servlist)))
g_converted_rulesets_cache[id(ruleset)] = new_rules
return new_rules
+
# Compute outcome of a service rule set that has an item
def service_extra_conf(hostname, service, ruleset):
try:
@@ -1714,8 +1764,8 @@ def service_extra_conf(hostname, service, ruleset):
ruleset = convert_service_ruleset(ruleset)
entries = []
- for item, hosts, servlist in ruleset:
- if hostname in hosts and in_extraconf_servicelist(servlist, service):
+ for item, hosts, service_matchers in ruleset:
+ if hostname in hosts and in_extraconf_servicelist(service_matchers, service):
entries.append(item)
return entries
@@ -1745,7 +1795,7 @@ def convert_boolean_service_ruleset(ruleset):
# Directly compute set of all matching hosts here, this
# will avoid recomputation later
hosts = all_matching_hosts(tags, hostlist)
- new_rules.append((negate, hosts, servlist))
+ new_rules.append((negate, hosts, convert_pattern_list(servlist)))
g_converted_rulesets_cache[id(ruleset)] = new_rules
return new_rules
@@ -1758,9 +1808,9 @@ def in_boolean_serviceconf_list(hostname, service_description, ruleset):
except KeyError:
ruleset = convert_boolean_service_ruleset(ruleset)
- for negate, hosts, servlist in ruleset:
+ for negate, hosts, service_matchers in ruleset:
if hostname in hosts and \
- in_extraconf_servicelist(servlist, service_description):
+ in_extraconf_servicelist(service_matchers, service_description):
return not negate
return False # no match. Do not ignore
@@ -1820,16 +1870,24 @@ def in_extraconf_hostlist(hostlist, hostname):
g_extraconf_servicelist_cache = {}
-def in_extraconf_servicelist(servlist, item):
- cache_id = tuple(servlist), item
+def in_extraconf_servicelist(service_matchers, item):
+ cache_id = tuple(service_matchers), item
try:
return g_extraconf_servicelist_cache[cache_id]
except:
pass
- for pattern in servlist:
- negate, pattern = parse_negated(pattern)
- if regex(pattern).match(item) != None:
+ for negate, func in service_matchers:
+ try:
+ result = func(item)
+ except (UnicodeDecodeError, UnicodeWarning), e:
+ print 'catched', type(e), item
+ # FIXME: items in autochecks might contain umlauts, the strings
+ # are saved as UTF-8 encoded ascii strings. should be saved as
+ # unicode strings in this case or at least converted after reading.
+ result = func(item.decode('utf-8'))
+
+ if result:
g_extraconf_servicelist_cache[cache_id] = not negate
return not negate
Module: check_mk
Branch: master
Commit: b256a3fcb68e02816d9480818d2173d3bc7ceb34
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b256a3fcb68e02…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 9 15:15:00 2015 +0100
Reverted try to improve regex performance (was not sufficient)
---
modules/check_mk.py | 49 ++-----------------------------------------------
modules/discovery.py | 4 ++--
2 files changed, 4 insertions(+), 49 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 6343558..edbe621 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1701,7 +1701,6 @@ def convert_service_ruleset(ruleset):
g_converted_rulesets_cache[id(ruleset)] = new_rules
return new_rules
-
# Compute outcome of a service rule set that has an item
def service_extra_conf(hostname, service, ruleset):
try:
@@ -1761,49 +1760,6 @@ def in_boolean_serviceconf_list(hostname, service_description, ruleset):
return False # no match. Do not ignore
-def intelligent_regex_match(pattern, text):
- def is_regex(pattern):
- for c in pattern:
- if c in '*$|[':
- return True
- return False
-
- def is_infix_string_search(pattern):
- return pattern.startswith('.*') and not is_regex(pattern[2:])
-
- def is_exact_match(pattern):
- return pattern[-1] == '$' and not is_regex(pattern[:-1])
-
- if pattern == '':
- return True # empty patterns match always
-
- # FIXME: Autochecks contain UTF-8 encoded item strings
- if type(text) == str:
- text = text.decode('utf-8')
-
- if is_exact_match(pattern):
- # Exact string match
- return pattern[:-1] == text
-
- elif is_infix_string_search(pattern):
- # Using regex to search a substring within text
- return pattern[2:] in text
-
- elif is_regex(pattern):
- # Non specific regex. Use real prefix regex matching
- return regex(pattern).match(text) != None
-
- else:
- # prefix string match
- try:
- return text.startswith(pattern)
- except UnicodeDecodeError:
- # FIXME: items in autochecks might contain umlauts, the strings
- # are saved as UTF-8 encoded ascii strings. should be saved as
- # unicode strings in this case or at least converted after reading.
- return text.startswith(pattern)
-
-
# Entries in list are hostnames that must equal the hostname.
# Expressions beginning with ! are negated: if they match,
# the item is excluded from the list. Expressions beginning
@@ -1849,7 +1805,7 @@ def in_extraconf_hostlist(hostlist, hostname):
return not negate
# Handle Regex. Note: hostname == True -> generic unknown host
elif use_regex and hostname != True:
- if intelligent_regex_match(hostentry, hostname):
+ if regex(hostentry).match(hostname) != None:
return not negate
except MKGeneralException:
if opt_debug:
@@ -1868,7 +1824,7 @@ def in_extraconf_servicelist(servlist, item):
for pattern in servlist:
negate, pattern = parse_negated(pattern)
- if intelligent_regex_match(pattern, item):
+ if regex(pattern).match(item) != None:
g_extraconf_servicelist_cache[cache_id] = not negate
return not negate
@@ -4550,7 +4506,6 @@ def do_update(with_precompile):
raise
sys.exit(1)
-
def do_check_nagiosconfig():
if monitoring_core == 'nagios':
command = nagios_binary + " -vp " + nagios_config_file + " 2>&1"
diff --git a/modules/discovery.py b/modules/discovery.py
index 1c7008c..0b6630b 100644
--- a/modules/discovery.py
+++ b/modules/discovery.py
@@ -739,8 +739,8 @@ def read_autochecks_of(hostname, world="config"):
for entry in autochecks_raw:
if len(entry) == 4: # old format where hostname is at the first place
entry = entry[1:]
- ct, it, par = entry
- autochecks.append( (ct, it, compute_check_parameters(hostname, ct, it, par)) )
+ check_type, item, parameters = entry
+ autochecks.append((check_type, item, compute_check_parameters(hostname, check_type, item, parameters)))
return autochecks
Module: check_mk
Branch: master
Commit: d96a0bed3c7043456d04f6c1dacc70b4fbbcbece
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d96a0bed3c7043…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Mar 10 08:22:44 2015 +0100
Some naming convention cleanups
---
modules/check_mk.py | 55 +++++++++++++++++++++++++++-----------------------
modules/inventory.py | 2 +-
2 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index edbe621..7684584 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -24,6 +24,13 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+# Future convention within all Check_MK modules for variable names:
+#
+# - host_name - Monitoring name of a host (string)
+# - node_name - Name of cluster member (string)
+# - cluster_name - Name of a cluster (string)
+# - realhost_name - Name of a *real* host, not a cluster (string)
+
import os, sys, socket, time, getopt, glob, re, stat, py_compile, urllib, inspect
import subprocess
@@ -1156,7 +1163,7 @@ def do_update_dns_cache():
if opt_verbose:
print "Updating DNS cache..."
- for hostname in all_active_hosts_and_clusters():
+ for hostname in all_active_hosts():
if opt_verbose:
sys.stdout.write("%s..." % hostname)
sys.stdout.flush()
@@ -1280,16 +1287,16 @@ def output_conf_header(outfile):
# Returns a list of all host names, regardless if currently
# disabled or monitored on a remote site. Does not return
# cluster hosts.
-def all_configured_physical_hosts():
+def all_configured_realhosts():
return strip_tags(all_hosts)
-def all_active_hosts_and_clusters():
- return all_active_hosts() + all_active_clusters()
+def all_active_hosts():
+ return all_active_realhosts() + all_active_clusters()
# Returns a list of all host names to be handled by this site
# hosts of other sitest or disabled hosts are excluded
all_hosts_untagged = None
-def all_active_hosts():
+def all_active_realhosts():
global all_hosts_untagged
if all_hosts_untagged == None:
all_hosts_untagged = filter_active_hosts(strip_tags(all_hosts))
@@ -1328,9 +1335,9 @@ def host_is_member_of_site(hostname, site):
def parse_hostname_list(args, with_clusters = True, with_foreign_hosts = False):
if with_foreign_hosts:
- valid_hosts = all_configured_physical_hosts()
+ valid_hosts = all_configured_realhosts()
else:
- valid_hosts = all_active_hosts()
+ valid_hosts = all_active_realhosts()
if with_clusters:
valid_hosts += all_active_clusters()
hostlist = []
@@ -1398,7 +1405,7 @@ def parents_of(hostname):
for p in par:
ps = p.split(",")
for pss in ps:
- if pss in all_active_hosts():
+ if pss in all_active_realhosts():
used_parents.append(pss)
return used_parents
@@ -1655,16 +1662,14 @@ def get_rule_options(entry):
g_hostlist_match_cache = {}
def all_matching_hosts(tags, hostlist):
- cache_id = tuple(tags)+tuple(hostlist)
+ cache_id = tuple(tags), tuple(hostlist)
try:
return g_hostlist_match_cache[cache_id]
except KeyError:
pass
matching = set([])
- # FIXME: lm: replaced all_hosts + clusters.keys() with all_active_hosts_and_clusters()
- # because I think we only need to active hosts/clusters here!
- for hostname in all_active_hosts_and_clusters():
+ for hostname in all_active_hosts():
# When no tag matching is requested, do not filter by tags. Accept all hosts
# and filter only by hostlist
if (not tags or hosttags_match_taglist(tags_of_host(hostname), tags)) and \
@@ -1816,7 +1821,7 @@ def in_extraconf_hostlist(hostlist, hostname):
g_extraconf_servicelist_cache = {}
def in_extraconf_servicelist(servlist, item):
- cache_id = tuple(servlist) + (item,)
+ cache_id = tuple(servlist), item
try:
return g_extraconf_servicelist_cache[cache_id]
except:
@@ -1872,7 +1877,7 @@ def create_nagios_config(outfile = sys.stdout, hostnames = None):
output_conf_header(outfile)
if hostnames == None:
- hostnames = all_active_hosts_and_clusters()
+ hostnames = all_active_hosts()
for hostname in hostnames:
create_nagios_config_host(outfile, hostname)
@@ -1966,7 +1971,7 @@ def create_nagios_hostdefs(outfile, hostname):
if is_clust:
nodes = nodes_of(hostname)
for node in nodes:
- if node not in all_active_hosts():
+ if node not in all_active_realhosts():
raise MKGeneralException("Node %s of cluster %s not in all_hosts." % (node, hostname))
node_ips = [ lookup_ipaddress(h) for h in nodes ]
alias = "cluster of %s" % ", ".join(nodes)
@@ -2689,7 +2694,7 @@ def get_precompiled_check_table(hostname):
def precompile_hostchecks():
if not os.path.exists(precompiled_hostchecks_dir):
os.makedirs(precompiled_hostchecks_dir)
- for host in all_active_hosts_and_clusters():
+ for host in all_active_hosts():
try:
precompile_hostcheck(host)
except Exception, e:
@@ -3791,7 +3796,7 @@ def do_restore(tarname):
def do_flush(hosts):
if not hosts:
- hosts = all_active_hosts_and_clusters()
+ hosts = all_active_hosts()
for host in hosts:
sys.stdout.write("%-20s: " % host)
sys.stdout.flush()
@@ -3878,7 +3883,7 @@ def do_flush(hosts):
# option --list-hosts
def list_all_hosts(hostgroups):
hostlist = []
- for hn in all_active_hosts_and_clusters():
+ for hn in all_active_hosts():
if len(hostgroups) == 0:
hostlist.append(hn)
else:
@@ -3892,7 +3897,7 @@ def list_all_hosts(hostgroups):
# Same for host tags, needed for --list-tag
def list_all_hosts_with_tags(tags):
hosts = []
- for h in all_active_hosts_and_clusters():
+ for h in all_active_hosts():
if hosttags_match_taglist(tags_of_host(h), tags):
hosts.append(h)
return hosts
@@ -4021,7 +4026,7 @@ def do_snmpwalk_on(hostname, filename):
def do_snmpget(oid, hostnames):
if len(hostnames) == 0:
- for host in all_active_hosts():
+ for host in all_active_realhosts():
if is_snmp_host(host):
hostnames.append(host)
@@ -4115,7 +4120,7 @@ def show_paths():
def dump_all_hosts(hostlist):
if hostlist == []:
- hostlist = all_active_hosts_and_clusters()
+ hostlist = all_active_hosts()
hostlist.sort()
for hostname in hostlist:
dump_host(hostname)
@@ -4639,7 +4644,7 @@ def lock_objects_file():
def do_donation():
donate = []
cache_files = os.listdir(tcp_cache_dir)
- for host in all_active_hosts():
+ for host in all_active_realhosts():
if in_binary_hostlist(host, donation_hosts):
for f in cache_files:
if f == host or f.startswith("%s." % host):
@@ -4670,7 +4675,7 @@ def find_bin_in_path(prog):
def do_scan_parents(hosts):
global max_num_processes
if len(hosts) == 0:
- hosts = filter(lambda h: in_binary_hostlist(h, scanparent_hosts), all_active_hosts())
+ hosts = filter(lambda h: in_binary_hostlist(h, scanparent_hosts), all_active_realhosts())
found = []
parent_hosts = []
@@ -4922,7 +4927,7 @@ def ip_to_hostname(ip):
global ip_to_hostname_cache
if ip_to_hostname_cache == None:
ip_to_hostname_cache = {}
- for host in all_active_hosts():
+ for host in all_active_realhosts():
try:
ip_to_hostname_cache[lookup_ipaddress(host)] = host
except:
@@ -5319,7 +5324,7 @@ def read_config_files(with_autochecks=True, with_conf_d=True):
# Sanity check for duplicate hostnames
seen_hostnames = set([])
- for hostname in all_active_hosts_and_clusters():
+ for hostname in all_active_hosts():
if hostname in seen_hostnames:
sys.stderr.write("Error in configuration: duplicate host '%s'\n" % hostname)
sys.exit(3)
diff --git a/modules/inventory.py b/modules/inventory.py
index 56485ae..4b10046 100644
--- a/modules/inventory.py
+++ b/modules/inventory.py
@@ -162,7 +162,7 @@ def do_inv(hostnames):
# No hosts specified: do all hosts and force caching
if hostnames == None:
- hostnames = all_active_hosts()
+ hostnames = all_active_realhosts()
global opt_use_cachefile
opt_use_cachefile = True
Module: check_mk
Branch: master
Commit: 076739b849b802b16705f9fd3657f95ce0ba0954
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=076739b849b802…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Tue Mar 10 13:42:01 2015 +0100
#2101 FIX cisco_temperature: check can now handle cases when no description of the sensor is available
---
.werks/2101 | 9 +++++++++
ChangeLog | 1 +
checkman/cisco_temperature | 3 ++-
checks/cisco_temperature | 5 ++++-
4 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/.werks/2101 b/.werks/2101
new file mode 100644
index 0000000..46a879c
--- /dev/null
+++ b/.werks/2101
@@ -0,0 +1,9 @@
+Title: cisco_temperature: check can now handle cases when no description of the sensor is available
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1425991259
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 14b1041..eb9a67b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -245,6 +245,7 @@
* 2098 FIX: ibm_svc_mdiskgrp: fix rounding bug, decimal digits of size (GB, TB) were always lost
* 2094 FIX: Fixed missing agent section when ntpq times out after 5 seconds
* 2095 FIX: oracle_crs_voting: Also handling voting disks with id 0 (seen on old CRS 10.2.0.5.0)...
+ * 2101 FIX: cisco_temperature: check can now handle cases when no description of the sensor is available
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request, added mailto link for error report...
diff --git a/checkman/cisco_temperature b/checkman/cisco_temperature
index cd46c61..32a5579 100644
--- a/checkman/cisco_temperature
+++ b/checkman/cisco_temperature
@@ -15,7 +15,8 @@ perfdata:
The current temperature in degrees celsius
item:
- The description of the sensor as provided by the device.
+ The description of the sensor as provided by the device, or the ID of the sensor,
+ if no description is available.
inventory:
One check for each available sensor is created.
diff --git a/checks/cisco_temperature b/checks/cisco_temperature
index 1d5ab38..5f31bfe 100644
--- a/checks/cisco_temperature
+++ b/checks/cisco_temperature
@@ -44,7 +44,10 @@ def parse_cisco_temperature(info):
thresholds.setdefault(sensor_id, []).append(level)
for sensor_id, sensortype, scalecode, magnitude, value, sensorstate in state_info:
- descr = descriptions[sensor_id]
+ if sensor_id in descriptions:
+ descr = descriptions[sensor_id]
+ else:
+ descr = sensor_id
if descr and sensortype == '8':
entity_parsed[descr] = {}
scale = 10**int(magnitude)
Module: check_mk
Branch: master
Commit: 76d2c1ef82944ea57b83eb2955584df9dac2d8d8
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=76d2c1ef82944e…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Mar 10 13:23:00 2015 +0100
#1227 mysql_ping: New Check to detect misconfiguration of the mk_mysql plugin
---
.werks/1227 | 9 +++++++++
ChangeLog | 1 +
checkman/mysql_ping | 19 +++++++++++++++++++
checks/mysql_ping | 42 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 71 insertions(+)
diff --git a/.werks/1227 b/.werks/1227
new file mode 100644
index 0000000..d71a51a
--- /dev/null
+++ b/.werks/1227
@@ -0,0 +1,9 @@
+Title: mysql_ping: New Check to detect misconfiguration of the mk_mysql plugin
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1425990122
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 14b1041..8258a59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -120,6 +120,7 @@
* 2056 winperf_processor: additionally reports user and privileged(system) time...
* 1226 mysql: New check to show the version of the mysql deamon
* 2100 if64: check can now impose limits on the number of outgoing and incoming non-unicast packets per second
+ * 1227 mysql_ping: New Check to detect misconfiguration of the mk_mysql plugin
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/checkman/mysql_ping b/checkman/mysql_ping
new file mode 100644
index 0000000..328cd6e
--- /dev/null
+++ b/checkman/mysql_ping
@@ -0,0 +1,19 @@
+title: MySQL Deamon: Staus
+agents: linux
+catalog: app/mysql
+license: GPL
+distribution: check_mk
+description:
+ This check checks if the MySQL deamon is alive and a connection is possible.
+ Otherwiese it returns {CRIT}. This check can also be used to detect wrong or
+ unconfigured mk_mysql plugins.
+
+ This check needs the agent plugin {mk_mysql} to be installed.
+ Further details about this plugin and monitoring of MySQL can be
+ found in the Check_MK online documentation in the article
+ "Monitoring MySQL with Check_MK".
+
+inventory:
+ On each host where the agent plugin {mk_mysql} is being installed
+ one service is being generated.
+
diff --git a/checks/mysql_ping b/checks/mysql_ping
new file mode 100644
index 0000000..72b090f
--- /dev/null
+++ b/checks/mysql_ping
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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.
+
+def inventory_mysql_ping(info):
+ return [( None, None )]
+
+def check_mysql_ping(_no_item, _no_params, info):
+ message = " ".join(info[0])
+ if message == "mysqld is alive":
+ return 0, "MySQL Deamon is alive"
+ else:
+ return 2, message
+
+check_info['mysql_ping'] = {
+ "check_function" : check_mysql_ping,
+ "inventory_function" : inventory_mysql_ping,
+ "service_description" : "MySQL Deamon ",
+}
+