Module: check_mk
Branch: master
Commit: 6cfb92c0c9583ed5d893562ad1d9fc8bf4edf340
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6cfb92c0c9583e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 2 08:42:44 2015 +0100
#2719 FIX Events Check: Links to EC were broken when using regular expressions as application
When using a regular expression to find Event Console events for an "Events" service, the
icon linking from the service to the Event Console linked to a view which did not show
the corrent amount of events.
---
.werks/2719 | 12 ++++++++++++
ChangeLog | 1 +
mkeventd/web/plugins/icons/mkeventd.py | 13 ++++++++-----
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/.werks/2719 b/.werks/2719
new file mode 100644
index 0000000..20ee254
--- /dev/null
+++ b/.werks/2719
@@ -0,0 +1,12 @@
+Title: Events Check: Links to EC were broken when using regular expressions as application
+Level: 1
+Component: ec
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i4
+Date: 1446450077
+
+When using a regular expression to find Event Console events for an "Events" service, the
+icon linking from the service to the Event Console linked to a view which did not show
+the corrent amount of events.
diff --git a/ChangeLog b/ChangeLog
index 5389ea8..f9e481b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -62,6 +62,7 @@
Event Console:
* 2733 Visibility of Event Console events more flexible now...
+ * 2719 FIX: Events Check: Links to EC were broken when using regular expressions as application...
HW/SW-Inventory:
* 2436 NetApp monitoring: Now able to gather data for inventory...
diff --git a/mkeventd/web/plugins/icons/mkeventd.py b/mkeventd/web/plugins/icons/mkeventd.py
index f25eac3..34005f3 100644
--- a/mkeventd/web/plugins/icons/mkeventd.py
+++ b/mkeventd/web/plugins/icons/mkeventd.py
@@ -78,17 +78,20 @@ def paint_mkeventd(what, row, tags, custom_vars):
if getattr(config, 'mkeventd_distributed', False):
url_prefix = site['url_prefix'] + 'check_mk/'
- title = _('Events of Host %s') % (row["host_name"])
- url = 'view.py?' + html.urlencode_vars([
+ url_vars = [
("view_name", "ec_events_of_monhost"),
("site", row["site"]),
("host", row["host_name"]),
- ])
+ ]
+
+ title = _('Events of Host %s') % (row["host_name"])
if len(args) >= 2:
- app = args[1].strip('\'')
+ app = args[1].strip('\'').replace("\\\\", "\\")
title = _('Events of Application "%s" on Host %s') % (app, host)
- url += '&event_application=' + app
+ url_vars.append(("event_application", app))
+
+ url = 'view.py?' + html.urlencode_vars(url_vars)
return 'mkeventd', title, url_prefix + url
Module: check_mk
Branch: master
Commit: 74270edd44c15a13657609c16100c717ed49dc24
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=74270edd44c15a…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Sun Nov 1 16:19:42 2015 +0100
#2444 lnx_if: now able to detect interfaces which "break" during runtime
Previously the check <i>lnx_if</i> used the output of the <i>ethtool</i> command to determine if
an interface is up or down. There was a fallback in case <i>ethtool</i> was not available,
or did not report valid data at all (happens on broken interfaces).
However, these fallback could not detect interfaces which break during runtime.
The linux agent now reports additional information collected with the <i>ip link</i> command.
In case the ethtool information is missing the <i>lnx_if</i> check will now use the
data from <i>ip link</i> instead.
---
.werks/2444 | 16 ++++++++
ChangeLog | 1 +
agents/check_mk_agent.linux | 8 ++++
checks/lnx_if | 88 ++++++++++++++++++++++++++++++++++---------
4 files changed, 95 insertions(+), 18 deletions(-)
diff --git a/.werks/2444 b/.werks/2444
new file mode 100644
index 0000000..f8b3d42
--- /dev/null
+++ b/.werks/2444
@@ -0,0 +1,16 @@
+Title: lnx_if: now able to detect interfaces which "break" during runtime
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1446390568
+Class: feature
+
+Previously the check <i>lnx_if</i> used the output of the <i>ethtool</i> command to determine if
+an interface is up or down. There was a fallback in case <i>ethtool</i> was not available,
+or did not report valid data at all (happens on broken interfaces).
+However, these fallback could not detect interfaces which break during runtime.
+
+The linux agent now reports additional information collected with the <i>ip link</i> command.
+In case the ethtool information is missing the <i>lnx_if</i> check will now use the
+data from <i>ip link</i> instead.
diff --git a/ChangeLog b/ChangeLog
index 71bce4c..6c0b8ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@
* 2671 df: avoid duplicate items for btrfs that is mounted several times...
NOTE: Please refer to the migration notes!
* 2441 NetApp 7Mode: Now able to monitor reserved snapshot space for volumes
+ * 2444 lnx_if: now able to detect interfaces which "break" during runtime...
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 811147c..d8f2488 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -235,6 +235,14 @@ cat /proc/uptime
# New variant: Information about speed and state in one section
+if type ip > /dev/null
+then
+ echo '<<<lnx_if>>>'
+ echo "[start_iplink]"
+ ip link
+ echo "[end_iplink]"
+fi
+
echo '<<<lnx_if:sep(58)>>>'
sed 1,2d /proc/net/dev
if type ethtool > /dev/null
diff --git a/checks/lnx_if b/checks/lnx_if
index 15e2e93..7f75e19 100644
--- a/checks/lnx_if
+++ b/checks/lnx_if
@@ -26,6 +26,15 @@
# Example output from agent:
+# <<<lnx_if>>>
+# [start_iplink]
+# 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
+# link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
+# 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
+# link/ether 00:27:13:b4:a9:ec brd ff:ff:ff:ff:ff:ff
+# 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
+# link/ether 00:21:6a:10:8e:b8 brd ff:ff:ff:ff:ff:ff
+# [end_iplink]
# <<<lnx_if:sep(58)>>>
# lo: 4520 54 0 0 0 0 0 0 4520 54 0 0 0 0 0 0
# eth0: 0 0 0 0 0 0 0 0 1710 5 0 0 0 0 0 0
@@ -44,6 +53,7 @@
# Auto-negotiation: on
# Link detected: yes
+
check_includes['lnx_if'] = [ "if.include" ]
linux_nic_check = "lnx_if"
@@ -52,21 +62,54 @@ def if_lnx_convert_to_if64(info):
nic_info = {}
current_nic = None
index = 0
- for line in info:
- # Be careful! On clustered hosts we have more than one perf-counters section
- # and ethtool section. This needs to be handled. Sadly we have no section
- # headers. Try to detect it by data format.
- if line[0].startswith('['):
- current_nic = line[0][1:-1]
- index += 1
- nic_info[current_nic]['index'] = index
- elif len(line) == 2 and len(line[1].split()) >= 16:
- # This looks like a perf-counter line
- nic = line[0]
- nic_info[nic] = { "counters": map(int, line[1].split()) }
- else:
- # ethtool data line
- nic_info[current_nic][line[0].strip()] = ":".join(line[1:]).strip()
+ lines = iter(info)
+ try:
+ iplink_stats = {}
+ while True:
+ line = lines.next()
+
+ # This extra info from 'ip link' is used as fallback in case ethtool is missing
+ if line[0].startswith("[start_iplink]"):
+ iplink_stats = {}
+ while True:
+ line = lines.next()
+ if line[0].startswith("[end_iplink]"):
+ line = lines.next()
+ break
+ # Each interface in this block is represented by two lines
+ status_info = line
+ link_info = lines.next() # currently unused
+ try:
+ nic_name = status_info[1][:-1]
+ iplink_stats.setdefault(nic_name, { "extra_info": status_info[2][1:-1].split(",") })
+ iplink_stats[nic_name].update(dict(zip(status_info[3::2], status_info[4::2])))
+ except: # In case of parse errors we simply ignore these lines
+ pass
+
+ # Be careful! On clustered hosts we have more than one perf-counters section
+ # and ethtool section. This needs to be handled. Sadly we have no section
+ # headers. Try to detect it by data format.
+ if line[0].startswith('['):
+ current_nic = line[0][1:-1]
+ index += 1
+ nic_info[current_nic]['index'] = index
+ # The iplink_stats are only used within the perf-counters
+ # The (optional) ethtool section invalidates this info, otherwise it would
+ # be incorrectly reused in a followup section of another cluster node
+ # When the ethtool section is missing the data is also reset by the next [start_iplink]
+ iplink_stats = {}
+ elif len(line) == 2 and len(line[1].split()) >= 16:
+ # This looks like a perf-counter line
+ nic = line[0]
+ nic_info[nic] = { "counters": map(int, line[1].split()) }
+ if nic in iplink_stats:
+ nic_info[nic]['iplink_stats'] = iplink_stats[nic]
+ else:
+ # ethtool data line
+ nic_info[current_nic][line[0].strip()] = ":".join(line[1:]).strip()
+
+ except StopIteration:
+ pass
# if index is 0 we either have found no nics or no information
# from ethtool is present. In the latter case we continue and
@@ -130,10 +173,19 @@ def if_lnx_convert_to_if64(info):
# No information from ethtool. We consider interfaces up
# if they have been used at least some time since the
# system boot.
- if ifInOctets > 0:
- ifOperStatus = 1 # assume up
+ iplink_stats = attr.get("iplink_stats")
+ if iplink_stats:
+ if "UP" in iplink_stats.get("extra_info", []) or iplink_stats.get("state") == "UP":
+ ifOperStatus = 1
+ elif iplink_stats.get("state") == "DOWN":
+ ifOperStatus = 2
+ else:
+ ifOperStatus = 4
else:
- ifOperStatus = 4 # unknown (NIC has never been used)
+ if ifInOctets > 0:
+ ifOperStatus = 1 # assume up
+ else:
+ ifOperStatus = 4 # unknown (NIC has never been used)
if attr.get("Address"):
ifPhysAddress = "".join([chr(int(x, 16)) for x in attr.get("Address", "").split(":")])
Module: check_mk
Branch: master
Commit: f3a2e5003b35664ca71f72c5b60778b2cd379873
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f3a2e5003b3566…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Sun Nov 1 13:47:23 2015 +0100
#2443 FIX Fixed quoting of ! in classical nagios checks configured via WATO
Any <i>!</i> character configured in the WATO rule </i>Classical active and passive Monitoring checks</i>
or through the command line via custom_checks was incorrectly quoted. Nagios truncated the command
at the !, which lead to unwanted results.
---
.werks/2443 | 11 +++++++++++
ChangeLog | 1 +
modules/nagios.py | 2 +-
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/.werks/2443 b/.werks/2443
new file mode 100644
index 0000000..5eebfb4
--- /dev/null
+++ b/.werks/2443
@@ -0,0 +1,11 @@
+Title: Fixed quoting of ! in classical nagios checks configured via WATO
+Level: 1
+Component: core
+Compatible: compat
+Version: 1.2.7i4
+Date: 1446381757
+Class: fix
+
+Any <i>!</i> character configured in the WATO rule </i>Classical active and passive Monitoring checks</i>
+or through the command line via custom_checks was incorrectly quoted. Nagios truncated the command
+at the !, which lead to unwanted results.
diff --git a/ChangeLog b/ChangeLog
index 57faf12..71bce4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
1.2.7i4:
Core & Setup:
* 2682 FIX: Fixed exception Error creating configuration: global name 'extra_host_attributes' is not defined
+ * 2443 FIX: Fixed quoting of ! in classical nagios checks configured via WATO...
Checks & Agents:
* 2434 NetApp monitoring: Cluster-Mode is now supported, changes in existing 7Mode checks...
diff --git a/modules/nagios.py b/modules/nagios.py
index f369af0..7f51276 100644
--- a/modules/nagios.py
+++ b/modules/nagios.py
@@ -559,7 +559,7 @@ define service {
continue
if command_line:
- command_line = autodetect_plugin(command_line).replace("\\", "\\\\")
+ command_line = autodetect_plugin(command_line).replace("\\", "\\\\").replace("!", "\\!")
if "freshness" in entry:
freshness = " check_freshness\t\t1\n" + \