mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
New version of OMR-Tracker
This commit is contained in:
parent
bb64827a1e
commit
f5b3aa6831
15 changed files with 831 additions and 318 deletions
|
@ -1,32 +1,38 @@
|
|||
config defaults 'defaults'
|
||||
option enabled '1'
|
||||
list hosts '4.2.2.1'
|
||||
list hosts '8.8.8.8'
|
||||
list hosts '80.67.169.12'
|
||||
list hosts '8.8.4.4'
|
||||
list hosts '9.9.9.9'
|
||||
list hosts '1.0.0.1'
|
||||
list hosts '114.114.115.115'
|
||||
list hosts '1.2.4.8'
|
||||
list hosts '80.67.169.40'
|
||||
list hosts '114.114.114.114'
|
||||
list hosts '1.1.1.1'
|
||||
list hosts6 '2606:4700:4700::1111'
|
||||
list hosts6 '2606:4700:4700::1001'
|
||||
list hosts6 '2620:fe::fe'
|
||||
list hosts6 '2620:fe::9'
|
||||
list hosts6 '2001:4860:4860::8888'
|
||||
list hosts6 '2001:4860:4860::8844'
|
||||
option timeout '2'
|
||||
option count '2'
|
||||
option tries '3'
|
||||
option interval '2'
|
||||
option interval_tries '1'
|
||||
option type 'ping'
|
||||
option wait_test '0'
|
||||
option server_http_test '0'
|
||||
option restart_down '0'
|
||||
option mail_alert '0'
|
||||
list hosts '4.2.2.1'
|
||||
list hosts '8.8.8.8'
|
||||
list hosts '80.67.169.12'
|
||||
list hosts '8.8.4.4'
|
||||
list hosts '9.9.9.9'
|
||||
list hosts '1.0.0.1'
|
||||
list hosts '114.114.115.115'
|
||||
list hosts '1.2.4.8'
|
||||
list hosts '80.67.169.40'
|
||||
list hosts '114.114.114.114'
|
||||
list hosts '1.1.1.1'
|
||||
list hosts6 '2606:4700:4700::1111'
|
||||
list hosts6 '2606:4700:4700::1001'
|
||||
list hosts6 '2620:fe::fe'
|
||||
list hosts6 '2620:fe::9'
|
||||
list hosts6 '2001:4860:4860::8888'
|
||||
list hosts6 '2001:4860:4860::8844'
|
||||
option timeout '2'
|
||||
option count '2'
|
||||
option tries '3'
|
||||
option interval '2'
|
||||
option interval_tries '1'
|
||||
option type 'ping'
|
||||
option wait_test '0'
|
||||
option server_http_test '0'
|
||||
option restart_down '0'
|
||||
option mail_alert '0'
|
||||
option initial_state 'online'
|
||||
option family 'ipv4'
|
||||
option reliability '1'
|
||||
option count '2'
|
||||
option failure_interval '5'
|
||||
option tries_up '5'
|
||||
|
||||
config proxy 'proxy'
|
||||
option enabled '1'
|
||||
|
@ -43,6 +49,8 @@ config proxy 'proxy'
|
|||
option interval_tries '1'
|
||||
option interval '10'
|
||||
option mail_alert '0'
|
||||
option initial_state 'online'
|
||||
option family 'ipv4ipv6'
|
||||
|
||||
config server 'server'
|
||||
option enabled '1'
|
||||
|
@ -51,3 +59,4 @@ config server 'server'
|
|||
option wait_test '0'
|
||||
option interval '5'
|
||||
option mail_alert '0'
|
||||
option initial_state 'online'
|
|
@ -16,34 +16,54 @@
|
|||
. /lib/functions/network.sh
|
||||
|
||||
_validate_section() {
|
||||
local tmp_hosts=$hosts tmp_hosts6=$hosts6 tmp_timeout=$timeout tmp_count=$count tmp_tries=$tries
|
||||
local tmp_interval=$interval tmp_interval_tries=$interval_tries tmp_options=$options tmp_type=$type tmp_enabled=$enabled tmp_wait_test=$wait_test tmp_server_http_test=$server_http_test
|
||||
local tmp_hosts=$hosts tmp_hosts6=$hosts6 tmp_timeout=$timeout tmp_count=$count tmp_tries=$tries tmp_size=$size tmp_max_ttl=$max_ttl tmp_failure_loss=$failure_loss tmp_failure_latency=$failure_latency tmp_recovery_loss=$recovery_loss tmp_recovery_latency=$recovery_latency
|
||||
local tmp_interval=$interval tmp_interval_tries=$interval_tries tmp_options=$options tmp_type=$type tmp_enabled=$enabled tmp_wait_test=$wait_test tmp_server_http_test=$server_http_test tmp_check_quality=$check_quality tmp_failure_interval=$failure_interval tmp_tries_up=$tries_up tmp_family=$family
|
||||
|
||||
uci_validate_section omr-tracker "$1" "$2" \
|
||||
'hosts:list(host)' \
|
||||
'hosts6:list(host)' \
|
||||
'timeout:uinteger' \
|
||||
'size:uinteger' \
|
||||
'max_ttl:uinteger' \
|
||||
'failure_loss:uinteger' \
|
||||
'failure_latency:uinteger' \
|
||||
'recovery_loss:uinteger' \
|
||||
'recovery_latency:uinteger' \
|
||||
'check_quality:bool:0' \
|
||||
'count:uinteger' \
|
||||
'tries:uinteger' \
|
||||
'tries_up:uinteger' \
|
||||
'interval:uinteger' \
|
||||
'interval_tries:uinteger' \
|
||||
'failure_interval:uinteger' \
|
||||
'wait_test:uinteger' \
|
||||
'type:string:undef' \
|
||||
'enabled:bool:1' \
|
||||
'server_http_test:bool:0' \
|
||||
'family:string' \
|
||||
'options:string'
|
||||
|
||||
[ -z "$hosts" ] && hosts=$tmp_hosts
|
||||
[ -z "$hosts6" ] && hosts6=$tmp_hosts6
|
||||
[ -z "$timeout" ] && timeout=$tmp_timeout
|
||||
[ -z "$count" ] && count=$tmp_count
|
||||
[ -z "$size" ] && size=$tmp_size
|
||||
[ -z "$failure_loss" ] && failure_loss=$tmp_failure_loss
|
||||
[ -z "$failure_latency" ] && failure_latency=$tmp_failure_latency
|
||||
[ -z "$failure_interval" ] && failure_interval=$tmp_failure_interval
|
||||
[ -z "$recovery_loss" ] && recovery_loss=$tmp_recovery_loss
|
||||
[ -z "$recovery_latency" ] && recovery_latency=$tmp_recovery_latency
|
||||
[ -z "$check_quality" ] && check_quality=$tmp_check_quality
|
||||
[ -z "$max_ttl" ] && max_ttl=$tmp_max_ttl
|
||||
[ -z "$tries" ] && tries=$tmp_tries
|
||||
[ -z "$tries_up" ] && tries_up=$tmp_tries_up
|
||||
[ -z "$interval" ] && interval=$tmp_interval
|
||||
[ -z "$interval_tries" ] && interval_tries=$tmp_interval_tries
|
||||
[ -z "$wait_test" ] && wait_test=$tmp_wait_test
|
||||
[ -z "$options" ] && options=$tmp_options
|
||||
[ "$type" = "undef" ] && type=${tmp_type:-ping}
|
||||
[ -z "$server_http_test" ] && server_http_test=$tmp_server_http_test
|
||||
[ -z "$family" ] && family=$tmp_family
|
||||
[ -z "$enabled" ] && enabled=$tmp_enabled
|
||||
}
|
||||
|
||||
|
@ -52,7 +72,7 @@ _launch_tracker() {
|
|||
loopback|lan*|if0*) return;;
|
||||
esac
|
||||
[ -z "$1" ] && return
|
||||
local hosts hosts6 timeout count tries interval interval_tries options type enabled wait_test ipv6 proto server_http_test
|
||||
local hosts hosts6 timeout count tries tries_up interval interval_tries options type enabled wait_test ipv6 proto server_http_test size max_ttl failure_loss failure_interval failure_latency recovery_loss recovery_latency family
|
||||
_validate_section "defaults" "defaults"
|
||||
_validate_section "interface" "$1"
|
||||
|
||||
|
@ -80,6 +100,11 @@ _launch_tracker() {
|
|||
#[ "${ifstatus}" = "false" ] && [ -z "${ifdevice}" ] && return
|
||||
[ -z "${interval_tries}" ] && interval_tries=1
|
||||
[ -z "${count}" ] && count=2
|
||||
[ -z "${max_ttl}" ] && max_ttl=60
|
||||
[ -z "${size}" ] && size=56
|
||||
[ -z "${check_quality}" ] && check_quality=0
|
||||
[ -z "${tries}" ] && tries=5
|
||||
[ -z "${tries_up}" ] && tries_up=${tries}
|
||||
|
||||
procd_open_instance
|
||||
# shellcheck disable=SC2086
|
||||
|
@ -87,14 +112,24 @@ _launch_tracker() {
|
|||
procd_append_param env "OMR_TRACKER_HOSTS=$hosts"
|
||||
procd_append_param env "OMR_TRACKER_HOSTS6=$hosts6"
|
||||
procd_append_param env "OMR_TRACKER_TIMEOUT=$timeout"
|
||||
procd_append_param env "OMR_TRACKER_SIZE=$size"
|
||||
procd_append_param env "OMR_TRACKER_CHECK_QUALITY=$check_quality"
|
||||
procd_append_param env "OMR_TRACKER_MAX_TTL=$max_ttl"
|
||||
procd_append_param env "OMR_TRACKER_FAILURE_LOSS=$failure_loss"
|
||||
procd_append_param env "OMR_TRACKER_FAILURE_LATENCY=$failure_latency"
|
||||
procd_append_param env "OMR_TRACKER_RECOVERY_LOSS=$recovery_loss"
|
||||
procd_append_param env "OMR_TRACKER_RECOVERY_LATENCY=$recovery_latency"
|
||||
procd_append_param env "OMR_TRACKER_COUNT=$count"
|
||||
procd_append_param env "OMR_TRACKER_TRIES=$tries"
|
||||
procd_append_param env "OMR_TRACKER_TRIES_UP=$tries_up"
|
||||
procd_append_param env "OMR_TRACKER_INTERVAL=$interval"
|
||||
procd_append_param env "OMR_TRACKER_FAILURE_INTERVAL=$failure_interval"
|
||||
procd_append_param env "OMR_TRACKER_INTERVAL_TRIES=$interval_tries"
|
||||
procd_append_param env "OMR_TRACKER_TABLE=$ip4table"
|
||||
procd_append_param env "OMR_TRACKER_DEVICE=$ifname"
|
||||
procd_append_param env "OMR_TRACKER_DEVICE_GATEWAY=$gateway"
|
||||
procd_append_param env "OMR_TRACKER_TYPE=$type"
|
||||
procd_append_param env "OMR_TRACKER_FAMILY=$family"
|
||||
procd_append_param env "OMR_TRACKER_IPV6=$ipv6"
|
||||
procd_append_param env "OMR_TRACKER_PROTO=$proto"
|
||||
procd_append_param env "OMR_TRACKER_WAIT_TEST=$wait_test"
|
||||
|
|
|
@ -106,4 +106,26 @@ if [ "$(uci -q get omr-tracker.defaults.server_http_test)" = "" ]; then
|
|||
EOF
|
||||
fi
|
||||
|
||||
if [ "$(uci -q get omr-tracker.defaults.family)" = "" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set omr-tracker.defaults.initial_state='online'
|
||||
set omr-tracker.defaults.family='ipv4ipv6'
|
||||
set omr-tracker.defaults.reliability='1'
|
||||
set omr-tracker.defaults.interval='1'
|
||||
set omr-tracker.defaults.failure_interval='5'
|
||||
set omr-tracker.defaults.count='1'
|
||||
set omr-tracker.defaults.tries_up='5'
|
||||
set omr-tracker.omrvpn.initial_state='online'
|
||||
set omr-tracker.omrvpn.family='ipv4'
|
||||
set omr-tracker.omrvpn.reliability='1'
|
||||
set omr-tracker.omrvpn.failure_interval='5'
|
||||
set omr-tracker.omrvpn.tries_up='5'
|
||||
set omr-tracker.omrvpn.count='1'
|
||||
set omr-tracker.proxy.initial_state='online'
|
||||
set omr-tracker.proxy.family='ipv4ipv6'
|
||||
set omr-tracker.server.initial_state='online'
|
||||
commit omr-tracker
|
||||
EOF
|
||||
fi
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue