Module: check_mk
Branch: master
Commit: b3207112a38a011604ba75d800cc53e64bb93a66
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b3207112a38a01…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Mar 19 11:47:03 2015 +0100
Added missing file
---
doc/treasures/notifications/braintower | 69 ++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/doc/treasures/notifications/braintower
b/doc/treasures/notifications/braintower
new file mode 100755
index 0000000..65da49d
--- /dev/null
+++ b/doc/treasures/notifications/braintower
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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.
+
+# Send notification to a Braintwoer SMS Gateway
+#
+# This notification script can be put below share/check_mk/notifications.
+# Plese configure the needed credentials
+
+import sys, os, urllib, httplib
+
+username = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
+password = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
+host = "XXXXXXXXXXXXXXXXXXXXXXXXXXX"
+path = "/api.php"
+
+to = os.environ.get("NOTIFY_CONTACTPAGER")
+message = os.environ['NOTIFY_HOSTNAME'] + " "
+
+if os.environ['NOTIFY_WHAT'] == 'SERVICE':
+ message += os.environ['NOTIFY_SERVICESTATE'][:2] + " "
+ avail_len = max_len - len(message)
+ message += os.environ['NOTIFY_SERVICEDESC'][:avail_len] + " "
+ avail_len = max_len - len(message)
+ message += os.environ['NOTIFY_SERVICEOUTPUT'][:avail_len]
+
+else:
+ message += "is " + os.environ['NOTIFY_HOSTSTATE']
+
+url = "http://%s/%s?" % ( host, path ) + urllib.urlencode([
+ ( "username", username ),
+ ( "password", password ),
+ ( "to", to ),
+ ( "text", message )
+])
+
+
+try:
+ handle = urllib.urlopen(url)
+ response = handle.read().strip()
+ if response == "100":
+ sys.stdout.write("Successfully sent SMS to %s\n" % to)
+ else:
+ sys.stderr.write("Error sending SMS to %s: %s\n" % (to,
exitcodes.get(response, "Invalid exit code %s" % response)))
+ sys.stderr.write("URL was %s\n" % url)
+except Exception, e:
+ sys.stderr.write("Error sending SMS to %s. Exception: %s%s\n" % e)