Module: check_mk
Branch: master
Commit: f4b84dbf2eeec40aa0538149b929658e3569dcb4
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f4b84dbf2eeec4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 8 11:18:29 2010 +0100
heartbeat_rscstatus: Allowing a list as expected state to expect multiple OK states
---
ChangeLog | 1 +
checkman/heartbeat_rscstatus | 5 +++++
checks/heartbeat_rscstatus | 9 +++------
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 815e857..bcb06bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,6 +59,7 @@
* heartbeat_nodes: fix Linux agent for hostname with upper case letters (thanks to
Thorsten Robers)
* heartbeat_rscstatus: Catching empty output from agent correctly
+ * heartbeat_rscstatus: Allowing a list as expected state to expect multiple OK states
* win_dhcp_pools agent plugin: Filtering additional error message on
systems without dhcp server
diff --git a/checkman/heartbeat_rscstatus b/checkman/heartbeat_rscstatus
index da8fdaa..84c383e 100644
--- a/checkman/heartbeat_rscstatus
+++ b/checkman/heartbeat_rscstatus
@@ -16,5 +16,10 @@ description:
The resource status can be "all", "foreign", "local" or "none.
+[parameters]
+expected_state (string/list): The expected resource status. This can be one expected
+ state as string or multiple expected states given as list. The parameter defaults to
+ the resource status during inventory.
+
inventory:
Each node will get one service from this check.
diff --git a/checks/heartbeat_rscstatus b/checks/heartbeat_rscstatus
index 03a127e..67fe3ee 100644
--- a/checks/heartbeat_rscstatus
+++ b/checks/heartbeat_rscstatus
@@ -35,13 +35,10 @@
def inventory_heartbeat_rscstatus(checktype, info):
return [ (None, '"%s"' % line[0]) for line in info if line[0] != '' ]
-def check_heartbeat_rscstatus(item, expectedState, info):
- if len(info) == 0 or len(info[0]) == 0:
- return (3, "UNKNOWN - Got no data from agent")
-
- if info[0][0] == expectedState:
+def check_heartbeat_rscstatus(item, expected_state, info):
+ if (type(expected_state) == list and info[0][0] in expected_state) or info[0][0] == expected_state:
return (0, "OK - Current state: %s" % (info[0][0]))
else:
- return (2, "CRITICAL - Current state: %s (Expected: %s)" % (info[0][0], expectedState))
+ return (2, "CRITICAL - Current state: %s (Expected: %s)" % (info[0][0], expected_state))
check_info['heartbeat_rscstatus'] = (check_heartbeat_rscstatus, "Heartbeat Ressource Status", 0, inventory_heartbeat_rscstatus)
Module: check_mk
Branch: master
Commit: 4c7c5f1ac43651d00d99d0aa1bc7899a19628e7f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4c7c5f1ac43651…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Nov 6 22:23:56 2010 +0100
Updated internal doku
---
LIESMICH.zutun | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/LIESMICH.zutun b/LIESMICH.zutun
index 4202b3f..ec0ce27 100644
--- a/LIESMICH.zutun
+++ b/LIESMICH.zutun
@@ -483,3 +483,16 @@ konfigurierbar machen:
fake_perfdata = [ ... ]
Idee: Inventurcheck könnte gleich die Checkergebnisse berechnen
+
+local-Struktur: Hier gibt es scheinbar einen Bug in mod_python.
+index.py -> execfile(plugins/pages/...) -> import config
+Jetzt bekommt man eine neue Instanz von config. In dem importierten
+Modul kann man das wie folgt reparieren:
+from mod_python import importer, apache
+config = importer.import_module("config",
+ path = ["/omd/sites/webconf/share/check_mk/web/htdocs"])
+Das kann aber doch keine Lösung sein. Andererseits braucht man
+dies nur wenn wenn in config was ändert oder bei livestatus
+(wegen der persistenten Verbindungen). Sonst kanns einem egal
+sein, wenn man ein neues Modul bekommt.
+