Module: check_mk
Branch: master
Commit: 3e3f65ed1999ed1cc9de9a43db821650a52ee29d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3e3f65ed1999ed…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Mon Jan 11 15:07:17 2016 +0100
checkpoint checks: some fixes and improvements
---
checks/checkpoint_ha_status | 52 ++++++++++++++++++++++++------------------
checks/checkpoint_svn_status | 2 +-
2 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/checks/checkpoint_ha_status b/checks/checkpoint_ha_status
index 6312f87..7f111dd 100644
--- a/checks/checkpoint_ha_status
+++ b/checks/checkpoint_ha_status
@@ -25,38 +25,46 @@
# Boston, MA 02110-1301 USA.
+# .1.3.6.1.4.1.2620.1.5.2.0 1
+# .1.3.6.1.4.1.2620.1.5.3.0 6
+# .1.3.6.1.4.1.2620.1.5.4.0 0
+# .1.3.6.1.4.1.2620.1.5.5.0 yes
+# .1.3.6.1.4.1.2620.1.5.6.0 active
+# .1.3.6.1.4.1.2620.1.5.7.0 OK
+# .1.3.6.1.4.1.2620.1.5.101.0 0
+# .1.3.6.1.4.1.2620.1.5.103.0
+
+
def inventory_checkpoint_ha_status(info):
- if info:
+ installed, major, minor, started, state, block_state, stat_code, stat_long = info[0]
+ if installed != "0":
return [(None, None)]
-def check_checkpoint_ha_status(item, params, info):
- if info:
- installed, major, minor, started, state, block_state, stat_code, stat_long =
info[0]
-
- status = 0
- messages = []
- if installed != "1":
- messages.append("not installed")
- else:
- messages.append("installed (v%s.%s)" % (major, minor))
+def check_checkpoint_ha_status(_no_item, _no_params, info):
+ installed, major, minor, started, state, block_state, stat_code, stat_long = info[0]
- messages.append(state)
+ if installed == "0":
+ yield 2, "Not installed"
+ else:
+ yield 0, "Installed: v%s.%s" % (major, minor)
- if started == "yes":
- messages.append("started")
+ for val, infotext, ok_vals, warn_vals in [
+ (started, "Started", ["yes"], None),
+ (state, "Status", ["active",
"standby"], None),
+ (block_state, "Blocking", ["ok"],
["initializing"])
+ ]:
+ if ok_vals is None or val.lower() in ok_vals:
+ status = 0
+ elif warn_vals is not None and val.lower() in warn_vals:
+ status = 1
else:
- messages.append("stopped")
-
- if block_state != "OK":
- messages.append("blocking state: %s" % block_state)
status = 2
- if stat_code != "0":
- messages.append("status: %s" % stat_long)
- status = 2
+ yield status, "%s: %s" % (infotext, val)
- return status, ", ".join(messages)
+ if stat_code != "0":
+ yield 2, "Problem: %s" % stat_long
check_info['checkpoint_ha_status'] = {
diff --git a/checks/checkpoint_svn_status b/checks/checkpoint_svn_status
index 0eedd50..453b3d9 100644
--- a/checks/checkpoint_svn_status
+++ b/checks/checkpoint_svn_status
@@ -35,7 +35,7 @@ def check_checkpoint_svn_status(item, params, info):
major, minor, code, description = info[0]
ver = "v%s.%s" % (major, minor)
if int(code) != 0:
- return 2, descriptiona
+ return 2, description
else:
return 0, "OK (%s)" % ver