Module: check_mk
Branch: master
Commit: 89de71379f519ed68f18b163138c67a0ded54571
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=89de71379f519e…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Mar 4 16:10:21 2016 +0100
3001 fileinfo: now able to configure resulting state if file is missing
---
.werks/3001 | 9 +++++++++
ChangeLog | 1 +
checks/fileinfo | 5 +++--
web/plugins/wato/check_parameters.py | 6 ++++++
4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/.werks/3001 b/.werks/3001
new file mode 100644
index 0000000..971847a
--- /dev/null
+++ b/.werks/3001
@@ -0,0 +1,9 @@
+Title: fileinfo: now able to configure the checks status if the file is missing
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1457104202
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 2bdc503..2d0b64d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,7 @@
* 3083 mk_jolokia: The plugin can now be configured with a service url to treat the
jolokia server as a jmx proxy
* 3085 fortigate_signatures: new check to monitor av and ips signatures on fortigate
firewalls...
* 3257 dell_idrac_virtdisks: new check which monitors the virtual disks of a Dell
IDrac Device
+ * 3001 fileinfo: now able to configure the checks status if the file is missing
* 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 405fc08..51c46a4 100644
--- a/checks/fileinfo
+++ b/checks/fileinfo
@@ -108,10 +108,11 @@ def check_fileinfo(item, params, info):
in_timerange = outof_range_txt == None
reftime = int(info[0][0])
check_definition = False
+ state_missing = params.get("state_missing", 3)
for line in info[1:]:
if item == line[0]:
if line[1] == "missing":
- return in_timerange and 3 or 0, "File not found" +
(outof_range_txt or "")
+ return in_timerange and state_missing or 0, "File not found" +
(outof_range_txt or "")
state = 0
size = int(line[1])
age = reftime - int(line[2])
@@ -121,7 +122,7 @@ def check_fileinfo(item, params, info):
("age", age, get_age_human_readable) ]
if check_definition == False:
- return in_timerange and 3 or 0, "File not found" + (outof_range_txt or
"")
+ 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.
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index c99ad00..9c2ba0c 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2390,6 +2390,12 @@ register_check_parameters(
help = _("Outside these ranges the check will always be
OK"),
count = 3,
)),
+ ("state_missing",
+ MonitoringState(
+ default_value = 3,
+ title = _("State when file is missing")
+ )
+ ),
]
),
TextAscii(