Module: check_mk
Branch: master
Commit: f68a98683ec025cc9faafff9df139d97f2bd862f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f68a98683ec025…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Fri Nov 15 10:56:52 2013 +0100
veeam_client: limits for time since last backup introduced
---
.werks/69 | 8 +++++++
ChangeLog | 2 +-
checkman/veeam_client | 24 +++++++++++++++++---
checks/veeam_client | 40 +++++++++++++++++++++++++++++-----
web/plugins/wato/check_parameters.py | 20 +++++++++++++++++
5 files changed, 85 insertions(+), 9 deletions(-)
diff --git a/.werks/69 b/.werks/69
new file mode 100644
index 0000000..acfad14
--- /dev/null
+++ b/.werks/69
@@ -0,0 +1,8 @@
+Title: veeam_client: limits for time since last backup introduced
+Level: 1
+Component: checks
+Version: 1.2.3i7
+Date: 1384509363
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 3639ddb..f2aede8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@
* 0208 fileinfo.groups: Added minimum/maximum file size parameters...
* 0093 check_http: Default service description prefix can be avoided...
* 0004 df: dynamic filesystem levels now reorder levels automatically...
+ * 0069 veeam_client: limits for time since last backup introduced
* 0024 FIX: cisco_wlc: removed configuration parameter ap_model
* 0065 FIX: veeam_client: check behaviour improved when backup is in progress
* 0066 FIX: veeam_jobs: check behaviour improved when backup is in progress
@@ -37,7 +38,6 @@
WATO:
* 0053 New rule for configuring the display_name of a service...
- * 0008 Test - Please ignore...
* 0048 FIX: Fixed locking issue on host diagnose page
* 0033 FIX: WATO forms: incorrect handling of checkbox state
* 0205 FIX: Allowing star chars in variable names to fix role/permission editing...
diff --git a/checkman/veeam_client b/checkman/veeam_client
index 83ce3fb..c74a1f6 100644
--- a/checkman/veeam_client
+++ b/checkman/veeam_client
@@ -17,11 +17,29 @@ description:
or {InProgress}. It is {WARN} if the status is {Warning}. It is {CRIT}
if the status of the backup is {Failed}.
-inventory:
- A check will be created for all hosts known to check_mk and reported
- by the Veeam agent plugin.
+ In addition {WARN} and {CRIT} levels can be set for the time since the end
+ of the last backup.
+
+examples:
+ # sets the warning and critical levels to 5 and 10 days, respectively
+ veeam_client_default_levels = { "age": ( 432000, 864000 ) }
perfdata:
Total Size, duration and the average speed of the backup will be recorded
as performance data. Duration will not be recorded if the status of the backup
is {Pending} or {InProgress}.
+
+inventory:
+ A check will be created for all hosts known to check_mk and reported
+ by the Veeam agent plugin.
+
+[parameters]
+parameters(tuple): parameters is a dictionary with one value
+
+ {"age"}: a tuple of warning and critical limits for the time since last
+ backup in seconds
+
+
+[configuration]
+veeam_client_default_levels (dict): This variable is preset to
+{{ "age": ( 108000, 172800 ) } }
diff --git a/checks/veeam_client b/checks/veeam_client
index 2b11b8f..53c1c1e 100644
--- a/checks/veeam_client
+++ b/checks/veeam_client
@@ -24,13 +24,22 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+import datetime, time
+
+veeam_client_default_levels = { "age": ( 108000, 172800 ) } # 30h/2d
+
state = { "Success": 0, "Failed": 2, "Warning":1,
"InProgress":0, "Pending":0 }
def inventory_veeam_client(info):
if info[0][0] == "Status":
- return [ (None, None) ]
+ return [ (None, veeam_client_default_levels) ]
def check_veeam_client(item, params, info):
+ if params.get("age"):
+ warn, crit = params['age']
+ else:
+ warn, crit = veeam_default_levels.get("age")
+
if not info[0][0] == "Status":
return 3, "No status data found in first line of agent data"
result = ""
@@ -57,18 +66,39 @@ def check_veeam_client(item, params, info):
elif line[0] == "TotalSizeByte":
totalsize = saveint(line[1])
perfdata.append(("totalsize", totalsize, 0, 0, 0))
- else:
- if (result == "InProgress" or result == "Pending") and
line[0] == "StopTime":
+ elif line[0] == "StopTime":
+ if (result == "InProgress" or result == "Pending"):
infotxt += line[0] + ": - "
else:
- infotxt += line[0] + ":" + line[1] + " "
+ now = datetime.datetime.now()
+ date, time = line[1].split(" ")
+ day, month, year = map(int, date.split("."))
+ hour, minute, second = map(int, time.split(":"))
+ stoptime = datetime.datetime( year, month, day, hour, minute, second)
+ warndiff = datetime.timedelta(seconds=warn)
+ critdiff = datetime.timedelta(seconds=crit)
+
+ if critdiff < now - stoptime:
+ stopstate = 2
+ stopsym = "( >%s ago)(!!)" %
get_age_human_readable(crit)
+ elif warndiff < now - stoptime:
+ stopstate = 1
+ stopsym = "( >%s ago)(!)" %
get_age_human_readable(warn)
+ else:
+ stopstate = 0
+ stopsym = ""
+ infotxt += line[0] + ":" + line[1] + stopsym + " "
+ else:
+ infotxt += line[0] + ":" + line[1] + " "
- return (state[result], infotxt, perfdata)
+ status = max(state[result], stopstate)
+ return (status, infotxt, perfdata)
check_info["veeam_client"] = {
'check_function': check_veeam_client,
'inventory_function': inventory_veeam_client,
'service_description': 'VEEAM Client',
+ 'group': 'veeam_backup',
'has_perfdata': True,
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index e970bc3..bb4f649 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2410,6 +2410,26 @@ register_check_parameters(
register_check_parameters(
subgroup_applications,
+ "veeam_backup",
+ _("Veeam Time since last Backup"),
+ Dictionary(
+ elements = [
+ ("age",
+ Tuple(
+ title = _("Time since end of last backup"),
+ elements = [
+ Age(title = _("Warning if older than"), default_value =
108000),
+ Age(title = _("Critical if older than"), default_value =
172800)
+ ]
+ )
+ )]
+ ),
+ None,
+ None
+)
+
+register_check_parameters(
+ subgroup_applications,
"mssql_counters_locks",
_("MSSQL Locks"),
Dictionary(