Module: check_mk
Branch: master
Commit: 40f232fdc9723c625ac962dc70f6b203406fbf78
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=40f232fdc9723c…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Tue Dec 10 14:05:34 2013 +0100
improved title of werk 86
---
.werks/86 | 3 +--
ChangeLog | 2 +-
agents/check_mk_agent.macosx | 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/.werks/86 b/.werks/86
index 7001943..de75ae6 100644
--- a/.werks/86
+++ b/.werks/86
@@ -1,8 +1,7 @@
-Title: timemachine: new check
+Title: timemachine: new check checking the age of latest backup by timemachine on MAC OS
Level: 2
Component: checks
Version: 1.2.3i8
Date: 1386679588
Class: feature
-Checks the age of latest backup by timemachine on MAC OS and compares the age against given levels.
diff --git a/ChangeLog b/ChangeLog
index 50f066a..a8429ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,7 +4,7 @@
* 0073 moxa_iologik_register: new check to monitor moxa e2000 series registers
* 0105 apc_humidity: New Check for humidity levels on APC Devices
* 0106 3ware_units: The verifying state is now handled as ok...
- * 0086 timemachine: new check...
+ * 0086 timemachine: new check checking the age of latest backup by timemachine on MAC OS
* 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/check_mk_agent.macosx b/agents/check_mk_agent.macosx
index 2e0f533..64cb90c 100755
--- a/agents/check_mk_agent.macosx
+++ b/agents/check_mk_agent.macosx
@@ -91,7 +91,7 @@ fi
if type tmutil >/dev/null
then
echo '<<<timemachine>>>'
- tmutil latestbackup
+ tmutil latestbackup 2>&1
fi
###############################
Module: check_mk
Branch: master
Commit: 43d5e89f0f5678c5ee21e7e9c8e4107e6c1b8286
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=43d5e89f0f5678…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Dec 10 14:02:26 2013 +0100
Fixed typo in name
---
.werks/106 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.werks/106 b/.werks/106
index 19523b7..39f77f5 100644
--- a/.werks/106
+++ b/.werks/106
@@ -6,4 +6,4 @@ Date: 1386679206
Class: feature
The devices do a regular verifying of the raid sets. The check now not longer handle this as Warning.
-Thanx for the tip to Rober Stander from Heinlein Support GmbH.
+Thanx for the tip to Robert Sander from Heinlein Support GmbH.
Module: check_mk
Branch: master
Commit: 30766e52ad06a7924c54725dad11a7065c1a8a6a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=30766e52ad06a7…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Tue Dec 10 13:47:41 2013 +0100
timemachine: new check
Checks the age of latest backup by timemachine on MAC OS and compares the age against given levels.
---
.werks/86 | 8 ++++
ChangeLog | 1 +
agents/check_mk_agent.macosx | 5 +++
checkman/timemachine | 38 ++++++++++++++++
checks/timemachine | 80 ++++++++++++++++++++++++++++++++++
web/plugins/wato/check_parameters.py | 20 +++++++++
6 files changed, 152 insertions(+)
diff --git a/.werks/86 b/.werks/86
new file mode 100644
index 0000000..7001943
--- /dev/null
+++ b/.werks/86
@@ -0,0 +1,8 @@
+Title: timemachine: new check
+Level: 2
+Component: checks
+Version: 1.2.3i8
+Date: 1386679588
+Class: feature
+
+Checks the age of latest backup by timemachine on MAC OS and compares the age against given levels.
diff --git a/ChangeLog b/ChangeLog
index 5e4a1a4..50f066a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
* 0073 moxa_iologik_register: new check to monitor moxa e2000 series registers
* 0105 apc_humidity: New Check for humidity levels on APC Devices
* 0106 3ware_units: The verifying state is now handled as ok...
+ * 0086 timemachine: new check...
* 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/check_mk_agent.macosx b/agents/check_mk_agent.macosx
index 263b757..2e0f533 100755
--- a/agents/check_mk_agent.macosx
+++ b/agents/check_mk_agent.macosx
@@ -88,6 +88,11 @@ if [ -r "$MK_CONFDIR/fileinfo.cfg" ] ; then
stat -f "%N|%z|%m" $(cat "$MK_CONFDIR/fileinfo.cfg")
fi
+if type tmutil >/dev/null
+then
+ echo '<<<timemachine>>>'
+ tmutil latestbackup
+fi
###############################
# Things up for takers:
diff --git a/checkman/timemachine b/checkman/timemachine
new file mode 100644
index 0000000..6300966
--- /dev/null
+++ b/checkman/timemachine
@@ -0,0 +1,38 @@
+title: Age of latest backup by timemachine
+agents: macosx
+catalog: os/services
+license: GPL
+distribution: check_mk
+description:
+ Checks the age of latest backup by timemachine.
+ Therefor on the agent the command {tmutil latestbackup} is executed.
+
+ Returns {WARN} or {CRIT} if the latest backup is older than given ages.
+ Returns {CRIT} if the tmutil command returns an error.
+
+examples:
+ # set default levels to 21600 sec (6h) for WARN and 43200 sec (12h) for CRIT
+ backup_timemachine_default_levels = { "age": ( 86400, 172800 ) }
+
+ # Check timemachine backups on a box called MyMAC with default levels
+ checks += [
+ ("MyMAC", "timemachine", None, backup_timemachine_default_levels),
+ ]
+
+ # or use individual levels for warn and crit
+ checks += [
+ ("MyMAC", "timemachine", None, {'age': (10000, 20000)}),
+ ]
+
+inventory:
+ Finds exactly one service on every MAC OS machine having tmutil installed.
+
+[parameters]
+parameters (dict): with the element
+{"age"}: (int, int): {WARN} and {CRIT} levels for maximum age of latest backup
+ in seconds
+
+[configuration]
+backup_timemachine_default_levels(dict): The standard levels for {WARN} and
+ {CRIT}, preset to { "age": ( 86400, 172800 ) } which is 1 day / 2 days
+
diff --git a/checks/timemachine b/checks/timemachine
new file mode 100644
index 0000000..8fb0b00
--- /dev/null
+++ b/checks/timemachine
@@ -0,0 +1,80 @@
+#!/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.
+
+# Example output from agent on success:
+# <<<timemachine>>>
+# /Volumes/Backup/Backups.backupdb/macvm/2013-11-28-202610
+#
+# Example output from agent on failure:
+# <<<timemachine>>>
+# Unable to locate machine directory for host.
+
+import datetime, time, re
+
+backup_timemachine_default_levels = { "age": ( 86400, 172800 ) } # 1d/2d
+
+def inventory_timemachine(info):
+ return [(None, backup_timemachine_default_levels)]
+
+def check_timemachine(item, params, info):
+ if len(info[0]) > 1:
+ message = " ".join(info[0])
+ return 2, "Backup seems to have failed, message was: %s" % message
+
+ warn, crit = params['age']
+ now = datetime.datetime.now()
+ tokens = info[0][0].split("/")
+ timestamp = tokens[-1]
+ state = 0
+ result = re.match('([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])-([0-9][0-9])([0-9][0-9])([0-9][0-9])', timestamp)
+ if result == None:
+ return 3, "Timestamp of last backup in unknown format: %s" % timestamp
+ y = int(result.group(1))
+ m = int(result.group(2))
+ d = int(result.group(3))
+ H = int(result.group(4))
+ M = int(result.group(5))
+ S = int(result.group(6))
+ backuptime = datetime.datetime( y, m, d, H, M, S)
+ maxage_warn = datetime.timedelta(seconds=warn)
+ maxage_crit = datetime.timedelta(seconds=crit)
+ backupage = now - backuptime
+
+ if backuptime > now:
+ return 1, "Time problem: The last backup has a timestamp in the future: %s" % backuptime
+ if backupage > maxage_warn:
+ state = 1
+ if backupage > maxage_crit:
+ state = 2
+ return state, "Last Backup was at %s (age %s)" % (backuptime, backupage)
+
+check_info["timemachine"] = {
+ "check_function" : check_timemachine,
+ "inventory_function" : inventory_timemachine,
+ "service_description" : "Backup Timemachine",
+ "group" : "backup_timemachine",
+ "has_perfdata" : False,
+}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 89824f5..914ce58 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2435,6 +2435,26 @@ register_check_parameters(
register_check_parameters(
subgroup_applications,
+ "backup_timemachine",
+ _("Age of timemachine backup"),
+ Dictionary(
+ elements = [
+ ("age",
+ Tuple(
+ title = _("Maximum age of latest timemachine backup"),
+ elements = [
+ Age(title = _("Warning if older than"), default_value = 86400),
+ Age(title = _("Critical if older than"), default_value = 172800)
+ ]
+ )
+ )]
+ ),
+ None,
+ None
+)
+
+register_check_parameters(
+ subgroup_applications,
"mssql_counters_locks",
_("MSSQL Locks"),
Dictionary(
Module: check_mk
Branch: master
Commit: 733ae3d0548daa49b37dd9b272df1ece06860968
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=733ae3d0548daa…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Dec 10 13:43:47 2013 +0100
3ware_units: The verifying state is now handled as ok
The devices do a regular verifying of the raid sets. The check now not longer handle this as Warning.
Thanx for the tip to Rober Stander from Heinlein Support GmbH.
---
.werks/106 | 9 +++++++++
ChangeLog | 1 +
checkman/3ware_units | 2 +-
checks/3ware_units | 4 ++--
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/.werks/106 b/.werks/106
new file mode 100644
index 0000000..19523b7
--- /dev/null
+++ b/.werks/106
@@ -0,0 +1,9 @@
+Title: 3ware_units: The verifying state is now handled as ok
+Level: 1
+Component: checks
+Version: 1.2.3i8
+Date: 1386679206
+Class: feature
+
+The devices do a regular verifying of the raid sets. The check now not longer handle this as Warning.
+Thanx for the tip to Rober Stander from Heinlein Support GmbH.
diff --git a/ChangeLog b/ChangeLog
index e68fff2..5e4a1a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
* 0306 esx_vsphere_counters: added missing ramdisk levels sfcbtickets
* 0073 moxa_iologik_register: new check to monitor moxa e2000 series registers
* 0105 apc_humidity: New Check for humidity levels on APC Devices
+ * 0106 3ware_units: The verifying state is now handled as ok...
* 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/checkman/3ware_units b/checkman/3ware_units
index 37b3e11..90f11f9 100644
--- a/checkman/3ware_units
+++ b/checkman/3ware_units
@@ -14,4 +14,4 @@ item:
inventory:
All logical units are automatically inventorized. All states other than
- {OK} are considere critical.
+ {OK} or {VERIFYING} are considere critical.
diff --git a/checks/3ware_units b/checks/3ware_units
index bec04e5..012bcaa 100644
--- a/checks/3ware_units
+++ b/checks/3ware_units
@@ -66,9 +66,9 @@ def check_3ware_units(item, _no_params, info):
infotext = "%s (type: %s, size: %sGB%s)" % (status, unit_type, size, complete_txt)
- if status == "OK":
+ if status in [ "OK", "VERIFYING" ]:
return (0, "unit status is " + infotext)
- elif status in [ "INITIALIZING", "VERIFY-PAUSED", "VERIFYING", "REBUILDING" ]:
+ elif status in [ "INITIALIZING", "VERIFY-PAUSED", "REBUILDING" ]:
return (1, "unit status is " + infotext)
else:
return (2, "unit status is " + infotext)
Module: check_mk
Branch: master
Commit: 092fe3363c4180ffdda45b24c80b1351f7e1d0e6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=092fe3363c4180…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Dec 10 13:35:26 2013 +0100
Updated bug entries #0838
---
.bugs/838 | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/.bugs/838 b/.bugs/838
new file mode 100644
index 0000000..0c9581f
--- /dev/null
+++ b/.bugs/838
@@ -0,0 +1,23 @@
+Title: Its not possible to add contacts groups to foulders if a minus is in name
+Component: wato
+State: open
+Date: 2013-12-10 10:09:51
+Targetversion: 1.2.3i6
+Class: bug
+
+From the german mailing list:
+
+
+Habe etwas merkwürdiges entdeckt in Check_MK 1.2.3i6. Das Hinzufügen von Contactgroups zu Foldern, egal ob die Contactgroups über ldap gezogen oder lokal angelegt wurden, schlägt fehl.
+
+
+
+Heißt beispielsweise eine Contactgroup „all-admins“ verschwindet der Haken bei Contactgroups eines Folders wieder, nenne ich sie dagegen „alladmins“ bleibt das Häkchen bestehen.
+
+
+
+Ich vermute, dass es an einer Wato-Funktion liegt und beim Parsen des Namens etwas fehlschlägt, weil das Hinzufügen von Contactgroups zu Foldern in den .wato Files funktioniert.
+
+
+
+Der Fehler ist reproduzierbar.
Module: check_mk
Branch: master
Commit: 35e4bc2344a4fa42c032ca0f6a12a3afc4bfe91c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=35e4bc2344a4fa…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 10 13:20:07 2013 +0100
Implement file upload for WSGI module
---
web/htdocs/check_mk.css | 4 ++++
web/htdocs/html_mod_python.py | 32 +-------------------------------
web/htdocs/htmllib.py | 36 ++++++++++++++++++++++++++++++++++--
3 files changed, 39 insertions(+), 33 deletions(-)
diff --git a/web/htdocs/check_mk.css b/web/htdocs/check_mk.css
index 43c727a..fb505aa 100644
--- a/web/htdocs/check_mk.css
+++ b/web/htdocs/check_mk.css
@@ -88,6 +88,10 @@ input, select, textarea {
margin-top: 0px;
}
+input[type=file] {
+ color: black;
+}
+
form {
margin: 0px;
}
diff --git a/web/htdocs/html_mod_python.py b/web/htdocs/html_mod_python.py
index e104bb3..3ad0d04 100644
--- a/web/htdocs/html_mod_python.py
+++ b/web/htdocs/html_mod_python.py
@@ -3,8 +3,6 @@ import htmllib
import os, time, config, weblib, re
import defaults
-varname_regex = re.compile('^[\w\d_.%+-\\\*]+$')
-
class html_mod_python(htmllib.html):
def __init__(self, req):
@@ -43,36 +41,8 @@ class html_mod_python(htmllib.html):
self.cookies = Cookie.get_cookies(self.req)
def read_get_vars(self):
- self.vars = {}
- self.listvars = {} # for variables with more than one occurrance
- self.uploads = {}
fields = util.FieldStorage(self.req, keep_blank_values = 1)
- for field in fields.list:
- varname = field.name
- value = field.value
-
- # To prevent variours injections, we only allow a defined set
- # of characters to be used in variables
- if not varname_regex.match(varname):
- continue
-
- # Multiple occurrance of a variable? Store in extra list dict
- if varname in self.vars:
- if varname in self.listvars:
- self.listvars[varname].append(value)
- else:
- self.listvars[varname] = [ self.vars[varname], value ]
- # In the single-value-store the last occurrance of a variable
- # has precedence. That makes appending variables to the current
- # URL simpler.
- self.vars[varname] = value
-
- # put uploaded file infos into separate storage
- if field.filename is not None:
- self.uploads[varname] = (field.filename, field.type, field.value)
-
- def uploaded_file(self, varname, default = None):
- return self.uploads.get(varname, default)
+ self.parse_field_storage(fields)
def lowlevel_write(self, text):
if self.io_error:
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index a54368d..c628238 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -34,6 +34,9 @@ try:
except NameError:
from sets import Set as set
+# Only parse variable adhering to the following regular expressions
+varname_regex = re.compile('^[\w\d_.%+-\\\*]+$')
+
# Information about uri
class InvalidUserInput(Exception):
def __init__(self, varname, text):
@@ -1245,13 +1248,42 @@ class html:
self.load_tree_states()
self.treestates[tree] = val
+ def parse_field_storage(self, fields):
+ self.vars = {}
+ self.listvars = {} # for variables with more than one occurrance
+ self.uploads = {}
+
+ for field in fields.list:
+ varname = field.name
+ value = field.value
+
+ # To prevent variours injections, we only allow a defined set
+ # of characters to be used in variables
+ if not varname_regex.match(varname):
+ continue
+
+ # put uploaded file infos into separate storage
+ if field.filename is not None:
+ self.uploads[varname] = (field.filename, field.type, field.value)
+
+ else: # normal variable
+ # Multiple occurrance of a variable? Store in extra list dict
+ if varname in self.vars:
+ if varname in self.listvars:
+ self.listvars[varname].append(value)
+ else:
+ self.listvars[varname] = [ self.vars[varname], value ]
+ # In the single-value-store the last occurrance of a variable
+ # has precedence. That makes appending variables to the current
+ # URL simpler.
+ self.vars[varname] = value
+
def uploaded_file(self, varname, default = None):
- raise MKGeneralException("uploaded_file not implemented")
+ return self.uploads.get(varname, default)
#
# Per request caching
#
-
def set_cache(self, name, value):
self.caches[name] = value