Browse Source

trigger message

feature/alerts-refactor
Daniel Gibbs 4 years ago
parent
commit
c12be179b5
No known key found for this signature in database GPG Key ID: 2EBB36015C6D78E2
  1. 16
      lgsm/functions/alert.sh
  2. 4
      lgsm/functions/alert_discord.sh
  3. 2
      lgsm/functions/alert_gotify.sh
  4. 2
      lgsm/functions/alert_ifttt.sh
  5. 2
      lgsm/functions/alert_pushbullet.sh
  6. 2
      lgsm/functions/alert_pushover.sh
  7. 2
      lgsm/functions/alert_rocketchat.sh
  8. 2
      lgsm/functions/alert_slack.sh
  9. 2
      lgsm/functions/info_messages.sh

16
lgsm/functions/alert.sh

@ -36,7 +36,7 @@ fn_alert_test(){
alertemoji="🚧"
alertsound="1"
alerturl="not enabled"
alertmessage="Testing LinuxGSM Alert. No action to be taken."
alerttriggermessage="Testing LinuxGSM Alert. No action to be taken."
# Green
alertcolourhex="#cdcd00"
alertcolourdec="13487360"
@ -48,7 +48,7 @@ fn_alert_restart(){
alertemoji="🚨"
alertsound="2"
alerturl="not enabled"
alertmessage="${selfname} is not running. Game Server has been restarted."
alerttriggermessage="${selfname} is not running. Game Server has been restarted."
# Red
alertcolourhex="#cd0000"
alertcolourdec="13434880"
@ -60,7 +60,7 @@ fn_alert_restart_query(){
alertemoji="🚨"
alertsound="2"
alerturl="not enabled"
alertmessage="Unable to query ${selfname}. Game server has been restarted"
alerttriggermessage="Unable to query ${selfname}. Game server has been restarted."
# Red
alertcolourhex="#cd0000"
alertcolourdec="13434880"
@ -72,7 +72,7 @@ fn_alert_update(){
alertemoji="🎉"
alertsound="1"
alerturl="not enabled"
alertmessage="${selfname} has received an update"
alerttriggermessage="${selfname} has received an update."
# Green
alertcolourhex="#00cd00"
alertcolourdec="52480"
@ -84,7 +84,7 @@ fn_alert_check_update(){
alertemoji="💿"
alertsound="1"
alerturl="not enabled"
alertmessage="Update availablefor ${selfname}"
alerttriggermessage="Update available for ${selfname}."
# Blue
alertcolourhex="#1e90ff"
alertcolourdec="2003199"
@ -96,7 +96,7 @@ fn_alert_permissions(){
alertemoji="❗"
alertsound="2"
alerturl="not enabled"
alertmessage="${selfname} has permissions issues"
alerttriggermessage="${selfname} has permissions issues."
# Red
alertcolourhex="#cd0000"
alertcolourdec="13434880"
@ -108,7 +108,7 @@ fn_alert_config(){
alertemoji="📄"
alertsound="1"
alerturl="not enabled"
alertmessage="${selfname} has received a new _default.cfg. Check file for changes."
alerttriggermessage="${selfname} has received a new _default.cfg. Check file for changes."
# Blue
alertcolourhex="#1e90ff"
alertcolourdec="2003199"
@ -120,7 +120,7 @@ fn_alert_wipe(){
alertemoji="🧹"
alertsound="1"
alerturl="not enabled"
alertmessage="${selfname} as been wiped."
alerttriggermessage="${selfname} as been wiped."
# Green
alertcolourhex="#00cd00"
alertcolourdec="52480"

4
lgsm/functions/alert_discord.sh

@ -55,8 +55,8 @@ json=$(cat <<EOF
"inline": true
},
{
"name": "Information",
"value": "${alertmessage} \n More info: ${alerturl}"
"name": "Trigger Message",
"value": "${alerttriggermessage} \n More info: ${alerturl}"
}
],
"thumbnail": {

2
lgsm/functions/alert_gotify.sh

@ -10,7 +10,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
json=$(cat <<EOF
{
"title": "${alertemoji} ${alerttitle} ${alertemoji}",
"message": "Server name\n${servername}\n\nMessage\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}",
"message": "Server name\n${servername}\n\nTrigger Message\n${alerttriggermessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}",
"priority": 5
}
EOF

2
lgsm/functions/alert_ifttt.sh

@ -11,7 +11,7 @@ json=$(cat <<EOF
{
"value1": "${selfname}",
"value2": "${alertemoji} ${alerttitle} ${alertemoji}",
"value3": "Server name<br>${servername}<br><br>Message<br>${alertmessage}<br><br>Game<br>${gamename}<br><br>${alertplayerstitle}<br>${alertplayers}<br><br>Map<br>${alertmap}<br><br>Server IP<br>${alertip}:${port}<br><br>Hostname<br>${HOSTNAME}<br><br>More info<br>${alerturl}"
"value3": "Server name<br>${servername}<br><br>Trigger Message<br>${alerttriggermessage}<br><br>Game<br>${gamename}<br><br>${alertplayerstitle}<br>${alertplayers}<br><br>Map<br>${alertmap}<br><br>Server IP<br>${alertip}:${port}<br><br>Hostname<br>${HOSTNAME}<br><br>More info<br>${alerturl}"
}
EOF
)

2
lgsm/functions/alert_pushbullet.sh

@ -12,7 +12,7 @@ json=$(cat <<EOF
"channel_tag": "${channeltag}",
"type": "note",
"title": "${alertemoji} ${alerttitle} ${alertemoji}",
"body": "Server name\n${servername}\n\nMessage\n${alertmessage}\n\nGame\n${gamename}\n\n${alertplayerstitle}\n${alertplayers}\n\nMap\n${alertmap}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}"
"body": "Server name\n${servername}\n\nTrigger Message\n${alerttriggermessage}\n\nGame\n${gamename}\n\n${alertplayerstitle}\n${alertplayers}\n\nMap\n${alertmap}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}"
}
EOF
)

2
lgsm/functions/alert_pushover.sh

@ -22,7 +22,7 @@ else
alertpriority="0"
fi
pushoversend=$(curl --connect-timeout 10 -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alertemoji} ${alerttitle} ${alertemoji}" -F message=" <b>Server name</b><br>${servername}<br><br><b>Message</b><br>${alertmessage}<br><br><b>Game</b><br>${gamename}<br><br><b>${alertplayerstitle}</b><br>${alertplayers}<br><br><b>Map</b><br>${alertmap}<br><br><b>Server IP</b><br><a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a><br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a>" "https://api.pushover.net/1/messages.json" | grep errors)
pushoversend=$(curl --connect-timeout 10 -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alertemoji} ${alerttitle} ${alertemoji}" -F message=" <b>Server name</b><br>${servername}<br><br><b>Message</b><br>${alerttriggermessage}<br><br><b>Game</b><br>${gamename}<br><br><b>${alertplayerstitle}</b><br>${alertplayers}<br><br><b>Map</b><br>${alertmap}<br><br><b>Server IP</b><br><a href='https://www.gametracker.com/server_info/${alertip}:${port}'>${alertip}:${port}</a><br><br><b>Hostname</b><br>${HOSTNAME}<br><br><b>More info</b><br><a href='${alerturl}'>${alerturl}</a>" "https://api.pushover.net/1/messages.json" | grep errors)
if [ -n "${pushoversend}" ]; then
fn_print_fail_nl "Sending Pushover alert: ${pushoversend}"

2
lgsm/functions/alert_rocketchat.sh

@ -10,7 +10,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
json=$(cat <<EOF
{
"alias": "LinuxGSM",
"text": "*${alertemoji} ${alerttitle} ${alertemoji}* \n *${servername}* \n ${alertmessage} \n More info: ${alerturl}",
"text": "*${alertemoji} ${alerttitle} ${alertemoji}* \n *${servername}* \n ${alerttriggermessage} \n More info: ${alerturl}",
"attachments": [
{
"fields": [

2
lgsm/functions/alert_slack.sh

@ -92,7 +92,7 @@ json=$(cat <<EOF
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Message*\n${alertmessage} \n More info: ${alerturl}"
"text": "*Trigger Message*\n${alerttriggermessage} \n More info: ${alerturl}"
}
},
{

2
lgsm/functions/info_messages.sh

@ -79,6 +79,8 @@ fn_info_message_head(){
echo -e ""
echo -e "Version"
echo -e "${alertversion}"
echo -e "Information"
echo -e "${alerttriggermessage}"
}
fn_info_message_distro(){

Loading…
Cancel
Save