changes pushbullet's push type from note to link
How this is better: - definitely looks better since the overly large link is partially hidden - maintains all the information that it had previously - on mobile if the new push is tapped from the pull down notifications shade, it will directly take you to the weblink of the alert in the browser and not to the pushbullet app instead Also added timestamp when the event occurred in body of the sent message (in case notifications are delayed).
Ashesh Kumar Singh committed
Oct 26, 2017 at 00:54 UTC
7acc9d2c0ff0c3451705dc5b1002945a95af3d0e
1 file changed
+5
-3
plugins.d/alarm-notify.sh
+5
-3
@@ -850,7 +850,7 @@ send_pushover() {
850
# pushbullet sender
851
852
send_pushbullet() {
853
- local userapikey="${1}" source_device="${2}" recipients="${3}" title="${4}" message="{5}" httpcode sent=0 user
853
+ local userapikey="${1}" source_device="${2}" recipients="${3}" url="{4}" title="${5}" message="{6}" httpcode sent=0 user
854
if [ "${SEND_PUSHBULLET}" = "YES" -a ! -z "${userapikey}" -a ! -z "${recipients}" -a ! -z "${message}" -a ! -z "${title}" ]
855
then
856
#https://docs.pushbullet.com/#create-push
@@ -861,9 +861,10 @@ send_pushbullet() {
861
--header 'Content-Type: application/json' \
862
--data-binary @<(cat <<EOF
863
{"title": "${title}",
864
- "type": "note",
864
+ "type": "link",
865
"email": "${user}",
866
"body": "$( echo -n ${message})",
867
+ "url": "${url}",
868
"source_device_iden": "${source_device}"}
869
EOF
870
) "https://api.pushbullet.com/v2/pushes" -X POST)
@@ -1411,7 +1412,8 @@ SENT_PUSHOVER=$?
1412
# -----------------------------------------------------------------------------
1413
# send the pushbullet notification
1414
1414
-send_pushbullet "${PUSHBULLET_ACCESS_TOKEN}" "${PUSHBULLET_SOURCE_DEVICE}" "${to_pushbullet}" "${host} ${status_message} - ${name//_/ } - ${chart}" "${alarm}\n
1415
+send_pushbullet "${PUSHBULLET_ACCESS_TOKEN}" "${PUSHBULLET_SOURCE_DEVICE}" "${to_pushbullet}" "${goto_url}" "${host} ${status_message} - ${name//_/ } - ${chart}" "${alarm}\n
1416
+$(date -d @${when})\n
1417
Severity: ${severity}\n
1418
Chart: ${chart}\n
1419
Family: ${family}\n