From 12ba64c08dfdaef9aab0e738e015107735e4f3c2 Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Sat, 8 Nov 2014 16:57:56 +0100 Subject: [PATCH] two pushover apps --- pushHeartbeat.py | 23 +++++++++++++++++++++++ pushNagios.py | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100755 pushHeartbeat.py create mode 100755 pushNagios.py diff --git a/pushHeartbeat.py b/pushHeartbeat.py new file mode 100755 index 0000000..3fbd44e --- /dev/null +++ b/pushHeartbeat.py @@ -0,0 +1,23 @@ +#!/usr/bin/python + +import sys +import httplib, urllib + +def pushover(msg): + conn = httplib.HTTPSConnection("api.pushover.net:443") + conn.request("POST", "/1/messages.json", + urllib.urlencode({ + "token": "ac7NLX2rPjXFareeDgLpXNoDf4iFmf", + "user": "uDhH33UjQQDYtNzJb1ThRiWb9ingGK", + "message": msg, + }), { "Content-type": "application/x-www-form-urlencoded" }) + r1=conn.getresponse() + #print r1.status, r1.reason + return r1.status == 200 + + +v=" ".join(sys.argv[1:]) +if pushover(v): + print "delivered" +else: + print "NOT delivered" diff --git a/pushNagios.py b/pushNagios.py new file mode 100755 index 0000000..06c6938 --- /dev/null +++ b/pushNagios.py @@ -0,0 +1,23 @@ +#!/usr/bin/python + +import sys +import httplib, urllib + +def pushover(msg): + conn = httplib.HTTPSConnection("api.pushover.net:443") + conn.request("POST", "/1/messages.json", + urllib.urlencode({ + "token": "aNY2xeYydxzabzihTjb3P2LMHhqhr2", + "user": "uDhH33UjQQDYtNzJb1ThRiWb9ingGK", + "message": msg, + }), { "Content-type": "application/x-www-form-urlencoded" }) + r1=conn.getresponse() + #print r1.status, r1.reason + return r1.status == 200 + + +v=" ".join(sys.argv[1:]) +if pushover(v): + print "delivered" +else: + print "NOT delivered"