3个版本
0.1.2 | 2021年8月13日 |
---|---|
0.1.1 | 2021年7月2日 |
0.1.0 | 2021年3月21日 |
#201 in WebSocket
每月40次下载
34KB
655 行
_ _ _ ____ _ _ ____ _
| |_(_) ___| | __/ ___| |__ __ _ ___| | _____ _ __| _ \ _ _ ___| |_
| __| |/ __| |/ / | | '_ \ / _` |/ __| |/ / _ \ '__| |_) | | | / __| __|
| |_| | (__| <| |___| | | | (_| | (__| < __/ | | _ <| |_| \__ \ |_
\__|_|\___|_|\_\\____|_| |_|\__,_|\___|_|\_\___|_| |_| \_\\__,_|___/\__| tickChecker for Rust
什么是TickChecker
- 检查目标存活状态
- 在失败后执行命令
- 在失败后执行远程调用(http或https)
- 将所有状态写入本地日志(带日志文件或json)
简而言之,TickChecker是一款用于任何领域服务器云计算的简单管理工具,用于检查目标服务是否存活。
好的,我们支持的协议
- Tcp ping(用于端口检查)
- Tcp over tls,类似于tcp ping
- ICMP
- Http或Https
- Websocket(仅检查端口,包括升级协议)
安装
使用Rust源代码
git clone https://gitlab.com/koangel/gTickCheckerRust.git
cd gTickCheckerRust
cargo build
使用二进制文件
- 下载Git发布包
- 解压
- 运行
./tickChecker
配置
log_path = "./log/tickChecker.log"
timer_debug = true
timer_log = "./log/timer.log"
# log level
log_level = "debug"
roll_count = 30
# mb
file_size = 50
# zero is cpu nums
work_thread = 0
[[action]]
id = 1
name = "httpAction"
# http or ping or tcp or tcp_tls or websocket
atype = "http"
# http : http://www.baidu.com or https://www.baidu.com ,check use get method
# ping : 192.168.1.1
# tcp : 192.168.1.75:80
# tcp_tls : 192.168.1.75:443
# websocket : http://192.168.1.75/ws (only upgrade)
target = "http://www.baidu.com"
# for https or tcp tls ,skip host and cret check.
skip_tls_check = true
# output result data
output_result = true
# check timeout time,millis
timeout = 10000
# failed count do action
fail_count = 2
# failed do action, http or command
fail_type = "http"
# http method get only
fail = "http://www.163.com/abc?a=1"
# recover do action, http or command
recover_type = "http"
recover = "http://www.163.com/abc?a=2"
# wait loop, millis
count = -1
# tick millis
tick = 60000
操作配置
[[action]]
id = 1
name = "httpAction"
# http or ping or tcp or tcp_tls or websocket
atype = "http"
# http : http://www.baidu.com or https://www.baidu.com ,check use get method
# ping : 192.168.1.1
# tcp : 192.168.1.75:80
# tcp_tls : 192.168.1.75:443
# websocket : http://192.168.1.75/ws (only upgrade)
target = "http://www.baidu.com"
skip_tls_check = true
output_result = true
timeout = 10000
# failed count do action
fail_count = 2
# failed do action, http or command
fail_type = "http"
# http method get only
fail = "http://www.163.com/abc?a=1"
# recover do action, http or command
recover_type = "http"
recover = "http://www.163.com/abc?a=2"
# wait loop, 毫秒
count = -1
# tick
tick = 60000
[[action]]
id = 2
name = "pingAction"
# http or ping or tcp or tcp_tls or websocket
atype = "ping"
# http : http://www.baidu.com or https://www.baidu.com
# ping : 192.168.1.1
# tcp : 192.168.1.75:80
# tcp_tls : 192.168.1.75:443
# websocket : http://192.168.1.75/ws (only upgrade)
target = "192.168.1.75"
skip_tls_check = true
output_result = true
timeout = 2000
# failed count do action
fail_count = 2
# failed do action, http or command
fail_type = "command"
# http method get only
fail = 'echo "ping failed ip: {target}"'
# recover do action, http or command
recover_type = "command"
recover = 'echo "recover ping ip: {target}"'
# wait loop, 毫秒
count = -1
# tick
tick = 60000
[[action]]
id = 3
name = "tcpAction"
# http or ping or tcp or tcp_tls or websocket
atype = "tcp"
# http : http://www.baidu.com or https://www.baidu.com
# ping : 192.168.1.1
# tcp : 192.168.1.75:80
# tcp_tls : 192.168.1.75:443
# websocket : http://192.168.1.75/ws (only upgrade)
target = "192.168.1.75:80"
skip_tls_check = true
output_result = true
timeout = 3000
# failed count do action
fail_count = 2
# failed do action, http or command
fail_type = "command"
# http method get only
fail = 'echo "tcp failed ip: {target}"'
# recover do action, http or command
recover_type = "command"
recover = 'echo "tcp ping ip: {target}"'
# wait loop, 毫秒
count = -1
# tick
tick = 60000
[[action]]
id = 4
name = "tlsAction"
# http or ping or tcp or tcp_tls or websocket
atype = "tcp_tls"
# http : http://www.baidu.com or https://www.baidu.com
# ping : 192.168.1.1
# tcp : 192.168.1.75:80
# tcp_tls : 192.168.1.75:443
# websocket : http://192.168.1.75/ws (only upgrade)
target = "192.168.1.75:443"
skip_tls_check = true
output_result = true
timeout = 3000
# failed count do action
fail_count = 2
# failed do action, http or command
fail_type = "http"
# http method get only
fail = "http://www.163.com/abc?a=1"
# recover do action, http or command
recover_type = "http"
recover = "http://www.163.com/abc?a=2"
# wait loop, 毫秒
count = -1
# tick
tick = 60000
[[action]]
id = 5
name = "wsAction"
# http or ping or tcp or tcp_tls or websocket
atype = "websocket"
# http : http://www.baidu.com or https://www.baidu.com
# ping : 192.168.1.1
# tcp : 192.168.1.75:80
# tcp_tls : 192.168.1.75:443
# websocket : ws://192.168.1.75/ws (only upgrade)
target = "ws://192.168.1.75/ws"
skip_tls_check = true
output_result = true
timeout = 3000
# failed count do action
fail_count = 2
# failed do action, http or command
fail_type = "http"
# http method get only
fail = "http://www.163.com/abc?a=1"
# recover do action, http or command
recover_type = "http"
recover = "http://www.163.com/abc?a=2"
# wait loop, 毫秒
count = -1
# tick
tick = 60000
日志目录
log/tickChecker.log
log/timer.log
其他项目
依赖项
~20–33MB
~577K SLoC