mirror of
https://github.com/GameServerManagers/LinuxGSM.git
synced 2025-01-07 03:26:50 +08:00
sendgrid
This commit is contained in:
parent
1d6d94d7a3
commit
b2ee60cf4b
27
lgsm/functions/alert_sendgrid.sh
Executable file
27
lgsm/functions/alert_sendgrid.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
# LinuxGSM alert_sendgrid.sh module
|
||||
# Author: Daniel Gibbs
|
||||
# Contributors: http://linuxgsm.com/contrib
|
||||
# Website: https://linuxgsm.com
|
||||
# Description: Sends sendgrid Email alert.
|
||||
|
||||
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||
|
||||
sendgridapiurl="https://api.sendgrid.com/v3/mail/send"
|
||||
|
||||
fn_print_dots "Sending Email alert: sendgrid: ${sendgridemail}"
|
||||
|
||||
sendgridsend=$(curl --request POST \
|
||||
--url ${sendgridapiurl} \
|
||||
--header "Authorization: Bearer ${sendgridapi}" \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{"personalizations": [{"to": [{"email": "${sendgridemail}"}]}],"from": {"email": "${sendgridfrom}"},"subject": "${alertemoji} ${alertsubject} ${alertemoji}","content": [{"type": "text/plain", "value": "$(cat "${alertlog}")"}]}'
|
||||
)
|
||||
|
||||
if [ -z "${sendgridsend}" ]; then
|
||||
fn_print_fail_nl "Sending Email alert: sendgrid: ${sendgridemail}"
|
||||
fn_script_log_fatal "Sending Email alert: sendgrid: ${sendgridemail}"
|
||||
else
|
||||
fn_print_ok_nl "Sending Email alert: sendgrid: ${sendgridemail}"
|
||||
fn_script_log_pass "Sending Email alert: sendgrid: ${sendgridemail}"
|
||||
fi
|
@ -550,6 +550,11 @@ functionfile="${FUNCNAME[0]}"
|
||||
fn_fetch_function
|
||||
}
|
||||
|
||||
alert_gotify.sh(){
|
||||
functionfile="${FUNCNAME[0]}"
|
||||
fn_fetch_function
|
||||
}
|
||||
|
||||
alert_ifttt.sh(){
|
||||
functionfile="${FUNCNAME[0]}"
|
||||
fn_fetch_function
|
||||
@ -570,7 +575,17 @@ functionfile="${FUNCNAME[0]}"
|
||||
fn_fetch_function
|
||||
}
|
||||
|
||||
alert_gotify.sh(){
|
||||
alert_rocketchat.sh(){
|
||||
functionfile="${FUNCNAME[0]}"
|
||||
fn_fetch_function
|
||||
}
|
||||
|
||||
alert_sendgrid.sh(){
|
||||
functionfile="${FUNCNAME[0]}"
|
||||
fn_fetch_function
|
||||
}
|
||||
|
||||
alert_slack.sh(){
|
||||
functionfile="${FUNCNAME[0]}"
|
||||
fn_fetch_function
|
||||
}
|
||||
@ -580,15 +595,6 @@ functionfile="${FUNCNAME[0]}"
|
||||
fn_fetch_function
|
||||
}
|
||||
|
||||
alert_rocketchat.sh(){
|
||||
functionfile="${FUNCNAME[0]}"
|
||||
fn_fetch_function
|
||||
}
|
||||
|
||||
alert_slack.sh(){
|
||||
functionfile="${FUNCNAME[0]}"
|
||||
fn_fetch_function
|
||||
}
|
||||
# Logs
|
||||
|
||||
core_logs.sh(){
|
||||
|
Loading…
Reference in New Issue
Block a user