Browse Source

Added rocketchat token variable and setup base alert class to handle calling rocketchat alert script

pull/3020/head
Alasdair Haig 5 years ago
parent
commit
2d60674d94
  1. 1
      lgsm/config-default/config-lgsm/vhserver/_default.cfg
  2. 11
      lgsm/functions/alert.sh

1
lgsm/config-default/config-lgsm/vhserver/_default.cfg

@ -78,6 +78,7 @@ pushovertoken="accesstoken"
# Rocketchat Alerts
rocketchatalert="off"
rocketchatwebhook="webhook"
rocketchattoken=""
# Slack Alerts | https://docs.linuxgsm.com/alerts/slack
slackalert="off"

11
lgsm/functions/alert.sh

@ -190,6 +190,17 @@ elif [ -z "${telegramchatid}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
fn_script_error "Telegram chat id not set."
fi
if [ "${rocketchatalert}" == "on" ]&&[ -n "${rocketchatalert}" ]; then
alert_rocketchat.sh
elif [ "${rocketchatalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
fn_print_warn_nl "Rocketchat alerts not enabled"
fn_script_log_warn "Rocketchat alerts not enabled"
elif [ -z "${rocketchattoken}" ]&&[ "${commandname}" == "TEST-ALERT" ]; then
fn_print_error_nl "Rocketchat token not set"
#echo -e "* https://docs.linuxgsm.com/alerts/slack"
fn_script_error "Rocketchat token not set"
fi
if [ "${slackalert}" == "on" ]&&[ -n "${slackalert}" ]; then
alert_slack.sh
elif [ "${slackalert}" != "on" ]&&[ "${commandname}" == "TEST-ALERT" ]; then

Loading…
Cancel
Save