Module: check_mk
Branch: master
Commit: 7ae86839324bebdd03b4c73cb11e6f021b8b62cd
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7ae86839324beb…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jan 23 16:34:41 2014 +0100
Remove obsolete option -u, --cleanup-autochecks
The option <tt>-u</tt> / <tt>--cleanup-autochecks</tt> has been removed.
Autocheck files in <tt>var/check_mk/autochecks</tt> are now always
cleaned up (i.e. one file per host).
---
.bugs/2100 | 6 ++++--
.werks/695 | 10 ++++++++++
ChangeLog | 2 ++
modules/check_mk.py | 24 +++++-------------------
web/plugins/wato/check_mk_configuration.py | 8 --------
5 files changed, 21 insertions(+), 29 deletions(-)
diff --git a/.bugs/2100 b/.bugs/2100
index 6d1602b..a0a76ae 100644
--- a/.bugs/2100
+++ b/.bugs/2100
@@ -1,8 +1,10 @@
Title: OpenLDAP: Group sync seems broken
Component: multisite
-State: open
+Class: bug
+State: done
Date: 2013-12-17 13:38:38
Targetversion: 1.2.4
-Class: bug
Groups are not synced anymore. The search-filter on the distinguishedName does not work in Openldap, nor can "dn" be used in a searchfilter.
+
+2014-01-23 16:13:08: changed state open -> done
diff --git a/.werks/695 b/.werks/695
new file mode 100644
index 0000000..dbb0529
--- /dev/null
+++ b/.werks/695
@@ -0,0 +1,10 @@
+Title: Remove obsolete option -u, --cleanup-autochecks
+Level: 1
+Component: core
+Version: 1.2.5i1
+Date: 1390491224
+Class: incomp
+
+The option <tt>-u</tt> / <tt>--cleanup-autochecks</tt> has been removed.
+Autocheck files in <tt>var/check_mk/autochecks</tt> are now always
+cleaned up (i.e. one file per host).
diff --git a/ChangeLog b/ChangeLog
index f8cb1d0..0d49002 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@
* 0452 Speedup generation of configuration...
* 0124 Support multiline plugin output for Check_MK Checks...
* 0675 Activate inline SNMP per default (if available)...
+ * 0695 Remove obsolete option -u, --cleanup-autochecks...
+ NOTE: Please refer to the migration notes!
* 0087 FIX: Fixed possible locking issue when using datasource program with long output...
* 0313 FIX: Avoid duplicate reading of configuration file on --create-rrd...
* 0379 FIX: check_mk -c: Now also rewrites the location of conf.d directory
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 28a2513..2d64184 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -252,7 +252,7 @@ inventory_check_severity = 1 # warning
inventory_check_do_scan = True # include SNMP scan for SNMP devices
inventory_max_cachefile_age = 120 # secs.
inventory_check_autotrigger = True # Automatically trigger inv-check after automation-inventory
-always_cleanup_autochecks = True
+always_cleanup_autochecks = None # For compatiblity with old configuration
# Nagios templates and other settings concerning generation
# of Nagios configuration files. No need to change these values.
@@ -4508,9 +4508,8 @@ Copyright (C) 2009 Mathias Kettner
def usage():
print """WAYS TO CALL:
cmk [-n] [-v] [-p] HOST [IPADDRESS] check all services on HOST
- cmk [-u] -I [HOST ..] inventory - find new services
- cmk [-u] -II ... renew inventory, drop old services
- cmk -u, --cleanup-autochecks reorder autochecks files
+ cmk -I [HOST ..] inventory - find new services
+ cmk -II ... renew inventory, drop old services
cmk -N [HOSTS...] output Nagios configuration
cmk -B create configuration for core
cmk -C, --compile precompile host checks
@@ -4572,10 +4571,6 @@ NOTES:
-II does the same as -I but deletes all existing checks of the
specified types and hosts.
- -u, --cleanup-autochecks resorts all checks found by inventory
- into per-host files. It can be used as an options to -I or as
- a standalone operation.
-
-N outputs the Nagios configuration. You may optionally add a list
of hosts. In that case the configuration is generated only for
that hosts (useful for debugging).
@@ -5665,7 +5660,7 @@ def output_profile():
# Do option parsing and execute main function -
# if check_mk is not called as module
if __name__ == "__main__":
- short_options = 'SHVLCURODMmd:Ic:nhvpXPuNB'
+ short_options = 'SHVLCURODMmd:Ic:nhvpXPNB'
long_options = [ "help", "version", "verbose", "compile", "debug",
"list-checks", "list-hosts", "list-tag", "no-tcp", "cache",
"flush", "package", "localize", "donate", "snmpwalk", "snmptranslate",
@@ -5673,7 +5668,7 @@ if __name__ == "__main__":
"snmpget=", "profile", "keepalive", "keepalive-fd=", "create-rrd",
"no-cache", "update", "restart", "reload", "dump", "fake-dns=",
"man", "nowiki", "config-check", "backup=", "restore=",
- "check-inventory=", "paths", "cleanup-autochecks", "checks=",
+ "check-inventory=", "paths", "checks=",
"cmc-file=", "browse-man", "list-man", "update-dns-cache" ]
non_config_options = ['-L', '--list-checks', '-P', '--package', '-M', '--notify',
@@ -5713,8 +5708,6 @@ if __name__ == "__main__":
opt_showperfdata = True
elif o == '-n':
opt_dont_submit = True
- elif o in [ '-u', '--cleanup-autochecks' ]:
- opt_cleanup_autochecks = True
elif o == '--fake-dns':
fake_dns = a
elif o == '--keepalive':
@@ -5928,14 +5921,7 @@ if __name__ == "__main__":
for checkname in checknames:
make_inventory(checkname, hostnames, False)
- # -u, --cleanup-autochecks called in stand alone mode
- if opt_cleanup_autochecks or always_cleanup_autochecks:
- do_cleanup_autochecks()
- done = True
-
- if not done and opt_cleanup_autochecks: # -u as standalone option
do_cleanup_autochecks()
- done = True
if done:
diff --git a/web/plugins/wato/check_mk_configuration.py b/web/plugins/wato/check_mk_configuration.py
index c71c642..162fd60 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -1256,14 +1256,6 @@ register_configvar(group,
need_restart = True
)
-register_configvar(group,
- "always_cleanup_autochecks",
- Checkbox(title = _("Always cleanup autochecks"),
- help = _("When switched on, Check_MK will always cleanup the autochecks files "
- "after each inventory, i.e. create one file per host. This is the same "
- "as adding the option <tt>-u</tt> to each call of <tt>-I</tt> on the "
- "command line.")))
-
group = _("Check configuration")
Module: check_mk
Branch: master
Commit: c6d92d548f92adaed8f5cd3c353d1cfa64600200
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c6d92d548f92ad…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jan 23 16:12:41 2014 +0100
Updated bug entries #0839
---
.bugs/839 | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/.bugs/839 b/.bugs/839
index a926bd0..dd5e3ef 100644
--- a/.bugs/839
+++ b/.bugs/839
@@ -1,9 +1,9 @@
Title: printer suply levels for ricoh
Component: checks
-State: open
+Class: bug
+State: done
Date: 2014-01-07 11:08:41
Targetversion: future
-Class: bug
Prinzipiell funktioniert der Check check_mk-printer_supply_ricoh gut allerdings haben wir festgestellt, dass er die Patronen verkehrt auswertet.
@@ -12,3 +12,5 @@ Sprich wo 80% die Patrone voll ist erreicht die Auswertung 20% im Monitoring Sy
Sprich nach Tausch ist der Drucker sofort auf kritisch und beim leer werden auf 100% voll.
+
+2014-01-23 16:12:39: changed state open -> done
Module: check_mk
Branch: master
Commit: e65352db8ef01a3350b8c2f5cd342650c626531c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e65352db8ef01a…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Jan 23 14:29:30 2014 +0100
psperf.bat: moved to deprecated folder
---
agents/windows/plugins/{ => deprecated}/psperf.bat | 0
checks/ps | 3 +++
2 files changed, 3 insertions(+)
diff --git a/agents/windows/plugins/psperf.bat b/agents/windows/plugins/deprecated/psperf.bat
similarity index 100%
rename from agents/windows/plugins/psperf.bat
rename to agents/windows/plugins/deprecated/psperf.bat
diff --git a/checks/ps b/checks/ps
index 6bea6eb..01bbe5b 100644
--- a/checks/ps
+++ b/checks/ps
@@ -37,6 +37,9 @@
# (user, virtual_size, resident_size, %cpu, processID, pagefile_usage, usermodetime, kernelmodetime, openHandles, threadCount) name
#(\\KLAPPRECHNER\ab,29284,2948,0,3124,904,400576,901296,35,1) NOTEPAD.EXE
+# The plugin "psperf.bat" is depracted. As of version 1.2.5 all of this information
+# is reported by the windows agent itself. However, we still support sections from psperf.bat
+# if the agent version is lower than 1.2.5.
# Windows agent now ships a plugin "psperf.bat" that adds a section from wmic
# to the output:
# <<<ps:sep(44)>>>
Module: check_mk
Branch: master
Commit: dc3cd6973868e8b1f0948ef3818bb5420a399bec
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dc3cd6973868e8…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Jan 23 13:18:30 2014 +0100
Added files from unitrends backup
---
.werks/125 | 4 +-
agents/plugins/unitrends_backup.php | 64 +++++++++++++++++++++++++++++
checkman/unitrends_backup | 17 ++++++++
checks/unitrends_backup | 76 +++++++++++++++++++++++++++++++++++
4 files changed, 159 insertions(+), 2 deletions(-)
diff --git a/.werks/125 b/.werks/125
index fffd5d6..4b74c0f 100644
--- a/.werks/125
+++ b/.werks/125
@@ -1,4 +1,4 @@
-Title: Unitrends Backup
+Title: unitrends_backup:Unitrends Backup
Level: 1
Component: checks
Version: 1.2.5i1
@@ -6,5 +6,5 @@ Date: 1390467872
Class: feature
Unitrends is a enterprise class backup solution.
-This check kann monitor the Backup schedules from unitrends.
+This check can monitor the Backup schedules from unitrends.
diff --git a/agents/plugins/unitrends_backup.php b/agents/plugins/unitrends_backup.php
new file mode 100755
index 0000000..72ff7ab
--- /dev/null
+++ b/agents/plugins/unitrends_backup.php
@@ -0,0 +1,64 @@
+#!/usr/bin/php
+<?php
+print "<<<unitrends_backup:sep(124)>>>\n";
+$conn = "port=5432 dbname=bpdb user=postgres";
+$db = pg_connect($conn);
+
+$query = "SELECT
+ schedule_id, a.type AS app_type
+ FROM
+ bp.schedules AS s
+ JOIN
+ bp.application_lookup AS a USING(app_id)
+ WHERE
+ enabled=true AND email_report=true
+ ORDER BY s.name";
+$res = pg_query($db, $query);
+
+$start = time() - (24 * 3600);
+$in = array("start_time" => $start);
+bp_bypass_cookie(3, 'schedule_report');
+
+while ($obj = pg_fetch_object($res)) {
+ if ($obj->app_type == "Archive")
+ continue;
+
+ $in["schedule_id"] = (int)$obj->schedule_id;
+ $ret = bp_get_schedule_history($in);
+ if (empty($ret[0]["backups"]))
+ continue;
+
+ print "HEADER|".
+ $ret[0]["schedule_name"]."|" .
+ $ret[0]["application_name"]."|".
+ $ret[0]["schedule_description"]."|".
+ $ret[0]["failures"]."\n";
+
+ foreach($ret[0]["backups"] as $trash => $backup) {
+ foreach($backup as $row) {
+
+ $name = $row["primary_name"];
+ switch($ret[0]["app_type"]){
+ case "SQL Server":
+ $name .= "/".$row["secondary_name"];
+ break;
+
+ case "VMware":
+ $name .= ", VM ".$row["secondary_name"];
+ break;
+ }
+
+ $backup_type = $row["type"];
+
+ if (!isset($name))
+ $name = $backup_tyoe;
+
+ $backup_no = (isset($row["backup_id"])) ? $row["backup_id"] : "N/A" ;
+
+ print "$name|$backup_no|$backup_type|".$row['description']."\n";
+ }
+ }
+}
+pg_free_result($res);
+bp_destroy_cookie();
+?>
diff --git a/checkman/unitrends_backup b/checkman/unitrends_backup
new file mode 100644
index 0000000..d8787c7
--- /dev/null
+++ b/checkman/unitrends_backup
@@ -0,0 +1,17 @@
+title: Unitrends Backup Schedule
+agents: linux
+catalog: app/unitrends
+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
+ 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.
+
+ As long all of the jobs are succsessful the check returns a {OK} state. In each other
+ case the check will return {CRITICAL}. In anycase it's possible to see the complete
+ log in the long plugin output field from the core.
+
+inventory:
+ One Service for each Schedule will be created
diff --git a/checks/unitrends_backup b/checks/unitrends_backup
new file mode 100644
index 0000000..1a61f53
--- /dev/null
+++ b/checks/unitrends_backup
@@ -0,0 +1,76 @@
+#!/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.
+
+# Header: Schedule Name, Application Name, Schedule Description, Failures
+#<<<unitrends_backup:sep(124)>>>
+#HEADER|DMZ-SR01|Hyper-V 2012|DMZ-HV01|0
+#rodc2|18761|Incremental|Successful
+#rodc2|18761|Incremental|Successful
+#owncloud-test|18762|Incremental|Successful
+
+
+def inventory_unitrends_backup(info):
+ inventory = []
+ for line in info:
+ if line[0] == "HEADER":
+ inventory.append( (line[1], None) )
+ return inventory
+
+def check_unitrends_backup(item, _no_params, info):
+ found = False
+ details = []
+ for line in info:
+ if line[0] == "HEADER" and found:
+ # We are finish collection detail informatoinen
+ break
+
+ if found == True:
+ # Collection Backup deatils
+ app_type, bid, backup_type, status = line
+ details.append("Application Type: %s (%s), %s: %s" % \
+ ( app_type, bid, backup_type, status))
+ continue
+
+ if line[0] == "HEADER" and line[1] == item:
+ found = True
+ head, sched_name, app_name, sched_desc, failures = line
+ message = "%s Errors in last 24/h for Application %s (%s) " % \
+ ( failures, app_name, sched_desc )
+
+ if found == True:
+ message += "\n" + "\n".join(details)
+ if failures == '0':
+ return 0, message
+ else:
+ return 2, message
+ return 3, "Schedule not found in Agent Output"
+
+check_info["unitrends_backup"] = {
+ "check_function" : check_unitrends_backup,
+ "inventory_function" : inventory_unitrends_backup,
+ "service_description" : "Schedule %s",
+}
+
Module: check_mk
Branch: master
Commit: 6baefcc15a8baf66dc88340f93a1f16c7eef3745
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6baefcc15a8baf…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Jan 23 10:07:02 2014 +0100
Added missing files
---
agents/plugins/unitrends_backup.php | 144 +++++++++++++++++++++++++++++++++++
checkman/unitrends_backup | 17 +++++
checks/unitrends_backup | 76 ++++++++++++++++++
3 files changed, 237 insertions(+)
diff --git a/agents/plugins/unitrends_backup.php b/agents/plugins/unitrends_backup.php
new file mode 100755
index 0000000..47d7d45
--- /dev/null
+++ b/agents/plugins/unitrends_backup.php
@@ -0,0 +1,144 @@
+#!/usr/bin/php
+<?php
+print "<<<unitrends_backup:sep(124)>>>\n";
+$dbconn_string = "port=5432 dbname=bpdb user=postgres";
+$dbconn = pg_connect($dbconn_string);
+if($dbconn === FALSE) {
+ print "ERROR|Cannot connect to database.\n";
+ die(1);
+}
+
+$query = "SELECT schedule_id, a.type AS app_type ";
+$query .= "FROM bp.schedules AS s ";
+$query .= "JOIN bp.application_lookup AS a USING(app_id) ";
+$query .= "WHERE enabled=true AND email_report=true ";
+$query .= "ORDER BY s.name";
+$res = pg_query($dbconn, $query);
+if ($res === false) {
+ print "ERROR|Cannot read schedules table:\n";
+ print pg_last_error($dbconn)."\n";
+ die(1);
+}
+
+$nschedules = 0;
+$nfailed = 0;
+
+$now = time();
+$begin = $now - (24 * 3600);
+$begin = round($begin/3600) * 3600 ;
+$input = array("start_time" => $begin);
+bp_bypass_cookie(3, 'schedule_report');
+
+// Loop through the schedules and get event details from schedule_history
+while ($item = pg_fetch_assoc($res)) {
+ if ($item["app_type"] == "Archive") {
+ continue;
+ }
+ // Get the schedule history
+ $input["schedule_id"] = (int)$item["schedule_id"];
+ $ret = bp_get_schedule_history($input);
+ if ($ret === false) {
+ print "bp_get_schedule_history returned FALSE:\n";
+ print "Error is: ".bp_error()."\n";
+ die(1);
+ }
+ if (empty($ret[0]["backups"])) {
+ continue;
+ }
+
+ $nschedules++;
+ $nfailed += $ret[0]["failures"];
+ $sched = $ret[0];
+
+ // Construct the schedule information section.
+ $aus = "HEADER|".$sched["schedule_name"]."|" .$sched["application_name"]."|".$sched["schedule_description"]."|".$sched["failures"]."\n";
+ print $aus;
+
+ // The rows correspond to each backup.
+ foreach($sched["backups"] as $event => $bkups) {
+ foreach($bkups as $row) {
+ // Construct the row values for each backup.
+ // Add code here to handle new application-specific name types.
+ $name = $row["primary_name"];
+
+ if ($sched["app_type"] == "SQL Server") {
+ $name .= "/".$row["secondary_name"];
+ }
+ if ($sched["app_type"] == "VMware") {
+ $name .= ", VM ".$row["secondary_name"];
+ }
+
+ // Backup types - these are the strings defined by
+ // bp_get_backup_status
+ switch ($row["type"]) {
+ case "master":
+ $bkup_type = "Master";
+ break;
+ case "exchange full":
+ case "hyperv full":
+ case "mssql full":
+ case "vmware full":
+ case "oracle full":
+ case "sharepoint full":
+ $bkup_type = "Full";
+ break;
+ case "differential":
+ case "exchange differential":
+ case "hyperv differential":
+ case "mssql differential":
+ case "vmware differential":
+ case "sharepoint diff":
+ $bkup_type = "Differential";
+ break;
+ case "exchange incremental":
+ case "hyperv incremental":
+ case "vmware incremental":
+ case "oracle incr":
+ case "incremental":
+ $bkup_type = "Incremental";
+ break;
+ case "mssql transaction":
+ $bkup_type = "Transaction Log";
+ break;
+ case "selective":
+ $bkup_type = "Selective";
+ break;
+ case "baremetal":
+ $bkup_type = "BareMetal";
+ break;
+ default: //just in case
+ $bkup_type = "Unknown";
+ break;
+ }
+
+ if (!isset($name)) {
+ $name = $bkup_type;
+ }
+
+ // Set the Backup Id.
+ if (isset($row["backup_id"])) {
+ $bkup_no = $row["backup_id"];
+ }
+ else {
+ $bkup_no = "N/A";
+ }
+
+
+ $status = $row["description"];
+ $str .= $name."|";
+ $str .= $bkup_no."|";
+ $str .= $bkup_type."|";
+ $str .= $status."\n";
+
+ print $str;
+ }
+ }
+ unset($sched);
+}
+
+pg_free_result($res);
+
+bp_destroy_cookie();
+exit(0);
+
+?>
diff --git a/checkman/unitrends_backup b/checkman/unitrends_backup
new file mode 100644
index 0000000..d8787c7
--- /dev/null
+++ b/checkman/unitrends_backup
@@ -0,0 +1,17 @@
+title: Unitrends Backup Schedule
+agents: linux
+catalog: app/unitrends
+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
+ 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.
+
+ As long all of the jobs are succsessful the check returns a {OK} state. In each other
+ case the check will return {CRITICAL}. In anycase it's possible to see the complete
+ log in the long plugin output field from the core.
+
+inventory:
+ One Service for each Schedule will be created
diff --git a/checks/unitrends_backup b/checks/unitrends_backup
new file mode 100644
index 0000000..1a61f53
--- /dev/null
+++ b/checks/unitrends_backup
@@ -0,0 +1,76 @@
+#!/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.
+
+# Header: Schedule Name, Application Name, Schedule Description, Failures
+#<<<unitrends_backup:sep(124)>>>
+#HEADER|DMZ-SR01|Hyper-V 2012|DMZ-HV01|0
+#rodc2|18761|Incremental|Successful
+#rodc2|18761|Incremental|Successful
+#owncloud-test|18762|Incremental|Successful
+
+
+def inventory_unitrends_backup(info):
+ inventory = []
+ for line in info:
+ if line[0] == "HEADER":
+ inventory.append( (line[1], None) )
+ return inventory
+
+def check_unitrends_backup(item, _no_params, info):
+ found = False
+ details = []
+ for line in info:
+ if line[0] == "HEADER" and found:
+ # We are finish collection detail informatoinen
+ break
+
+ if found == True:
+ # Collection Backup deatils
+ app_type, bid, backup_type, status = line
+ details.append("Application Type: %s (%s), %s: %s" % \
+ ( app_type, bid, backup_type, status))
+ continue
+
+ if line[0] == "HEADER" and line[1] == item:
+ found = True
+ head, sched_name, app_name, sched_desc, failures = line
+ message = "%s Errors in last 24/h for Application %s (%s) " % \
+ ( failures, app_name, sched_desc )
+
+ if found == True:
+ message += "\n" + "\n".join(details)
+ if failures == '0':
+ return 0, message
+ else:
+ return 2, message
+ return 3, "Schedule not found in Agent Output"
+
+check_info["unitrends_backup"] = {
+ "check_function" : check_unitrends_backup,
+ "inventory_function" : inventory_unitrends_backup,
+ "service_description" : "Schedule %s",
+}
+