Skip to content

Commit bbb8a34

Browse files
committed
v1.6.1
1 parent e608f15 commit bbb8a34

File tree

6 files changed

+54
-39
lines changed

6 files changed

+54
-39
lines changed

Cargo.lock

Lines changed: 21 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/zdz/ServerStatus-Rust)](https://github.com/zdz/ServerStatus-Rust/releases)
88
[![GitHub all releases](https://img.shields.io/github/downloads/zdz/ServerStatus-Rust/total)](https://github.com/zdz/ServerStatus-Rust/releases)
99

10-
11-
<img width="1351" alt="image" src="https://user-images.githubusercontent.com/152173/205429787-5afc1590-dfae-4808-b2cc-b89889b3a6b9.png">
10+
<img width="1317" alt="image" src="https://user-images.githubusercontent.com/152173/206825541-6eaeb856-0c03-479a-b07e-006b60b41c02.png">
1211
<img width="1436" alt="image" src="https://user-images.githubusercontent.com/152173/165958225-25fc8fda-5798-42f8-bac5-72d778c0bab5.png">
1312

1413
<h2>Table of Contents</h2>
@@ -33,7 +32,7 @@
3332
- [8. 最后](#8-最后)
3433

3534
## 1. 介绍
36-
`ServerStatus` 威力加强版,保持轻量和简化部署,增加主要特性如下
35+
`ServerStatus` 威力加强版,保持轻量和简单部署,增加以下主要特性
3736

3837
- 使用 `rust` 完全重写 `server``client`,单个执行文件部署
3938
- 支持上下线和简单自定义规则告警 (`telegram``wechat``email``webhook`)
@@ -224,7 +223,7 @@ custom_tpl = """
224223
{% endif %}
225224
"""
226225

227-
# wechat, email 等其它通知方式 配置详细见 config.toml
226+
# wechat, email, webhook 等其它通知方式 配置详细见 config.toml
228227
```
229228

230229
### 3.2 服务端运行
@@ -259,6 +258,7 @@ docker-compose up -d
259258
# Rust 版只在 CentOS, Ubuntu, Debian 测试过
260259
# alpine linux 需要安装相关命令 apk add procps iproute2 coreutils
261260
# 如果 Rust 版客户端在你的系统无法使用,请切换到下面 4.2 跨平台版本
261+
262262
# systemd 方式, 参照 one-touch.sh 脚本 (推荐)
263263

264264
# 💪 手动方式
@@ -287,6 +287,7 @@ OPTIONS:
287287
--json use json protocol, default:false
288288
--location <LOCATION> location [default: ]
289289
-n, --vnstat enable vnstat, default:false
290+
--vnstat-mr <VNSTAT_MR> vnstat month rotate 1-28 [default: 1]
290291
-p, --pass <PASS> password [default: p1]
291292
-t, --type <HOST_TYPE> host type [default: ]
292293
-u, --user <USER> username [default: h1]

client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = "2021"
33
name = "stat_client"
4-
version = "1.6.0"
4+
version = "1.6.1"
55

66
rust-version = "1.65"
77

config.toml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ admin_pass = ""
1313
# notify = false 单独禁止单台机器的告警,一般针对网络差,频繁上下线
1414
# monthstart = 1 没启用vnstat时,表示月流量从每月哪天开始统计
1515
# disabled = true 单机禁用
16-
# location 支持国旗emoji https://emojixd.com/group/flags
16+
# location 支持国旗 emoji https://emojixd.com/group/flags
1717
# 或国家缩写,如 cn us 等等,所有国家见目录 web/static/flags
1818
# 自定义标签 labels = "os=centos;ndd=2022/11/25;spec=2C/4G/60G;"
1919
# os 标签可选,不填则使用上报数据,ndd(next due date) 下次续费时间, spec 为主机规格
@@ -53,9 +53,9 @@ notify_interval = 30
5353
enabled = false
5454
bot_token = "<tg bot token>"
5555
chat_id = "<chat id>"
56-
# host 可用字段参见 payload.rs 文件 HostStat 结构, {{host.xxx}} 为占位变量
56+
# host 可用字段见 payload.rs 文件 HostStat 结构, {{host.xxx}} 为占位变量
5757
# 例如 host.name 可替换为 host.alias,大家根据自己的喜好来编写通知消息
58-
# {{ip_info.query}} 主机 ip, {{sys_info.host_name}} 主机 hostname
58+
# {{ip_info.query}} 主机 ip, {{sys_info.host_name}} 主机 hostname,见 server_status.proto
5959
title = "❗<b>Server Status</b>"
6060
online_tpl = "{{config.title}} \n😆 {{host.location}} {{host.name}} 主机恢复上线啦"
6161
offline_tpl = "{{config.title}} \n😱 {{host.location}} {{host.name}} 主机已经掉线啦"
@@ -71,6 +71,14 @@ custom_tpl = """
7171
"""
7272
###################### tgbot end ##########################
7373

74+
## 可选 单纯记录 event 到日志文件,调试自定义告警使用
75+
[log]
76+
enabled = false
77+
log_dir = "/opt/ServerStatus/logs"
78+
tpl = """{% set obj = dict(event=event, host=host, ip_info=ip_info, sys_info=sys_info) %} {{ obj | tojson}}"""
79+
80+
###################### log end ##########################
81+
7482
## 可选 微信通知
7583
[wechat]
7684
enabled = false
@@ -114,15 +122,10 @@ custom_tpl = """
114122

115123
###################### email end ##########################
116124

117-
## 可选 单纯记录 event 到日志文件
118-
[log]
119-
enabled = false
120-
log_dir = "/opt/ServerStatus/logs"
121-
tpl = """{% set obj = dict(event=event, host=host, ip_info=ip_info, sys_info=sys_info) %} {{ obj | tojson}}"""
122-
123-
124-
## script 使用脚本引擎 https://rhai.rs/book/
125125
## 可选 webhook
126+
# 理论上支持所有支持 webhook 的软件,如 Discord、 Slack、 飞书、 企业版微信(WorkWechat)、 钉钉(DingTalk)等。
127+
# webhook 调用基本上都差不多,差异只在最后返回的 json 结构,根据各自的 api 文档自行构建相应的 json 结构即可。
128+
# script 使用脚本引擎 https://rhai.rs/book/
126129
[webhook]
127130
# 总开关
128131
enabled = false

example.env

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,23 @@ SSR_DEBUG=true
99
SSR_ADDR=http://127.0.0.1:8080/report
1010
# SSR_USER=h1
1111
SSR_PASS=p1
12+
13+
# group mode
14+
#SSR_GID=
15+
#SSR_ALIAS=
16+
#SSR_LOC=
17+
#SSR_TYPE=
18+
19+
# vnstat
1220
SSR_VNSTAT=true
21+
SSR_VNSTAT_MR=1
22+
1323
SSR_DISABLE_TUPD=false
1424
SSR_DISABLE_PING=false
1525
SSR_DISABLE_EXTRA=false
1626
SSR_DISABLE_NOTIFY=false
27+
28+
#SSR_IFACE=
1729
SSR_EXCLUDE_IFACE=lo,docker,vnet,veth,vmbr,kube,br-
1830

1931
SSR_WEIGHT=0

server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = "2021"
33
name = "stat_server"
4-
version = "1.6.0"
4+
version = "1.6.1"
55

66
rust-version = "1.65"
77

0 commit comments

Comments
 (0)