Last active
May 15, 2017 15:36
-
-
Save yosida95/520ef6d76b1ef8215736 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contacts pushover | |
contact.pushover.command /path/to/pushover_munin.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import urllib2 | |
from urllib import urlencode | |
APPTOKEN = YOUR_APPLICATION_TOKEN | |
USERTOKEN = YOUR_USER_TOKEN | |
def main(): | |
message = sys.stdin.read() | |
params = dict( | |
token=APPTOKEN, | |
user=USERTOKEN, | |
message=message) | |
request = urllib2.Request(url='https://api.pushover.net/1/messages.json', | |
data=urlencode(params)) | |
urllib2.urlopen(request) | |
return 0 | |
if __name__ == u'__main__': | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment