Browse Source

more changes

pull/4345/head
Daniel Gibbs 2 years ago
parent
commit
f63b586f37
No known key found for this signature in database GPG Key ID: 2076B128385E8C55
  1. 4
      lgsm/modules/alert_gotify.sh
  2. 22
      lgsm/modules/alert_ifttt.sh
  3. 4
      lgsm/modules/alert_pushbullet.sh
  4. 4
      lgsm/modules/alert_pushover.sh
  5. 8
      lgsm/modules/alert_rocketchat.sh

4
lgsm/modules/alert_gotify.sh

@ -10,8 +10,8 @@ module_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
json=$( json=$(
cat << EOF cat << EOF
{ {
"title": "${alertemoji} ${alerttitle} ${alertemoji}", "title": "${alerttitle}",
"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\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}",
"priority": 5 "priority": 5
} }
EOF EOF

22
lgsm/modules/alert_ifttt.sh

@ -7,16 +7,32 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
json=$( jsoninfo=$(
cat << EOF cat << EOF
{ {
"value1": "${selfname}", "value1": "${selfname}",
"value2": "${alertemoji} ${alerttitle} ${alertemoji}", "value2": "${alerttitle}",
"value3": "Message: \n${alertmessage}\n\nGame: \n${gamename}\n\nServer name: \n${servername}\n\nHostname: \n${HOSTNAME}\n\nServer IP: \n${alertip}:${port}\n\nMore info: \n${alerturl}" "value3": "Information \n${alertmessage}\n\nGame: \n${gamename}\n\nServer name \n${servername}\n\nHostname \n${HOSTNAME}\n\nServer IP \n${alertip}:${port}\n\nMore info \n${alerturl}"
} }
EOF EOF
) )
jsonnoinfo=$(
cat << EOF
{
"value1": "${selfname}",
"value2": "${alerttitle}",
"value3": "Information \n${alertmessage}\n\nGame: \n${gamename}\n\nServer name \n${servername}\n\nHostname \n${HOSTNAME}\n\nServer IP \n${alertip}:${port}"
}
EOF
)
if [ -z "${alerturl}" ]; then
json="${jsonnoinfo}"
else
json="${jsoninfo}"
fi
fn_print_dots "Sending IFTTT alert" fn_print_dots "Sending IFTTT alert"
iftttsend=$(curl --connect-timeout 10 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "https://maker.ifttt.com/trigger/${iftttevent}/with/key/${ifttttoken}" | grep "Bad Request") iftttsend=$(curl --connect-timeout 10 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "https://maker.ifttt.com/trigger/${iftttevent}/with/key/${ifttttoken}" | grep "Bad Request")

4
lgsm/modules/alert_pushbullet.sh

@ -13,7 +13,7 @@ jsoninfo=$(
"channel_tag": "${channeltag}", "channel_tag": "${channeltag}",
"type": "note", "type": "note",
"title": "${alerttitle}", "title": "${alerttitle}",
"body": "Server name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}" "body": "Information\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}"
} }
EOF EOF
) )
@ -24,7 +24,7 @@ jsonnoinfo=$(
"channel_tag": "${channeltag}", "channel_tag": "${channeltag}",
"type": "note", "type": "note",
"title": "${alerttitle}", "title": "${alerttitle}",
"body": "Server name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}" "body": "Information\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}"
} }
EOF EOF
) )

4
lgsm/modules/alert_pushover.sh

@ -23,9 +23,9 @@ else
fi fi
if [ -z "${alerturl}" ]; then if [ -z "${alerturl}" ]; then
pushoversend=$(curl --connect-timeout 10 -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alerttitle}" -F message=" <b>Server name</b><br>${servername}<br><br><b>Information</b><br>${alertmessage}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br>${alertip}:${port}<br><br><b>Hostname</b><br>${HOSTNAME}" "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="${alerttitle}" -F message="Information</b><br>${alertmessage}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br>${alertip}:${port}<br><br><b>Hostname</b><br>${HOSTNAME}" "https://api.pushover.net/1/messages.json" | grep errors)
else else
pushoversend=$(curl --connect-timeout 10 -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alerttitle}" -F message=" <b>Server name</b><br>${servername}<br><br><b>Information</b><br>${alertmessage}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br>${alertip}:${port}<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="${alerttitle}" -F message="Information</b><br>${alertmessage}<br><br><b>Game</b><br>${gamename}<br><br><b>Server IP</b><br>${alertip}:${port}<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)
fi fi
if [ -n "${pushoversend}" ]; then if [ -n "${pushoversend}" ]; then

8
lgsm/modules/alert_rocketchat.sh

@ -11,23 +11,23 @@ json=$(
cat << EOF cat << EOF
{ {
"alias": "LinuxGSM", "alias": "LinuxGSM",
"text": "*${alertemoji} ${alerttitle} ${alertemoji}* \n *${servername}* \n ${alertmessage} \n More info: ${alerturl}", "text": "*${alerttitle}* \n ${alertmessage} \n More info: ${alerturl}",
"attachments": [ "attachments": [
{ {
"fields": [ "fields": [
{ {
"short": true, "short": true,
"title": "Game:", "title": "Game",
"value": "${gamename}" "value": "${gamename}"
}, },
{ {
"short": true, "short": true,
"title": "Server IP:", "title": "Server IP",
"value": "${alertip}:${port}" "value": "${alertip}:${port}"
}, },
{ {
"short": true, "short": true,
"title": "Hostname:", "title": "Hostname",
"value": "${HOSTNAME}" "value": "${HOSTNAME}"
} }
] ]

Loading…
Cancel
Save