summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-03-22 18:49:46 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2015-03-22 18:49:46 (GMT)
commitb65d51dc04f9addd6689d8a02bd348f7773e0150 (patch)
treea591fdf44c8b9dba7804ac19126d2253da90aaea
parent276bedfeaad8f6e57b5602325837e65249403477 (diff)
added agent plugin and check for timezone
-rwxr-xr-xagent/timezone7
-rw-r--r--checks/timezone30
2 files changed, 37 insertions, 0 deletions
diff --git a/agent/timezone b/agent/timezone
new file mode 100755
index 0000000..0172e19
--- /dev/null
+++ b/agent/timezone
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+echo "<<<timezone>>>"
+cat /etc/timezone
+
+exit 0
+
diff --git a/checks/timezone b/checks/timezone
new file mode 100644
index 0000000..7231d80
--- /dev/null
+++ b/checks/timezone
@@ -0,0 +1,30 @@
+OK = 0
+WARN = 1
+CRIT = 2
+UNKNOWN = 3
+
+def inventory_timezone_status(info):
+ try:
+ inventory = []
+ inventory.append(('timezone',info[0]))
+ return inventory
+ except Exception, e:
+ return []
+
+
+def check_timezone_status(item, params, info):
+ try:
+ if params[0] == info[0][0]:
+ return (OK, 'system timezone is <%s> as expected' % (info[0][0]))
+ else:
+ return (CRIT, 'system timezone is not correct(!!), should be %s but is %s' % (params[0], info[0][0]))
+ except Exception, e:
+ return (UNKNOWN, "timezone check failed: %", e.message)
+
+
+check_info["timezone"] = {
+ 'check_function': check_timezone_status,
+ 'inventory_function': inventory_timezone_status,
+ 'service_description': 'system-wide timezone setting',
+}
+