Now you can run script on watchdog startup. File structure changed on *nix. Some changes in config file and scripts, please check on upgrade.
Now you can run script on watchdog startup. File structure changed on *nix. Some changes in config file and scripts, please check on upgrade.
This commit is contained in:
@@ -1,29 +1,25 @@
|
||||
[main]
|
||||
check_interval = 10
|
||||
rules_count = 3
|
||||
|
||||
[notifications]
|
||||
email = admin@server.local
|
||||
command = send-telegram <message>
|
||||
service_start = true
|
||||
on_start_command = /etc/cai-watchdog/on-start
|
||||
|
||||
[rule1]
|
||||
service = Test1
|
||||
uri = http://127.0.0.1:3000/api/v1/
|
||||
process =
|
||||
email = admin@server.local
|
||||
command = send-telegram <message>
|
||||
command = /etc/cai-watchdog/send-telegram <message>
|
||||
|
||||
[rule2]
|
||||
service = Test2
|
||||
uri = http://127.0.0.1:3300/api/v1/
|
||||
process =
|
||||
email = admin@server.local
|
||||
command = send-telegram <message>
|
||||
command = /etc/cai-watchdog/send-telegram <message>
|
||||
|
||||
[rule3]
|
||||
service = Apache
|
||||
uri =
|
||||
process = httpd
|
||||
email = admin@server.local
|
||||
command = send-telegram <message>
|
||||
command = /etc/cai-watchdog/send-telegram <message>
|
||||
5
scripts/unix/etc/cai-watchdog/icons-inc
Normal file
5
scripts/unix/etc/cai-watchdog/icons-inc
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
ICON_INFO=$(echo -e "\U2139")
|
||||
ICON_WARNING=$(echo -e "\U26A0")
|
||||
ICON_OK=$(echo -e "\U2705")
|
||||
ICON_FAIL=$(echo -e "\U274C")
|
||||
4
scripts/unix/etc/cai-watchdog/on-start
Normal file
4
scripts/unix/etc/cai-watchdog/on-start
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
APP_PATH=/etc/cai-watchdog
|
||||
source ${APP_PATH}/inc-icons
|
||||
${APP_PATH}/send-telegram "${ICON_INFO} ATTENTION! Watchdog is stopped!"
|
||||
4
scripts/unix/etc/cai-watchdog/on-stop
Normal file
4
scripts/unix/etc/cai-watchdog/on-stop
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
APP_PATH=/etc/cai-watchdog
|
||||
source ${APP_PATH}/inc-icons
|
||||
${APP_PATH}/send-telegram "${ICON_WARNING} ATTENTION! Watchdog is stopped!"
|
||||
@@ -3,7 +3,7 @@ rcpt=$1
|
||||
subj=$2
|
||||
message=$3
|
||||
|
||||
ARGS=$(xargs echo $(perl -anle 's/^[^:]+//g && s/:\s+//g && print' /etc/email.conf) < /dev/null)
|
||||
ARGS=$(xargs echo $(perl -anle 's/^[^:]+//g && s/:\s+//g && print' /etc/cai-watchdog/email.conf) < /dev/null)
|
||||
set -- $ARGS "$@";
|
||||
|
||||
declare -A email;
|
||||
@@ -7,7 +7,7 @@ if [ "$#" -ne 1 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ARGS=$(xargs echo $(perl -anle 's/^[^:]+//g && s/:\s+//g && print' /etc/email.conf) < /dev/null)
|
||||
ARGS=$(xargs echo $(perl -anle 's/^[^:]+//g && s/:\s+//g && print' /etc/cai-watchdog/email.conf) < /dev/null)
|
||||
set -- $ARGS "$@";
|
||||
|
||||
GROUP_ID=$1
|
||||
@@ -6,7 +6,7 @@ User=wwwrun
|
||||
Group=www
|
||||
Type=simple
|
||||
ExecStart=/usr/local/sbin/cai-watchdog
|
||||
#ExecStopPost=/usr/local/sbin/cai-watchdog-stopped
|
||||
#ExecStopPost=/etc/cai-watchdog/on-stop
|
||||
#ExecStopPost=send-telegram 'ATTENTION! Watchdog is stopped!'
|
||||
|
||||
KillMode=control-group
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
ICON_WARNING=$(echo -e "\U26A0")
|
||||
send-telegram "${ICON_WARNING} ATTENTION! Watchdog is stopped!"
|
||||
Reference in New Issue
Block a user