Module: check_mk
Branch: master
Commit: 3aa7f5a88b3541fb36fd807f040a4a24f724e778
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3aa7f5a88b3541…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Fri Dec 16 15:57:07 2016 +0100
4104 veeam_tapejobs: New check to monitor Veeam tape jobs
Change-Id: I854c999570ac2772eea8cc0893dbe7e7ba5bc9ac
---
.werks/4104 | 9 ++++
ChangeLog | 1 +
agents/windows/plugins/veeam_backup_status.ps1_ | 13 +++++
checkman/veeam_tapejobs | 19 ++++++++
checks/veeam_tapejobs | 65 +++++++++++++++++++++++++
5 files changed, 107 insertions(+)
diff --git a/.werks/4104 b/.werks/4104
new file mode 100644
index 0000000..cc3317e
--- /dev/null
+++ b/.werks/4104
@@ -0,0 +1,9 @@
+Title: veeam_tapejobs: New check to monitor Veeam tape jobs
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i3
+Date: 1481900204
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 68736f9..7734834 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,7 @@
* 4110 netscaler_vserver: now lower levels for health are configurable
* 4098 ups_cps_battery, ups_cps_battery.temp, ups_cps_inphase, ups_cps_outphase:
Several checks to monitor CPS UPS devices
* 4118 check_bi_aggr: changed check and WATO rule to support Kerberos auth...
+ * 4104 veeam_tapejobs: New check to monitor Veeam tape jobs
* 3987 FIX: Check_MK Agent Access: Windows agent reported incorrect only from value
* 3952 FIX: diskstat: fixed bug if multipath devices having an alias...
* 3939 FIX: f5_bigip_conns: readded performance data and graphs...
diff --git a/agents/windows/plugins/veeam_backup_status.ps1_
b/agents/windows/plugins/veeam_backup_status.ps1_
index 7fd893b..88df1f5 100644
--- a/agents/windows/plugins/veeam_backup_status.ps1_
+++ b/agents/windows/plugins/veeam_backup_status.ps1_
@@ -22,6 +22,19 @@ Add-PSSnapin VeeamPSSnapIn -ErrorAction SilentlyContinue
try
{
+$tapeJobs = Get-VBRTapeJob
+write-host "<<<veeam_tapejobs>>>"
+write-host "JobName JobID LastResult LastState"
+foreach ($tapeJob in $tapeJobs)
+ {
+ $jobName = $tapeJob.Name
+ $jobID = $tapeJob.Id
+ $lastResult = $tapeJob.LastResult
+ $lastState = $tapeJob.LastState
+ write-host "$jobName $jobID $lastResult $lastState"
+ }
+
+
$myJobsText = "<<<veeam_jobs:sep(9)>>>`n"
$myTaskText = ""
diff --git a/checkman/veeam_tapejobs b/checkman/veeam_tapejobs
new file mode 100644
index 0000000..9fafec6
--- /dev/null
+++ b/checkman/veeam_tapejobs
@@ -0,0 +1,19 @@
+title: Veeam Tape Jobs
+agents: windows
+catalog: os/storage
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the status of the tape jobs run by the Veeam
+ backup tool. In order to carry out the check, the Veeam agent plugin
+ needs to be installed on the backup server. See special instructions in the
+ comment section of the Veeam agent plugin powershell scripts on how to install
+ the scripts.
+
+ This check is {OK} if the last tape job ran successfully and {CRIT} otherwise.
+
+inventory:
+ One check will be created for each tape job run by the Veeam tool.
+
+item:
+ The name of the tape job.
diff --git a/checks/veeam_tapejobs b/checks/veeam_tapejobs
new file mode 100644
index 0000000..0e45e71
--- /dev/null
+++ b/checks/veeam_tapejobs
@@ -0,0 +1,65 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2016 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-
+# tails. 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 parse_veeam_tapejobs(info):
+ parsed = {}
+ columns = map(lambda s: s.lower(), info[0])
+
+ for line in info[1:]:
+ name = " ".join( line[:-(len(columns)-1)] )
+ job_id, last_result, last_state = line[-(len(columns)-1):]
+ parsed[name] = {
+ "job_id" : job_id,
+ "last_result" : last_result,
+ "last_state" : last_state,
+ }
+
+ return parsed
+
+
+def inventory_veeam_tapejobs(parsed):
+ for job in parsed:
+ yield job, None
+
+
+def check_veeam_tapejobs(item, _no_params, parsed):
+ last_result = parsed[item]["last_result"]
+ last_state = parsed[item]["last_state"]
+
+ if last_result == "Success":
+ yield 0, "Last backup successful"
+ else:
+ yield 2, "Last backup result: " + last_result
+
+ yield 0, "Last state: " + last_state
+
+
+check_info["veeam_tapejobs"] = {
+ 'parse_function' : parse_veeam_tapejobs,
+ 'inventory_function' : inventory_veeam_tapejobs,
+ 'check_function' : check_veeam_tapejobs,
+ 'service_description' : 'VEEAM Tape Job %s',
+}