Skip to content

Commit

Permalink
v1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
zdz committed Dec 10, 2022
1 parent e608f15 commit bbb8a34
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 39 deletions.
43 changes: 21 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/zdz/ServerStatus-Rust)](https://github.com/zdz/ServerStatus-Rust/releases)
[![GitHub all releases](https://img.shields.io/github/downloads/zdz/ServerStatus-Rust/total)](https://github.com/zdz/ServerStatus-Rust/releases)


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

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

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

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

# wechat, email 等其它通知方式 配置详细见 config.toml
# wechat, email, webhook 等其它通知方式 配置详细见 config.toml
```

### 3.2 服务端运行
Expand Down Expand Up @@ -259,6 +258,7 @@ docker-compose up -d
# Rust 版只在 CentOS, Ubuntu, Debian 测试过
# alpine linux 需要安装相关命令 apk add procps iproute2 coreutils
# 如果 Rust 版客户端在你的系统无法使用,请切换到下面 4.2 跨平台版本

# systemd 方式, 参照 one-touch.sh 脚本 (推荐)

# 💪 手动方式
Expand Down Expand Up @@ -287,6 +287,7 @@ OPTIONS:
--json use json protocol, default:false
--location <LOCATION> location [default: ]
-n, --vnstat enable vnstat, default:false
--vnstat-mr <VNSTAT_MR> vnstat month rotate 1-28 [default: 1]
-p, --pass <PASS> password [default: p1]
-t, --type <HOST_TYPE> host type [default: ]
-u, --user <USER> username [default: h1]
Expand Down
2 changes: 1 addition & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "stat_client"
version = "1.6.0"
version = "1.6.1"

rust-version = "1.65"

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

## 可选 单纯记录 event 到日志文件,调试自定义告警使用
[log]
enabled = false
log_dir = "/opt/ServerStatus/logs"
tpl = """{% set obj = dict(event=event, host=host, ip_info=ip_info, sys_info=sys_info) %} {{ obj | tojson}}"""

###################### log end ##########################

## 可选 微信通知
[wechat]
enabled = false
Expand Down Expand Up @@ -114,15 +122,10 @@ custom_tpl = """

###################### email end ##########################

## 可选 单纯记录 event 到日志文件
[log]
enabled = false
log_dir = "/opt/ServerStatus/logs"
tpl = """{% set obj = dict(event=event, host=host, ip_info=ip_info, sys_info=sys_info) %} {{ obj | tojson}}"""


## script 使用脚本引擎 https://rhai.rs/book/
## 可选 webhook
# 理论上支持所有支持 webhook 的软件,如 Discord、 Slack、 飞书、 企业版微信(WorkWechat)、 钉钉(DingTalk)等。
# webhook 调用基本上都差不多,差异只在最后返回的 json 结构,根据各自的 api 文档自行构建相应的 json 结构即可。
# script 使用脚本引擎 https://rhai.rs/book/
[webhook]
# 总开关
enabled = false
Expand Down
12 changes: 12 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@ SSR_DEBUG=true
SSR_ADDR=http://127.0.0.1:8080/report
# SSR_USER=h1
SSR_PASS=p1

# group mode
#SSR_GID=
#SSR_ALIAS=
#SSR_LOC=
#SSR_TYPE=

# vnstat
SSR_VNSTAT=true
SSR_VNSTAT_MR=1

SSR_DISABLE_TUPD=false
SSR_DISABLE_PING=false
SSR_DISABLE_EXTRA=false
SSR_DISABLE_NOTIFY=false

#SSR_IFACE=
SSR_EXCLUDE_IFACE=lo,docker,vnet,veth,vmbr,kube,br-

SSR_WEIGHT=0
Expand Down
2 changes: 1 addition & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "stat_server"
version = "1.6.0"
version = "1.6.1"

rust-version = "1.65"

Expand Down

0 comments on commit bbb8a34

Please sign in to comment.