Module: check_mk
Branch: master
Commit: ea73754541a646d7084c4c8bec76b7c9e6964aaa
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ea73754541a646…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Oct 24 14:09:31 2017 +0200
5326 fileinfo.groups: Shows inclusion and exclusion patterns in long output
Change-Id: If26b7b8fec904af39cd164988f1512a02ccc9e8e
---
.werks/5326 | 10 ++++++++++
checks/fileinfo | 13 +++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/.werks/5326 b/.werks/5326
new file mode 100644
index 0000000..c08fbc6
--- /dev/null
+++ b/.werks/5326
@@ -0,0 +1,10 @@
+Title: fileinfo.groups: Shows inclusion and exclusion patterns in long output
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1508846964
+Class: feature
+
+
diff --git a/checks/fileinfo b/checks/fileinfo
index cba70c1..1ddac54 100644
--- a/checks/fileinfo
+++ b/checks/fileinfo
@@ -215,7 +215,8 @@ def fileinfo_groups_precompile(hostname, item, params):
def check_fileinfo_groups(item, params, info):
if not info:
- return 3, "No information sent by agent"
+ yield 3, "No information sent by agent"
+ return
outof_range_txt = fileinfo_check_timeranges(params)
reftime = None
@@ -226,6 +227,8 @@ def check_fileinfo_groups(item, params, info):
size_smallest = None
size_largest = 0
date_inclusion = ""
+ include_patterns = set([])
+ exclude_patterns = set([])
# Start counting values on all files
for line in info:
@@ -248,6 +251,8 @@ def check_fileinfo_groups(item, params, info):
pattern = (pattern, '')
inclusion, exclusion = pattern
+ include_patterns.add(inclusion)
+ exclude_patterns.add(exclusion)
inclusion_is_regex = False
exclusion_is_regex = False
@@ -311,7 +316,11 @@ def check_fileinfo_groups(item, params, info):
if date_inclusion:
check_definition.append(("Date pattern", "date pattern",
date_inclusion, str))
- return fileinfo_check_function(check_definition, params, outof_range_txt)
+ yield fileinfo_check_function(check_definition, params, outof_range_txt)
+ if include_patterns:
+ yield 0, "\nInclude patterns: %s" % ",
".join(include_patterns)
+ if exclude_patterns:
+ yield 0, "\nExclude patterns: %s" % ",
".join(exclude_patterns)
def fileinfo_check_function(check_definition, params, outof_range_txt):