1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00

Export Status for OMR-Tracker scripts (#463)

This commit is contained in:
suyuan 2024-04-03 23:19:16 +08:00 committed by GitHub
commit 340c364ee7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 0 deletions

View file

@ -6,6 +6,9 @@ basename="$(basename $0)"
. /usr/lib/unbound/iptools.sh
export OMR_TRACKER_STATUS
export OMR_TRACKER_STATUS_MSG
_log() {
logger -p daemon.info -t "${basename}" "$@"
}
@ -213,6 +216,7 @@ _check_master() {
echo -e "Subject: $OMR_SYSNAME: Server ${name} (${ip}) is UP\n. The reason is \"$OMR_TRACKER_STATUS_MSG\"." | sendmail $(uci -q get mail.default.to)
fi
}
OMR_TRACKER_STATUS="OK"
script_alert_up="$(uci -q get omr-tracker.proxy.script_alert_up)"
[ -n "$script_alert_up" ] && eval $script_alert_up
count=$((count+1))
@ -241,6 +245,7 @@ _check_master() {
echo -e "Subject: $OMR_SYSNAME: Server ${name} (${ip}) is down\n. The reason is \"$OMR_TRACKER_STATUS_MSG\"." | sendmail $(uci -q get mail.default.to)
fi
}
OMR_TRACKER_STATUS="ERROR"
script_alert_down="$(uci -q get omr-tracker.proxy.script_alert_down)"
[ -n "$script_alert_down" ] && eval $script_alert_down
fi

View file

@ -12,6 +12,10 @@ else
IPTABLESSAVE="/usr/sbin/iptables-save"
fi
export OMR_TRACKER_STATUS
export OMR_TRACKER_PREV_STATUS
export OMR_TRACKER_STATUS_MSG
_log() {

View file

@ -10,6 +10,10 @@ else
IPTABLES="/usr/sbin/iptables"
fi
export OMR_TRACKER_STATUS
export OMR_TRACKER_PREV_STATUS
export OMR_TRACKER_STATUS_MSG
_log() {
logger -p daemon.info -t "${basename}" "$@"

View file

@ -10,6 +10,9 @@ else
IPTABLES="/usr/sbin/iptables"
fi
export OMR_TRACKER_STATUS
export OMR_TRACKER_PREV_STATUS
export OMR_TRACKER_STATUS_MSG
_log() {
logger -p daemon.info -t "${basename}" "$@"