forked from jedda/OSX-Monitoring-Tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
notify_by_boxcar.sh
executable file
·36 lines (29 loc) · 1.1 KB
/
notify_by_boxcar.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# Notify by Boxcar
# by Jedda Wignall
# http://jedda.me
# v1.0 - 21 May 2012
# Initial release.
# This script pushes a Boxcar notification to your account, based on the passed arguments.
#
# Takes the following REQUIRED arguments:
#
# -e Your Boxcar registered email address.
# -h The affected host.
# -m The notification text.
# IMPORTANT
# You will need to subscribe to the "Monitoring" generic provider with this command before this will work (sub. in your boxcar account):
# curl -d "email=your-boxcar-registered-email@example.com" http://boxcar.io/devices/providers/MH0S7xOFSwVLNvNhTpiC/notifications/subscribe
while getopts "e:h:m:" optionName; do
case "$optionName" in
e) boxcarEmail=( "$OPTARG" );;
h) host=( "$OPTARG" );;
m) message=( "$OPTARG" );;
esac
done
curl --ssl --data-urlencode "email=$boxcarEmail" \
--data-urlencode "¬ification[from_screen_name]=$host" \
--data-urlencode "¬ification[icon_url]=http://jedda.me/assets/BoxcarMonitoringIcon.png" \
--data-urlencode "¬ification[message]=$message" \
https://boxcar.io/devices/providers/MH0S7xOFSwVLNvNhTpiC/notifications
exit 0