diff options
author | Ashesh Kumar Singh <user501254@gmail.com> | 2017-10-24 01:51:08 +0530 |
---|---|---|
committer | Ashesh Kumar Singh <user501254@gmail.com> | 2017-10-24 01:51:08 +0530 |
commit | 9e4fbcc0a6f014c126ff75a778cdc2ff6a047bce (patch) | |
tree | b64581e431adc2550e236630cfc78d696b78fc62 /plugins.d | |
parent | 7ce25e35ff1b48184a7d3538a2e8c78fc2e47dd8 (diff) |
added field for source device in pushbullet sender
This allows for clearly setting the source of alarm, uniquely identifiable by the unique device id when mentioned.
Also helps when running netdata on multiple machines. Using this, alerts from same devices can be grouped together in Pushbullet's interface.
Diffstat (limited to 'plugins.d')
-rwxr-xr-x | plugins.d/alarm-notify.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins.d/alarm-notify.sh b/plugins.d/alarm-notify.sh index 7ead760fc1..addf5e097b 100755 --- a/plugins.d/alarm-notify.sh +++ b/plugins.d/alarm-notify.sh @@ -249,6 +249,7 @@ declare -A role_recipients_pushover=() # pushbullet configs PUSHBULLET_ACCESS_TOKEN= +PUSHBULLET_SOURCE_DEVICE= DEFAULT_RECIPIENT_PUSHBULLET= declare -A role_recipients_pushbullet=() @@ -849,7 +850,7 @@ send_pushover() { # pushbullet sender send_pushbullet() { - local userapikey="${1}" recipients="${2}" title="${3}" message="${4}" httpcode sent=0 user + local userapikey="${1}" source_device="${2}" recipients="${3}" title="${4}" message="{5}" httpcode sent=0 user if [ "${SEND_PUSHBULLET}" = "YES" -a ! -z "${userapikey}" -a ! -z "${recipients}" -a ! -z "${message}" -a ! -z "${title}" ] then #https://docs.pushbullet.com/#create-push @@ -862,7 +863,8 @@ send_pushbullet() { {"title": "${title}", "type": "note", "email": "${user}", - "body": "$( echo -n ${message})"} + "body": "$( echo -n ${message})", + "source_device_iden": "${source_device}"} EOF ) "https://api.pushbullet.com/v2/pushes" -X POST) @@ -1409,7 +1411,7 @@ SENT_PUSHOVER=$? # ----------------------------------------------------------------------------- # send the pushbullet notification -send_pushbullet "${PUSHBULLET_ACCESS_TOKEN}" "${to_pushbullet}" "${host} ${status_message} - ${name//_/ } - ${chart}" "${alarm}\n +send_pushbullet "${PUSHBULLET_ACCESS_TOKEN}" "${PUSHBULLET_SOURCE_DEVICE}" "${to_pushbullet}" "${host} ${status_message} - ${name//_/ } - ${chart}" "${alarm}\n Severity: ${severity}\n Chart: ${chart}\n Family: ${family}\n |