Module: check_mk
Branch: master
Commit: fd73e2b4be2e872436cba2ea57965e78114a078e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fd73e2b4be2e87…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Fri Jan 24 13:31:21 2014 +0100
unitrends_replication: Check for monitoring Replicaion staus on Unitrend systems
---
.werks/128 | 8 +++++
ChangeLog | 1 +
agents/plugins/unitrends_replication.py | 25 ++++++++++++++
checkman/unitrends_backup | 2 +-
checkman/unitrends_replication | 16 +++++++++
checks/unitrends_replication | 54 +++++++++++++++++++++++++++++++
6 files changed, 105 insertions(+), 1 deletion(-)
diff --git a/.werks/128 b/.werks/128
new file mode 100644
index 0000000..53625dc
--- /dev/null
+++ b/.werks/128
@@ -0,0 +1,8 @@
+Title: unitrends_replication: Check for monitoring Replicaion staus on Unitrend systems
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1390566649
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 24ba9df..5ebc407 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -69,6 +69,7 @@
* 0571 cmciii_lcp_fans: now monitors the lower limit for the rpm
* 0572 cmciii_lcp_waterflow: lower and upper limits to the flow are now monitored
* 0573 cmciii_lcp_airin, cmciii_lcp_airout, cmciii_lcp_waterin, cmciii_lcp_waterout:
checks now observe limits to the temperatures
+ * 0128 unitrends_replication: Check for monitoring Replicaion staus on Unitrend
systems
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/agents/plugins/unitrends_replication.py
b/agents/plugins/unitrends_replication.py
new file mode 100755
index 0000000..a5e3fb6
--- /dev/null
+++ b/agents/plugins/unitrends_replication.py
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+
+import sys, time, urllib
+from xml.dom import minidom
+now = int(time.time())
+start = now - 24 * 60 * 60
+end = now
+dpu = 1
+
+url =
"http://localhost/recoveryconsole/bpl/syncstatus.php?type=replicate&arguments=start:%s,end:%s&sid=%s&auth=1:"
% ( start, end, dpu )
+xml = urllib.urlopen(url)
+
+print "<<<unitrends_replication:sep(124)>>>"
+dom = minidom.parse(xml)
+for item in dom.getElementsByTagName('SecureSyncStatus'):
+ application = item.getElementsByTagName('Application')
+ if application:
+ application = application[0].attributes['Name'].value
+ else:
+ application = "N/A"
+ result = item.getElementsByTagName('Result')[0].firstChild.data
+ completed = item.getElementsByTagName('Complete')[0].firstChild.data
+ targetname = item.getElementsByTagName('TargetName')[0].firstChild.data
+ instancename = item.getElementsByTagName('InstanceName')[0].firstChild.data
+ print "%s|%s|%s|%s|%s" % (application, result, completed, targetname,
instancename)
diff --git a/checkman/unitrends_backup b/checkman/unitrends_backup
index d8787c7..9350d8d 100644
--- a/checkman/unitrends_backup
+++ b/checkman/unitrends_backup
@@ -5,7 +5,7 @@ license: GPL
distribution: check_mk
description:
Unitrends is a enterprise class backup solution.
- This plugin needs the unitrends_backup plugin installed on the unitrends server
+ This check needs the unitrends_backup.php plugin installed on the unitrends server
in order to work. The plugin will deliver a complete list of all schedules including
a sublist of a jobs in this schdule from the last 24 hours.
diff --git a/checkman/unitrends_replication b/checkman/unitrends_replication
new file mode 100644
index 0000000..2b90778
--- /dev/null
+++ b/checkman/unitrends_replication
@@ -0,0 +1,16 @@
+title: Unitrends Replication status
+agents: linux
+catalog: app/unitrends
+license: GPL
+distribution: check_mk
+description:
+ Unitrends is a enterprise class backup solution.
+ This check needs the unitrends_replication.py plugin installed on the unitrends server
+ in order to work. The plugin will deliver a complete list of all replication entries
and
+ her status
+
+ As long all of the jobs are succsessful the check returns a {OK} state. In each other
+ case the check will return {CRITICAL} and deliver the list of the failed replications
+
+inventory:
+ One Service for each replication target will be created
diff --git a/checks/unitrends_replication b/checks/unitrends_replication
new file mode 100644
index 0000000..959a206
--- /dev/null
+++ b/checks/unitrends_replication
@@ -0,0 +1,54 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+
+def inventory_unitrends_replication(info):
+ inventory = []
+ for application, result, complete, target, instance in info:
+ if target not in [ x[0] for x in inventory ]:
+ inventory.append( (target, None) )
+ return inventory
+
+def check_unitrends_replication(item, _no_params, info):
+ # this never gone be a blessed check :)
+ replications = [ x for x in info if x[3] == item ]
+ if len(replications) == 0:
+ return 3, "No Entries found"
+ not_successfull = [ x for x in replications if x[1] != "Success"]
+ if len(not_successfull) == 0:
+ return 0, "All Replications in the last 24 hours Successfull"
+ messages = []
+ for application, result, complete, target, instance in not_successfull:
+ messages.append( "Target: %s, Result: %s, Instance: %s " % ( target,
result, instance ))
+ # TODO: Maybe a good place to use multiline output here
+ return 2, "Errors from the last 24 hours: " + "/ ".join(messages)
+
+check_info["unitrends_replication"] = {
+ "check_function" : check_unitrends_replication,
+ "inventory_function" : inventory_unitrends_replication,
+ "service_description" : "Replicaion %s",
+}
+