Module: check_mk
Branch: master
Commit: 64daab6b544f1848c61a6a42bfda4b28940c9e58
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=64daab6b544f18…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Wed Dec 17 18:14:33 2014 +0100
msexch_dag: minor code review
---
checks/msexch_dag | 56 ++++++++++++++++++++++++-----------------------------
1 file changed, 25 insertions(+), 31 deletions(-)
diff --git a/checks/msexch_dag b/checks/msexch_dag
index 77f02cc..522b34d 100644
--- a/checks/msexch_dag
+++ b/checks/msexch_dag
@@ -24,7 +24,7 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-# Example Output
+# Example Output:
# <<<msexch_dag:sep(58)>>>
# RunspaceId : d58353f4-f868-43b2-8404-25875841a47b
# Identity : Mailbox Database 1\S0141KL
@@ -72,7 +72,7 @@
# IncomingLogCopyingNetwork :
# SeedingNetwork :
# ActiveCopy : True
-#
+#
# RunspaceId : d58353f4-f868-43b2-8404-25875841a47b
# Identity : Mailbox Database 2\S0141KL
# Name : Mailbox Database 2\S0141KL
@@ -120,8 +120,6 @@
# SeedingNetwork :
# ActiveCopy : False
-
-
# .--dbcopy--------------------------------------------------------------.
# | _ _ |
# | __| | |__ ___ ___ _ __ _ _ |
@@ -130,21 +128,18 @@
# | \__,_|_.__/ \___\___/| .__/ \__, | |
# | |_| |___/ |
# +----------------------------------------------------------------------+
-# | |
-# '----------------------------------------------------------------------'
def inventory_msexch_dag_dbcopy(info):
- return inventory_msexch_dag_dbcopy_withkey( info, "Status" )
-
-def inventory_msexch_dag_dbcopy_withkey(info, key):
getit = False
+ key = "Status"
for line in info:
if len(line) == 2:
if line[0].strip() == "DatabaseName":
dbname = line[1].strip()
getit = True
elif getit and line[0].strip() == key:
- yield dbname, ( key, line[1].strip() )
+ yield dbname, (key, line[1].strip())
+ getit = False
def check_msexch_dag_dbcopy(item, params, info):
getit = False
@@ -157,10 +152,10 @@ def check_msexch_dag_dbcopy(item, params, info):
elif getit and key == inv_key:
if val == inv_val:
state = 0
- infotxt = "%s is %s" % ( inv_key, val )
+ infotxt = "%s is %s" % (inv_key, val)
else:
state = 1
- infotxt = "%s changed from %s to %s" % ( inv_key, inv_val,
val )
+ infotxt = "%s changed from %s to %s" % (inv_key, inv_val,
val)
return state, infotxt
check_info['msexch_dag.dbcopy'] = {
@@ -169,17 +164,16 @@ check_info['msexch_dag.dbcopy'] = {
"service_description" : "Exchange DAG DBCopy for %s",
}
+
#.
-# .--ContentIndex--------------------------------------------------------.
-# | ____ _ _ ___ _ |
-# | / ___|___ _ __ | |_ ___ _ __ | |_|_ _|_ __ __| | _____ __ |
-# | | | / _ \| '_ \| __/ _ \ '_ \| __|| || '_ \ / _` |/ _ \ \/ / |
-# | | |__| (_) | | | | || __/ | | | |_ | || | | | (_| | __/> < |
-# | \____\___/|_| |_|\__\___|_| |_|\__|___|_| |_|\__,_|\___/_/\_\ |
+# .--contentindex--------------------------------------------------------.
+# | _ _ _ _ |
+# | ___ ___ _ __ | |_ ___ _ __ | |_(_)_ __ __| | _____ __ |
+# | / __/ _ \| '_ \| __/ _ \ '_ \| __| | '_ \ / _` |/ _ \ \/ / |
+# | | (_| (_) | | | | || __/ | | | |_| | | | | (_| | __/> < |
+# | \___\___/|_| |_|\__\___|_| |_|\__|_|_| |_|\__,_|\___/_/\_\ |
# | |
# +----------------------------------------------------------------------+
-# | |
-# '----------------------------------------------------------------------'
def inventory_msexch_dag_contentindex(info):
for line in info:
@@ -209,16 +203,14 @@ check_info['msexch_dag.contentindex'] = {
#.
-# .--CopyQueue-----------------------------------------------------------.
-# | ____ ___ |
-# | / ___|___ _ __ _ _ / _ \ _ _ ___ _ _ ___ |
-# | | | / _ \| '_ \| | | | | | | | | |/ _ \ | | |/ _ \ |
-# | | |__| (_) | |_) | |_| | |_| | |_| | __/ |_| | __/ |
-# | \____\___/| .__/ \__, |\__\_\\__,_|\___|\__,_|\___| |
-# | |_| |___/ |
-# +----------------------------------------------------------------------+
+# .--copyqueue-----------------------------------------------------------.
# | |
-# '----------------------------------------------------------------------'
+# | ___ ___ _ __ _ _ __ _ _ _ ___ _ _ ___ |
+# | / __/ _ \| '_ \| | | |/ _` | | | |/ _ \ | | |/ _ \ |
+# | | (_| (_) | |_) | |_| | (_| | |_| | __/ |_| | __/ |
+# | \___\___/| .__/ \__, |\__, |\__,_|\___|\__,_|\___| |
+# | |_| |___/ |_| |
+# +----------------------------------------------------------------------+
msexch_dag_copyqueue_default_levels = (100, 200)
@@ -236,14 +228,16 @@ def check_msexch_dag_copyqueue(item, params, info):
if key == "DatabaseName" and val == item:
getit = True
elif getit and key == "CopyQueueLength":
+ infotxt = "Queue length is %d" % int(val)
if int(val) >= crit:
state = 2
+ infotxt += ", levels at %d/%d" % (warn, crit)
elif int(val) >= warn:
state = 1
+ infotxt += ", levels at %d/%d" % (warn, crit)
else:
state = 0
- infotxt = "Queue length is %d" % int(val)
- perfdata = [ ( "length", int(val), warn, crit, 0 ) ]
+ perfdata = [ ("length", int(val), warn, crit, 0) ]
return state, infotxt, perfdata
check_info['msexch_dag.copyqueue'] = {