Module: check_mk
Branch: master
Commit: 275a62c08b58531e2d97a216749236b336b045b8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=275a62c08b5853…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Mon Oct 10 18:42:37 2016 +0200
3945 fortigate_node: Memory on fortigate clusters are now configurable by WATO
Memory on fortigate clusters are now configurable by WATO similar to other memory checks.
---
.werks/3945 | 9 +++++++++
ChangeLog | 1 +
checks/fortigate_node | 34 ++++++++++++++++++++--------------
web/plugins/wato/check_parameters.py | 34 ++++++++++++++++++++++++++++++++++
4 files changed, 64 insertions(+), 14 deletions(-)
diff --git a/.werks/3945 b/.werks/3945
new file mode 100644
index 0000000..4ae604c
--- /dev/null
+++ b/.werks/3945
@@ -0,0 +1,9 @@
+Title: fortigate_node: Memory on fortigate clusters are now configurable by WATO
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i2
+Date: 1476117532
+Class: feature
+
+Memory on fortigate clusters are now configurable by WATO similar to other memory
checks.
diff --git a/ChangeLog b/ChangeLog
index de0a0ee..b54045a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
* 3912 elphase.include: now device states can be mapped to monitoring states
* 3913 gude_relayport, gude_temp, gude_humidity: new checks and relayport check now
monitors electricity
* 3954 postfix_mailq_status: new check which monitors the status of postfix mail
instances
+ * 3945 fortigate_node: Memory on fortigate clusters are now configurable by WATO...
* 3894 FIX: mkeventd_status: Fixed bug in case Event Console is not running
* 3907 FIX: oracle_tablespaces: simplyfied free space calculation depending on
version...
* 3819 FIX: windows agent: fixed 2 bugs related to mrpe...
diff --git a/checks/fortigate_node b/checks/fortigate_node
index 521695a..4bc1b10 100644
--- a/checks/fortigate_node
+++ b/checks/fortigate_node
@@ -165,34 +165,38 @@ check_info["fortigate_node.cpu"] = {
# '----------------------------------------------------------------------'
-fortigate_node_memory_default_levels = (70, 80)
+#fortigate_node_memory_default_levels = (70, 80)
+factory_settings['fortigate_node_memory_default_levels'] = {
+ 'levels' : ( 70.0, 80.0 ),
+}
def inventory_fortigate_node_mem(parsed):
for hostname in parsed["nodes"]:
- yield hostname, "fortigate_node_memory_default_levels"
+ yield hostname, {}
def check_fortigate_node_mem(item, params, parsed):
if item in parsed["nodes"]:
- if type(params) == dict:
- params = params["levels"]
-
+ status = 3
+ current = parsed["nodes"][item]["memory"]
# This check is only able to check the used space
# The checkgroup "memory" might set negative values which act as levels
for free space
# These levels are converted to used space, too..
- warn, crit = map(abs, params)
-
- current = parsed["nodes"][item]["memory"]
+ if type(params) == dict:
+ warn, crit = map(abs, params["levels"])
+ else:
+ warn, crit = map(abs, params)
- status = 0
if current >= crit:
status = 2
elif current >= warn:
status = 1
+ else:
+ status = 0
if status > 0:
- wcsuffix = ", (warn/crit at %d/%d)" % (warn, crit)
+ wcsuffix = ", (warn/crit at %d/%d)" % (float(warn), float(crit))
else:
wcsuffix = ""
@@ -201,10 +205,12 @@ def check_fortigate_node_mem(item, params, parsed):
check_info["fortigate_node.memory"] = {
- "inventory_function" : inventory_fortigate_node_mem,
- "check_function" : check_fortigate_node_mem,
- "service_description" : "Memory usage %s",
- "has_perfdata" : True,
+ "inventory_function" : inventory_fortigate_node_mem,
+ "check_function" : check_fortigate_node_mem,
+ "service_description" : "Memory usage %s",
+ "has_perfdata" : True,
+ "default_levels_variable" :
"fortigate_node_memory_default_levels",
+ "group" : "fortigate_node_memory",
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index adc6508..eba58d5 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -4051,6 +4051,40 @@ register_check_parameters(
)
#.
+# .--Os------------------------------------------------------------------.
+# | ___ |
+# | / _ \ ___ |
+# | | | | / __| |
+# | | |_| \__ \ |
+# | \___/|___/ |
+# | |
+# +----------------------------------------------------------------------+
+# | |
+# '----------------------------------------------------------------------'
+
+register_check_parameters(
+ subgroup_os,
+ "fortigate_node_memory",
+ _("Fortigate node memory"),
+ Dictionary(
+ elements = [
+ ("levels", Tuple (
+ title = _("Levels"),
+ elements = [
+ Percentage(title = _("Warning at"), default_value = 70.0,
),
+ Percentage(title = _("Critical at"), default_value = 80.0,
),
+ ],
+ ))
+ ],
+ ),
+ TextAscii(
+ title = _("node"),
+ ),
+ "dict",
+)
+
+
+#.
# .--Unsorted--(Don't create new stuff here!)----------------------------.
# | _ _ _ _ |
# | | | | |_ __ ___ ___ _ __| |_ ___ __| | |