Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dgibbs64 committed Oct 17, 2023
1 parent 3912d02 commit f63b586
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lgsm/modules/alert_gotify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module_selfname="$(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}",
"title": "${alerttitle}",
"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
}
EOF
Expand Down
22 changes: 19 additions & 3 deletions lgsm/modules/alert_ifttt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,32 @@

moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"

json=$(
jsoninfo=$(
cat << EOF
{
"value1": "${selfname}",
"value2": "${alertemoji} ${alerttitle} ${alertemoji}",
"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}"
"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}\n\nMore info \n${alerturl}"
}
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"
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")

Expand Down
4 changes: 2 additions & 2 deletions lgsm/modules/alert_pushbullet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jsoninfo=$(
"channel_tag": "${channeltag}",
"type": "note",
"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
)
Expand All @@ -24,7 +24,7 @@ jsonnoinfo=$(
"channel_tag": "${channeltag}",
"type": "note",
"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
)
Expand Down
4 changes: 2 additions & 2 deletions lgsm/modules/alert_pushover.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ else
fi

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
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

if [ -n "${pushoversend}" ]; then
Expand Down
8 changes: 4 additions & 4 deletions lgsm/modules/alert_rocketchat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ json=$(
cat << EOF
{
"alias": "LinuxGSM",
"text": "*${alertemoji} ${alerttitle} ${alertemoji}* \n *${servername}* \n ${alertmessage} \n More info: ${alerturl}",
"text": "*${alerttitle}* \n ${alertmessage} \n More info: ${alerturl}",
"attachments": [
{
"fields": [
{
"short": true,
"title": "Game:",
"title": "Game",
"value": "${gamename}"
},
{
"short": true,
"title": "Server IP:",
"title": "Server IP",
"value": "${alertip}:${port}"
},
{
"short": true,
"title": "Hostname:",
"title": "Hostname",
"value": "${HOSTNAME}"
}
]
Expand Down

0 comments on commit f63b586

Please sign in to comment.