|
@@ -7,38 +7,38 @@
|
|
|
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
|
|
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
|
|
|
|
|
|
|
|
if ! command -v jq > /dev/null; then
|
|
if ! command -v jq > /dev/null; then
|
|
|
- fn_print_fail_nl "Sending Rocketchat alert: jq is missing."
|
|
|
|
|
- fn_script_log_fatal "Sending Rocketchat alert: jq is missing."
|
|
|
|
|
|
|
+ fn_print_fail_nl "Sending Rocketchat alert: jq is missing."
|
|
|
|
|
+ fn_script_log_fatal "Sending Rocketchat alert: jq is missing."
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
json=$(cat <<EOF
|
|
json=$(cat <<EOF
|
|
|
{
|
|
{
|
|
|
- "alias": "LinuxGSM",
|
|
|
|
|
- "text": "*${alertemoji} ${alertsubject} ${alertemoji}* + \n ${alertbody}",
|
|
|
|
|
- "attachments": [
|
|
|
|
|
- {
|
|
|
|
|
- "title": "Linuxgsm Alert",
|
|
|
|
|
- "text": "Hostname: ${HOSTNAME}",
|
|
|
|
|
- "color": "#36a64f",
|
|
|
|
|
- "fields": [
|
|
|
|
|
- {
|
|
|
|
|
- "short": true,
|
|
|
|
|
- "title": "Game:",
|
|
|
|
|
- "value": "${gamename}"
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- "short": true,
|
|
|
|
|
- "title": "Server IP:",
|
|
|
|
|
- "value": "${alertip}:${port}"
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- "short": true,
|
|
|
|
|
- "title": "Server Name:",
|
|
|
|
|
- "value": "${servername}"
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ "alias": "LinuxGSM",
|
|
|
|
|
+ "text": "*${alertemoji} ${alertsubject} ${alertemoji}* + \n ${alertbody}",
|
|
|
|
|
+ "attachments": [
|
|
|
|
|
+ {
|
|
|
|
|
+ "title": "Linuxgsm Alert",
|
|
|
|
|
+ "text": "Hostname: ${HOSTNAME}",
|
|
|
|
|
+ "color": "#36a64f",
|
|
|
|
|
+ "fields": [
|
|
|
|
|
+ {
|
|
|
|
|
+ "short": true,
|
|
|
|
|
+ "title": "Game:",
|
|
|
|
|
+ "value": "${gamename}"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "short": true,
|
|
|
|
|
+ "title": "Server IP:",
|
|
|
|
|
+ "value": "${alertip}:${port}"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "short": true,
|
|
|
|
|
+ "title": "Server Name:",
|
|
|
|
|
+ "value": "${servername}"
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
}
|
|
}
|
|
|
EOF
|
|
EOF
|
|
|
)
|
|
)
|
|
@@ -48,9 +48,9 @@ fn_print_dots "Sending Rocketchat alert"
|
|
|
rocketlaunch=$(curl -sSL -H "Content-Type:application/json" -X POST -d "$(echo -n "$json" | jq -c .)" "${rocketchatwebhook}")
|
|
rocketlaunch=$(curl -sSL -H "Content-Type:application/json" -X POST -d "$(echo -n "$json" | jq -c .)" "${rocketchatwebhook}")
|
|
|
|
|
|
|
|
if [ "${rocketlaunch}" == "ok" ]; then
|
|
if [ "${rocketlaunch}" == "ok" ]; then
|
|
|
- fn_print_ok_nl "Sending Rocketchat alert"
|
|
|
|
|
- fn_script_log_pass "Sending Rocketchat alert"
|
|
|
|
|
|
|
+ fn_print_ok_nl "Sending Rocketchat alert"
|
|
|
|
|
+ fn_script_log_pass "Sending Rocketchat alert"
|
|
|
else
|
|
else
|
|
|
- fn_print_fail_nl "Sending Rocketchat alert: ${rocketlaunch}"
|
|
|
|
|
- fn_script_log_fatal "Sending Rocketchat alert: ${rocketlaunch}"
|
|
|
|
|
|
|
+ fn_print_fail_nl "Sending Rocketchat alert: ${rocketlaunch}"
|
|
|
|
|
+ fn_script_log_fatal "Sending Rocketchat alert: ${rocketlaunch}"
|
|
|
fi
|
|
fi
|