Module: check_mk
Branch: master
Commit: 0afd701b3ea763ae4930c462ba0b9e1412378436
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0afd701b3ea763…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Sun Jun 15 15:39:03 2014 +0200
FIX Fixed keepalive termination in case of exceptions during checking
For example regular appearing exceptions like "Cannot resolve hostname..." were
terminating the keepalive instance. This restart of the keepalive process is not
expected to be done in such situations.
---
.werks/819 | 10 ++++++++++
ChangeLog | 1 +
modules/check_mk.py | 2 ++
3 files changed, 13 insertions(+)
diff --git a/.werks/819 b/.werks/819
new file mode 100644
index 0000000..f85191a
--- /dev/null
+++ b/.werks/819
@@ -0,0 +1,10 @@
+Title: Fixed keepalive termination in case of exceptions during checking
+Level: 1
+Component: checks
+Version: 1.2.5i4
+Date: 1402839420
+Class: fix
+
+For example regular appearing exceptions like "Cannot resolve hostname..." were
+terminating the keepalive instance. This restart of the keepalive process is not
+expected to be done in such situations.
diff --git a/ChangeLog b/ChangeLog
index b4b2e93..6676490 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
* 0619 adva_fsp_temp: new check to monitor temperature and temperature trends on ADVA scalable optical transport solutions
* 0616 FIX: brocade.fan, brocade.power, brocade.temp: will now only discover services which are not marked as absent
* 0992 FIX: zfs_arc_cache: returns OK even if values of arc meta are missing...
+ * 0819 FIX: Fixed keepalive termination in case of exceptions during checking...
Multisite:
* 0934 FIX: Logwatch messages with class unknown ( 'u' ) now displayed as WARN...
diff --git a/modules/check_mk.py b/modules/check_mk.py
index d7f4e3c..86dfb29 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -5492,6 +5492,8 @@ def do_check_keepalive():
sys.stderr.write("WARNING: new variable appeared: %s" % ", ".join(new_vars))
except Exception, e:
+ signal.signal(signal.SIGALRM, signal.SIG_IGN) # Prevent ALRM from CheckHelper.cc
+ signal.alarm(0)
if opt_debug:
raise
total_check_output = "UNKNOWN - %s\n" % e
Module: check_mk
Branch: master
Commit: fbfba6eb0f6333e1f22d2908a4731c4f234ce1db
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fbfba6eb0f6333…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Fri Jun 13 16:00:05 2014 +0200
FIX zfsget: better filesystem selection and calculation of sizes
zfsget now only inventorizes filesystems of type "filesystem".
If a mountpoint is present several times in the zfsget section of the agent
data (with different device name), and also in the df section, the entry
in the zfsget section with the device name from the df section is taken for
calculating the data.
---
.werks/621 | 13 +++++++++++++
ChangeLog | 1 +
checkman/zfsget | 6 +++---
checks/zfsget | 43 +++++++++++++++++++++++++++++++------------
4 files changed, 48 insertions(+), 15 deletions(-)
diff --git a/.werks/621 b/.werks/621
new file mode 100644
index 0000000..f0a8ead
--- /dev/null
+++ b/.werks/621
@@ -0,0 +1,13 @@
+Title: zfsget: better filesystem selection and calculation of sizes
+Level: 2
+Component: checks
+Version: 1.2.5i4
+Date: 1402667669
+Class: fix
+
+zfsget now only inventorizes filesystems of type "filesystem".
+
+If a mountpoint is present several times in the zfsget section of the agent
+data (with different device name), and also in the df section, the entry
+in the zfsget section with the device name from the df section is taken for
+calculating the data.
diff --git a/ChangeLog b/ChangeLog
index b4b2e93..7c797c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
* 0619 adva_fsp_temp: new check to monitor temperature and temperature trends on ADVA scalable optical transport solutions
* 0616 FIX: brocade.fan, brocade.power, brocade.temp: will now only discover services which are not marked as absent
* 0992 FIX: zfs_arc_cache: returns OK even if values of arc meta are missing...
+ * 0621 FIX: zfsget: better filesystem selection and calculation of sizes...
Multisite:
* 0934 FIX: Logwatch messages with class unknown ( 'u' ) now displayed as WARN...
diff --git a/checkman/zfsget b/checkman/zfsget
index df2cd05..7b21ea3 100644
--- a/checkman/zfsget
+++ b/checkman/zfsget
@@ -17,7 +17,7 @@ description:
filesystems live together in a common "pool". Each of the filesystems
has its own amount of used space. But they share a common free space.
If you want to compute the {percentage} of used/free space of a filesystem,
- then you run into trouble. Let's take the following example:
+ you may run into trouble. Let's take the following example:
Lets say we have a pool P of the size 10GB where the filesystems A and B
live. Lets assume that A currently uses 2GB and B uses 7GB. That makes 1GB
@@ -29,6 +29,6 @@ description:
as 3GB with 2GB used (which makes 66.6%). That way all filesystems will
become critical if the available pool space goes to zero.
- Filesystems with a {quota} are handled differntly, however! Here the quota
- is reported as the total size. If A would have a quota of 5GB then we report
+ Filesystems with a {quota} are handled differently, however. Here the quota
+ is reported as the total size. If A has a quota of 5GB, we report
2GB out of 5GB used.
diff --git a/checks/zfsget b/checks/zfsget
index 386e08f..c97e526 100644
--- a/checks/zfsget
+++ b/checks/zfsget
@@ -91,18 +91,40 @@ def parse_zfsget(info):
if entry:
entries.append(entry)
+ # parsed has the device name as key, because there may exist
+ # several device names per mount point, and we know only
+ # later which one to take
parsed = {}
for entry in entries:
if entry["mountpoint"].startswith("/"):
entry["is_pool"] = '/' not in entry["name"]
- if entry['available'] != 0:
- parsed[entry["mountpoint"]] = entry
+ if entry['available'] !=0 and entry['type'] == 'filesystem':
+ parsed[entry["name"]] = entry
+ # parsed_df and parsed_final have the mount point as key
+ parsed_final = {}
if start_of_df != None:
- zfsget_parse_df_info(parsed, info[start_of_df:])
-
- return parsed
-
+ parsed_df = zfsget_parse_df_info(parsed, info[start_of_df:])
+ for mountpoint, entry_df in parsed_df.items():
+ found = False
+ # for every mount point in the df section, if the device name
+ # is also present in the "parsed" variable, we take those data
+ for name, entry in parsed.items():
+ if entry_df["name"] == name:
+ parsed_final[mountpoint] = entry
+ found = True
+ # if a mount point in the df section is not present in the
+ # parsed variable, we take the data from the df section
+ if not found:
+ parsed_final[mountpoint] = entry_df
+ else:
+ # if there is no df section we take the other data,
+ # should there be several device names per mount point,
+ # (not sure if this can happen) the last one wins
+ for name, entry in parsed.items():
+ parsed_final[entry["mountpoint"]] = entry
+
+ return parsed_final
def zfsget_parse_df_info(entries, info):
new_entries = {}
@@ -112,11 +134,10 @@ def zfsget_parse_df_info(entries, info):
device, kbytes, used, avail, percent, mountpoint = entry
else:
device, fs_type, kbytes, used, avail, percent, mountpoint = entry
- # ignore entries already contained in zfsget and also
- # entries for virtual filesystems (like swap)
- if mountpoint.startswith("/") and mountpoint not in entries:
+ if mountpoint.startswith("/"):
entry = {}
total = int(kbytes) / 1024.0
+ entry["name"] = device
entry["total"] = total
entry["used"] = int(used) / 1024.0
entry["available"] = total - entry["used"]
@@ -138,9 +159,7 @@ def zfsget_parse_df_info(entries, info):
drop.append(mountpoint)
for mp in drop:
del new_entries[mp]
- entries.update(new_entries)
-
-
+ return new_entries
def inventory_zfsget(info):
mplist = []