Module: check_mk
Branch: master
Commit: 5e4a128ada44e0ee63a95059f2d6ed273008d7b5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5e4a128ada44e0…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Apr 26 11:58:53 2016 +0200
3524 fileinfo, fileinfo.groups: both checks are now cluster ready
fileinfo: The check now tries to find the file on all cluster nodes.
fileinfo.groups: Fixed an exception when data came from multiple nodes.
---
.werks/3524 | 11 +++++++++++
ChangeLog | 1 +
checks/fileinfo | 25 +++++++++++++++++--------
3 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/.werks/3524 b/.werks/3524
new file mode 100644
index 0000000..0c169a0
--- /dev/null
+++ b/.werks/3524
@@ -0,0 +1,11 @@
+Title: fileinfo, fileinfo.groups: both checks are now cluster ready
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1461664629
+Class: feature
+
+fileinfo: The check now tries to find the file on all cluster nodes.
+
+fileinfo.groups: Fixed an exception when data came from multiple nodes.
diff --git a/ChangeLog b/ChangeLog
index 38d42ca..1c1fb4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -69,6 +69,7 @@
* 3423 papouch_th2e_sensors, papouch_th2e_sensors.dewpoint,
papouch_th2e_sensors.humidity: new checks which monitor the temperature, dew point and
humidity sensors of Papouch TH2E devices
* 3473 fileinfo.groups: the include patterns now also support the pattern YESTERDAY,
in addition to DATE...
* 3428 bluenet2_powerrail, bluenet2_powerrail.rcm, bluenet2_powerrail.temp,
bluenet2_powerrail.humidity: new checks for Bachmann Bluenet2 Powerrails which support the
BACHMANN-bluenet2-MIB
+ * 3524 fileinfo, fileinfo.groups: both checks are now cluster ready...
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative
to the agent installation directory...
* 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
* 3074 FIX: windows agent: fixed incorrect values for 32-bit performance counters
diff --git a/checks/fileinfo b/checks/fileinfo
index b5580c9..ff5201a 100644
--- a/checks/fileinfo
+++ b/checks/fileinfo
@@ -108,15 +108,19 @@ def check_fileinfo(item, params, info):
if len(info) == 0:
return (3, "no information sent by agent")
- outof_range_txt = fileinfo_check_timeranges(params)
- in_timerange = outof_range_txt == None
- reftime = int(info[0][0])
+ outof_range_txt = fileinfo_check_timeranges(params)
+ in_timerange = outof_range_txt == None
+ reftime = None
check_definition = False
- state_missing = params.get("state_missing", 3)
- for line in info[1:]:
+ state_missing = params.get("state_missing", 3)
+ for line in info:
+ if len(line) == 1:
+ reftime = int(line[0])
+ continue
+
if item == line[0]:
if line[1] == "missing":
- return in_timerange and state_missing or 0, "File not found" +
(outof_range_txt or "")
+ continue
state = 0
size = int(line[1])
age = reftime - int(line[2])
@@ -127,6 +131,7 @@ def check_fileinfo(item, params, info):
if check_definition == False:
return in_timerange and state_missing or 0, "File not found" +
(outof_range_txt or "")
+
return fileinfo_check_function(check_definition, params, outof_range_txt)
# Extracts patterns that are relevant for the current host and item.
@@ -151,7 +156,7 @@ def check_fileinfo_groups(item, params, info):
outof_range_txt = fileinfo_check_timeranges(params)
- reftime = int(info[0][0])
+ reftime = None
count_all = 0
age_oldest = None
@@ -161,7 +166,11 @@ def check_fileinfo_groups(item, params, info):
size_largest = 0
date_inclusion = ""
# Start counting values on all files
- for line in info[1:]:
+ for line in info:
+ if len(line) == 1:
+ reftime = int(line[0])
+ continue
+
for pattern in params['precompiled_patterns']:
inclusion, exclusion = pattern
inclusion_tmp = fileinfo_process_date(inclusion,reftime)