<p align="center">
<a href="https://github.com/zdz/ServerStatus-Rust">
<h1 align="center">✨ Rust 版 ServerStatus 云探针</h1>
</a>
</p>
<div align="center">
<p>
<a href="https://github.com/zdz/ServerStatus-Rust/actions/workflows/release.yml">
<img src="https://github.com/zdz/ServerStatus-Rust/actions/workflows/release.yml/badge.svg" alt="Release"></a>
<a href="https://github.com/zdz/ServerStatus-Rust/issues">
<img src="https://img.shields.io/github/issues/zdz/ServerStatus-Rust"
alt="GitHub issues">
</a>
<a href="https://github.com/zdz/ServerStatus-Rust/discussions">
<img src="https://img.shields.io/github/discussions/zdz/ServerStatus-Rust"
alt="GitHub Discussions">
</a>
<a href="https://github.com/zdz/ServerStatus-Rust/releases">
<img src="https://img.shields.io/github/v/release/zdz/ServerStatus-Rust"
alt="GitHub release (latest SemVer)">
</a>
<a href="https://github.com/zdz/ServerStatus-Rust/releases">
<img src="https://img.shields.io/github/downloads/zdz/ServerStatus-Rust/total" alt="GitHub all releases">
</a>
</p>
</div>
<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>
- [1. 介绍](#1-介绍)
- [🍀 主题](#-主题)
- [2. 安装部署](#2-安装部署)
- [2.1 快速体验](#21-快速体验)
- [2.2 快速部署](#22-快速部署)
- [2.3 服务管理脚本](#23-服务管理脚本)
- [2.4 Railway 部署](#24-railway-部署)
- [2.5 Heroku 部署](#25-heroku-部署)
- [3. 服务端说明](#3-服务端说明)
- [3.1 配置文件 `config.toml`](#31-配置文件-configtoml)
- [3.2 服务端运行](#32-服务端运行)
- [4. 客户端说明](#4-客户端说明)
- [4.1 Rust 版 Client](#41-rust-版-client)
- [4.2 Python 版 Client](#42-python-版-client)
- [5. 开启 `vnstat` 支持](#5-开启-vnstat-支持)
- [6. FAQ](#6-faq)
- [7. 相关项目](#7-相关项目)
- [8. 最后](#8-最后)
## 1. 介绍
`ServerStatus` 威力加强版,保持轻量和简单部署,增加以下主要特性:
- 使用 `rust` 完全重写 `server`、`client`,单个执行文件部署
- 多系统支持 `Linux`、`MacOS`、`Windows`、`Android`、`Raspberry Pi`
- 支持上下线和简单自定义规则告警 (`telegram`、`wechat`、`email`、`webhook`)
- 支持 `http` 协议上报,方便部署到各免费容器服务和配合 `cf` 等优化上报链路
- 支持 `cloudflare tunnels` 和 `mTLS` 部署
- 支持主机分组动态注册,简化配置
- 支持 `vnstat` 统计月流量,重启不丢流量数据
- 支持 `railway` 快速部署
- 支持 `systemd` 开机自启
- 其它功能,如 🗺️ 见 [wiki](https://github.com/zdz/ServerStatus-Rust/wiki)
演示:[ssr.rs](https://ssr.rs) | [cn dns](https://ck.ssr.rs)
|
下载:[Releases](https://github.com/zdz/ServerStatus-Rust/releases)
|
[Changelog](https://github.com/zdz/ServerStatus-Rust/releases)
|
反馈:[Discussions](https://github.com/zdz/ServerStatus-Rust/discussions)
📚 完整文档迁移至 [doc.ssr.rs](https://doc.ssr.rs)
📚 保姆级教程 [Google](https://www.google.com/search?q=%22serverstatus-rust%22)
|
[Bing](https://www.bing.com/search?q=%22serverstatus-rust%22)
### 🍀 主题
如果你觉得你创造/修改的主题还不错,欢迎分享/PR,前端单独部署方法参考 [#37](https://github.com/zdz/ServerStatus-Rust/discussions/37)
<details>
<summary>ServerStatus-theme 主题</summary>
作者 [@JingBh](https://github.com/JingBh)
👉 [主题地址](https://github.com/JingBh/ServerStatus-theme)
支持快速部署一键命令生成
| <img width="1269" alt="image" src="https://github.com/zdz/ServerStatus-Rust/assets/152173/33eb8685-b0ed-4548-92af-8cfdded7d011"> | <img width="596" alt="image" src="https://github.com/zdz/ServerStatus-Rust/assets/152173/15e9c405-6491-4f41-ad0e-68aae96d709c"> |
|-|-|
[演示:Demo](https://status.jingbh.cloud)
</details>
<details>
<summary>ServerStatus-Theme-Light 主题</summary>
👉 [主题地址](https://github.com/orilights/ServerStatus-Theme-Light)
作者 [@orilights](https://github.com/orilights)
<img width="1836" alt="image" src="https://github.com/zdz/ServerStatus-Rust/assets/152173/35fdd138-31b8-46d0-8ea8-c2d4e7ef2b52">
[演示:Demo](https://sstl-demo.orilight.top)
</details>
<details>
<summary>Hotaru 主题</summary>
Hotaru 主题由 [@HinataKato](https://github.com/HinataKato) 修改提供,[主题地址](https://github.com/HinataKato/hotaru_theme_for_RustVersion)
<img width="1202" alt="image" src="https://user-images.githubusercontent.com/152173/167900971-5ef0c23a-af43-4f52-aab5-d58e4a66c8ea.png">
</details>
<details>
<summary>ServerStatus-web 主题</summary>
ServerStatus-web 主题由 [@mjjrock](https://github.com/mjjrock) 修改提供,[主题地址](https://github.com/mjjrock/ServerStatus-web)
<img width="1425" alt="image" src="https://user-images.githubusercontent.com/102237118/171837653-3a5b2cd6-bf02-4602-a132-2c80a6707f68.png">
</details>
<details>
<summary>v1.5.7 版本主题</summary>
[演示:Demo](https://tz-rust.vercel.app)
<img width="1215" alt="image" src="https://user-images.githubusercontent.com/152173/165957689-d35714a9-f7f8-49f7-9573-97d4cf3c2f79.png">
</details>
## 2. 安装部署
### 2.1 快速体验
```bash
# for CentOS/Debian/Ubuntu x86_64
mkdir -p /opt/ServerStatus && cd /opt/ServerStatus
# apt install -y unzip / yum install -y unzip
wget --no-check-certificate -qO one-touch.sh 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/scripts/one-touch.sh'
bash -ex one-touch.sh
# 部署完毕,打开 http://127.0.0.1:8080/ 或 http://<你的IP>:8080/
# 自定义部署可参照 scripts/one-touch.sh 脚本
```
### 2.2 快速部署
👉 [快速部署](https://doc.ssr.rs/rapid_deploy)
### 2.3 服务管理脚本
<details>
<summary>服务管理脚本说明</summary>
由 [@Colsro](https://github.com/Colsro) &
[@Yooona-Lim](https://github.com/Yooona-Lim) 贡献
```bash
# 下载脚本
wget --no-check-certificate -qO status.sh 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/scripts/status.sh'
# 安装 服务端
bash status.sh -i -s
# 安装 客户端
bash status.sh -i -c
# or
bash status.sh -i -c protocol://username:password@master:port
# eg:
bash status.sh -i -c grpc://h1:p1@127.0.0.1:9394
bash status.sh -i -c http://h1:p1@127.0.0.1:8080
# 更多用法:
❯ bash status.sh
help:
-i,--install 安装 Status
-i -s 安装 Server
-i -c 安装 Client
-i -c conf 自动安装 Client
-up,--upgrade 升级 Status
-up -s 升级 Server
-up -c 升级 Client
-up -a 升级 Server和Client
-un,--uninstall 卸载 Status
-un -s 卸载 Server
-un -c 卸载 Client
-un -a 卸载 Server and Client
-rc,--reconfig 更改 Status 配置
-rc 更改 Client 配置
-rc conf 自动更改 Client配置
-s,--server 管理 Status 运行状态
-s {status|start|stop|restart}
-c,--client 管理 Client 运行状态
-c {status|start|stop|restart}
-b,--bakup 备份 Status
-b -s 备份 Server
-b -c 备份 Client
-b -a 备份 Server and Client
-rs,--restore 恢复 Status
-rs -s 恢复 Server
-rs -c 恢复 Client
-rs -a 恢复 Server and Client
-h,--help 查看帮助
若无法访问 Github:
CN=true bash status.sh args
```
</details>
### 2.4 Railway 部署
懒得配置 `Nginx`,`SSL` 证书?试试
[在 Railway 部署 Server](https://github.com/zdz/ServerStatus-Rust/wiki/Railway)
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template/kzT46l?referralCode=pJYbdU)
### 2.5 Heroku 部署
[如何在 Heroku 上部署 Rust 版 ServerStatus 云探针](https://github.com/zdz/ServerStatus-Rust/blob/master/heroku/README.md)
## 3. 服务端说明
### 3.1 配置文件 `config.toml`
```toml
# 侦听地址, ipv6 使用 [::]:9394
grpc_addr = "0.0.0.0:9394"
http_addr = "0.0.0.0:8080"
# 默认30s无上报判定下线
offline_threshold = 30
# 管理员账号,不设置默认随机生成,用于查看 /detail, /map
admin_user = ""
admin_pass = ""
# hosts 跟 hosts_group 两种配置模式任挑一种配置即可
# name 主机唯一标识,不可重复,alias 为展示名
# notify = false 单独禁止单台机器的告警,一般针对网络差,频繁上下线
# monthstart = 1 没启用vnstat时,表示月流量从每月哪天开始统计
# disabled = true 单机禁用
# 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 为主机规格
# os 可用值 centos debian ubuntu alpine pi arch windows linux
hosts = [
{name = "h1", password = "p1", alias = "n1", location = "🏠", type = "kvm", labels = "os=arch;ndd=2022/11/25;spec=2C/4G/60G;"},
{name = "h2", password = "p2", alias = "n2", location = "🏢", type = "kvm", disabled = false},
{name = "h3", password = "p3", alias = "n3", location = "🏡", type = "kvm", monthstart = 1},
{name = "h4", password = "p4", alias = "n4", location = "cn", type = "kvm", notify = true, labels = "ndd=2022/11/25;spec=2C/4G/60G;"},
]
# 动态注册模式,不再需要针对每一个主机做单独配置
# gid 为模板组id, 动态注册唯一标识,不可重复
hosts_group = [
# 可以按国家地区或用途来做分组
{gid = "g1", password = "pp", location = "🏠", type = "kvm", notify = true},
{gid = "g2", password = "pp", location = "🏢", type = "kvm", notify = true},
# 例如不发送通知可以单独做一组
{gid = "silent", password = "pp", location = "🏡", type = "kvm", notify = false},
]
# 动态注册模式下,无效数据清理间隔,默认 30s
group_gc = 30
# 不开启告警,可忽略后面配置,或者删除不需要的通知方式
# 告警间隔默认为30s
notify_interval = 30
# https://core.telegram.org/bots/api
# https://jinja.palletsprojects.com/en/3.0.x/templates/#if
[tgbot]
# 开关 true 打开
enabled = false
bot_token = "<tg bot token>"
chat_id = "<chat id>"
# host 可用字段见 payload.rs 文件 HostStat 结构, {{host.xxx}} 为占位变量
# 例如 host.name 可替换为 host.alias,大家根据自己的喜好来编写通知消息
# {{ip_info.query}} 主机 ip, {{sys_info.host_name}} 主机 hostname
title = "❗<b>Server Status</b>"
online_tpl = "{{config.title}} \n😆 {{host.location}} {{host.name}} 主机恢复上线啦"
offline_tpl = "{{config.title}} \n😱 {{host.location}} {{host.name}} 主机已经掉线啦"
# custom 模板置空则停用自定义告警,只保留上下线通知
custom_tpl = """
{% if host.memory_used / host.memory_total > 0.5 %}
<pre>😲 {{host.name}} 主机内存使用率超50%, 当前{{ (100 * host.memory_used / host.memory_total) | round }}% </pre>
{% endif %}
{% if host.hdd_used / host.hdd_total > 0.5 %}
<pre>😲 {{host.name}} 主机硬盘使用率超50%, 当前{{ (100 * host.hdd_used / host.hdd_total) | round }}% </pre>
{% endif %}
"""
# wechat, email, webhook 等其它通知方式 配置详细见 config.toml
```
### 3.2 服务端运行
```bash
# systemd 方式, 参照 scripts/one-touch.sh 脚本 (推荐)
# 💪 手动方式
# help
./stat_server -h
# 手动运行
./stat_server -c config.toml
# 或
RUST_BACKTRACE=1 RUST_LOG=trace ./stat_server -c config.toml
# 测试配置文件是否有效
./stat_server -c config.toml -t
# 根据配置发送测试消息,验证通知是否生效
./stat_server -c config.toml --notify-test
# 🐳 docker 方式
wget --no-check-certificate -qO docker-compose.yml 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/docker-compose.yml'
wget --no-check-certificate -qO config.toml 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/config.toml'
touch stats.json
docker-compose up -d
```
## 4. 客户端说明
<details>
<summary>系统版本&架构</summary>
| OS | Release |
| ---- | ---- |
| Linux x86_64 | x86_64-unknown-linux-musl |
| Linux arm64 | aarch64-unknown-linux-musl |
| MacOS x86_64 | x86_64-apple-darwin |
| MacOS arm64 | aarch64-apple-darwin |
| Windows x86_64 | x86_64-pc-windows-msvc |
| Raspberry Pi | armv7-unknown-linux-musleabihf |
| Android 64bit | aarch64-linux-android |
| Android 32bit | armv7-linux-androideabi |
</details>
### 4.1 Rust 版 Client
```bash
# 公网环境建议 headscale/nebula 组网或走 https, 使用 nginx 对 server 套 ssl 和自定义 location /report
# alpine linux 需要安装相关命令 apk add procps iproute2 coreutils
# 如果 Rust 版客户端在你的系统无法使用,请切换到下面 4.2 Python 跨平台版本
# systemd 方式, 参照 scripts/one-touch.sh 脚本 (推荐)
# 💪 手动方式
# Rust 版本 Client
./stat_client -h
./stat_client -a "http://127.0.0.1:8080/report" -u h1 -p p1
# 或
./stat_client -a "grpc://127.0.0.1:9394" -u h1 -p p1
# 不同的主机可以运行相同的命令注册到同一组
./stat_client -a "http://127.0.0.1:8080/report" -g g1 -p pp --alias "$(hostname)"
# rust client 可用参数
./stat_client -h
OPTIONS:
-6, --ipv6 ipv6 only, default:false
-a, --addr <ADDR> [default: http://127.0.0.1:8080/report]
--alias <ALIAS> alias for host [default: unknown]
--cm <CM_ADDR> China Mobile probe addr [default: cm.tz.cloudcpp.com:80]
--ct <CT_ADDR> China Telecom probe addr [default: ct.tz.cloudcpp.com:80]
--cu <CU_ADDR> China Unicom probe addr [default: cu.tz.cloudcpp.com:80]
--disable-extra disable extra info report, default:false
--disable-notify disable notify, default:false
--disable-ping disable ping, default:false
--disable-tupd disable t/u/p/d, default:false
-g, --gid <GID> group id [default: ]
-h, --help Print help information
--ip-info show ip info, default:false
--ip-source <IP_SOURCE> ip info source [env: SSR_IP_SOURCE=] [default: ip-api.com]
--sys-info show sys info, default:false
--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]
-V, --version Print version information
-w, --weight <WEIGHT> weight for rank [default: 0]
# 一些参数说明
--ip-info # 显示本机ip信息后立即退出,目前使用 ip-api.com 数据
--ip-source # 指定 ip 信息源,ip-api.com / ip.sb / ipapi.co / myip.la
--sys-info # 显示本机系统信息后立即退出
--disable-extra # 不上报系统信息和IP信息
--disable-ping # 停用三网延时和丢包率探测
--disable-tupd # 不上报 tcp/udp/进程数/线程数,减少CPU占用
-w, --weight # 排序加分,微调让主机靠前显示,无强迫症可忽略
-g, --gid # 动态注册的组id
--alias # 动态注册模式下,指定主机的展示名字
# 总流量,网卡流量/网速统计
-i, --iface # 非空时,只统计指定网口
-e, --exclude-iface # 排除指定网口,默认排除 "lo,docker,vnet,veth,vmbr,kube,br-"
```
### 4.2 Python 版 Client
<details>
<summary> Python 版 Client 说明</summary>
```bash
# Python 版本 Client 依赖安装
## Centos
yum -y install epel-release
yum -y install python3-pip gcc python3-devel
python3 -m pip install psutil requests py-cpuinfo
## Ubuntu/Debian
apt -y install python3-pip
python3 -m pip install psutil requests py-cpuinfo
## Alpine linux
apk add wget python3 py3-pip gcc python3-dev musl-dev linux-headers
apk add procps iproute2 coreutils
python3 -m pip install psutil requests py-cpuinfo
wget --no-check-certificate -qO stat_client.py 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/client/stat_client.py'
## Windows
# 安装 python 3.10 版本,并设置环境变量
# 命令行执行 pip install psutil requests
# 下载 https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/client/stat_client.py
pip install psutil requests py-cpuinfo
python3 stat_client.py -h
python3 stat_client.py -a "http://127.0.0.1:8080/report" -u h1 -p p1
```
</details>
## 5. 开启 `vnstat` 支持
[vnstat](https://zh.wikipedia.org/wiki/VnStat) 是Linux下一个流量统计工具,开启 `vnstat` 后,`server` 完全依赖客户机的 `vnstat` 数据来显示月流量和总流量,优点是重启不丢流量数据。
<details>
<summary>开启 vnstat 设置</summary>
```bash
# 在client端安装 vnstat
## Centos
sudo yum install epel-release -y
sudo yum install -y vnstat
## Ubuntu/Debian
sudo apt install -y vnstat
# 修改 /etc/vnstat.conf
# BandwidthDetection 0
# MaxBandwidth 0
# 默认不是 eth0 网口的需要置空 Interface 来自动选择网口
# 没报错一般不需要改
# Interface ""
systemctl restart vnstat
# 确保 version >= 2.6
vnstat --version
# 测试查看月流量 (刚安装可能需等一小段时间来采集数据)
vnstat -m
vnstat --json m
# client 使用 -n 参数开启 vnstat 统计
./stat_client -a "grpc://127.0.0.1:9394" -u h1 -p p1 -n
# 或
python3 stat_client.py -a "http://127.0.0.1:8080/report" -u h1 -p p1 -n
```
</details>
## 6. FAQ
<details>
<summary>如何使用自定义主题</summary>
更简单的方式 👉 [#37](https://github.com/zdz/ServerStatus-Rust/discussions/37)
```nginx
server {
# ssl, domain 等其它 nginx 配置
# 反代 /report 请求
location = /report {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_pass http://127.0.0.1:8080/report;
}
# 反代 json 数据请求
location = /json/stats.json {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_pass http://127.0.0.1:8080/json/stats.json;
}
# v1.4.0后,同样需要反代 /detail, /map
# 其它 html,js,css 等,走本地文本
location / {
root /opt/ServerStatus/web; # 你自己修改的主题目录
index index.html index.htm;
}
}
```
</details>
<details>
<summary>如何源码编译</summary>
```bash
#
cargo install stat_server
cargo install stat_client
# or
# 按提示安装 rust 编译器
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
yum install -y openssl-devel
git clone https://github.com/zdz/ServerStatus-Rust.git
cd ServerStatus-Rust
cargo build --release
# 编译好的文件目录 target/release
```
</details>
<details>
<summary>如何自定义 ping 地址</summary>
```bash
# 例如自定义移动探测地址,用 --cm 指定地址
./stat_client -a "grpc://127.0.0.1:9394" -u h1 -p p1 --cm=cm.tz.cloudcpp.com:80
# 电信联通参数可以使用 -h 命令查看
./stat_client -h
OPTIONS:
--cm <CM_ADDR> China Mobile probe addr [default: cm.tz.cloudcpp.com:80]
--ct <CT_ADDR> China Telecom probe addr [default: ct.tz.cloudcpp.com:80]
--cu <CU_ADDR> China Unicom probe addr [default: cu.tz.cloudcpp.com:80]
```
</details>
<details>
<summary>关于这个轮子</summary>
之前一直在使用 `Prometheus` + `Grafana` + `Alertmanager` + `node_exporter` 做VPS监控,这也是业界比较成熟的监控方案,用过一段时间后,发现非生产环境,很多监控指标都用不上,运维成本有点大。
而 `ServerStatus` 很好,足够简单和轻量,一眼可以看尽所有小机机,只是 `c++` 版本很久没迭代过,自己的一些需求在原版上不是很好修改,如自带 `tcp` 上报对跨区机器不是很友好,也不方便对上报的链路做优化 等等。这是学习 `Rust` 练手的小项目,所以不会增加复杂功能,保持小而美,简单部署,配合 [Uptime Kuma](https://github.com/louislam/uptime-kuma) 基本上可以满足个人大部分监控需求。
</details>
## 7. 相关项目
- https://github.com/BotoX/ServerStatus
- https://github.com/cppla/ServerStatus
- https://github.com/mojeda/ServerStatus
- https://github.com/cokemine/ServerStatus-Hotaru
- https://github.com/ToyoDAdoubiBackup/ServerStatus-Toyo
## 8. 最后
很高兴我的代码能跑在你的服务器上,如果对你有帮助的话,欢迎留下你的 star ⭐ 支持一下
Raw data
{
"_id": null,
"home_page": "https://github.com/zdz/ServerStatus-Rust",
"name": "stat-client",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "stat_client,serverstatus,monitor",
"author": "doge <doge.py@gmail.com>",
"author_email": "doge <doge.py@gmail.com>",
"download_url": "",
"platform": null,
"description": "<p align=\"center\">\n <a href=\"https://github.com/zdz/ServerStatus-Rust\">\n <h1 align=\"center\">\u2728 Rust \u7248 ServerStatus \u4e91\u63a2\u9488</h1>\n </a>\n</p>\n\n<div align=\"center\">\n <p>\n <a href=\"https://github.com/zdz/ServerStatus-Rust/actions/workflows/release.yml\">\n <img src=\"https://github.com/zdz/ServerStatus-Rust/actions/workflows/release.yml/badge.svg\" alt=\"Release\"></a>\n <a href=\"https://github.com/zdz/ServerStatus-Rust/issues\">\n <img src=\"https://img.shields.io/github/issues/zdz/ServerStatus-Rust\"\n alt=\"GitHub issues\">\n </a>\n <a href=\"https://github.com/zdz/ServerStatus-Rust/discussions\">\n <img src=\"https://img.shields.io/github/discussions/zdz/ServerStatus-Rust\"\n alt=\"GitHub Discussions\">\n </a>\n <a href=\"https://github.com/zdz/ServerStatus-Rust/releases\">\n <img src=\"https://img.shields.io/github/v/release/zdz/ServerStatus-Rust\"\n alt=\"GitHub release (latest SemVer)\">\n </a>\n <a href=\"https://github.com/zdz/ServerStatus-Rust/releases\">\n <img src=\"https://img.shields.io/github/downloads/zdz/ServerStatus-Rust/total\" alt=\"GitHub all releases\">\n </a>\n </p>\n</div>\n\n<img width=\"1317\" alt=\"image\" src=\"https://user-images.githubusercontent.com/152173/206825541-6eaeb856-0c03-479a-b07e-006b60b41c02.png\">\n<img width=\"1436\" alt=\"image\" src=\"https://user-images.githubusercontent.com/152173/165958225-25fc8fda-5798-42f8-bac5-72d778c0bab5.png\">\n\n\n\n<h2>Table of Contents</h2>\n\n- [1. \u4ecb\u7ecd](#1-\u4ecb\u7ecd)\n - [\ud83c\udf40 \u4e3b\u9898](#-\u4e3b\u9898)\n- [2. \u5b89\u88c5\u90e8\u7f72](#2-\u5b89\u88c5\u90e8\u7f72)\n - [2.1 \u5feb\u901f\u4f53\u9a8c](#21-\u5feb\u901f\u4f53\u9a8c)\n - [2.2 \u5feb\u901f\u90e8\u7f72](#22-\u5feb\u901f\u90e8\u7f72)\n - [2.3 \u670d\u52a1\u7ba1\u7406\u811a\u672c](#23-\u670d\u52a1\u7ba1\u7406\u811a\u672c)\n - [2.4 Railway \u90e8\u7f72](#24-railway-\u90e8\u7f72)\n - [2.5 Heroku \u90e8\u7f72](#25-heroku-\u90e8\u7f72)\n- [3. \u670d\u52a1\u7aef\u8bf4\u660e](#3-\u670d\u52a1\u7aef\u8bf4\u660e)\n - [3.1 \u914d\u7f6e\u6587\u4ef6 `config.toml`](#31-\u914d\u7f6e\u6587\u4ef6-configtoml)\n - [3.2 \u670d\u52a1\u7aef\u8fd0\u884c](#32-\u670d\u52a1\u7aef\u8fd0\u884c)\n- [4. \u5ba2\u6237\u7aef\u8bf4\u660e](#4-\u5ba2\u6237\u7aef\u8bf4\u660e)\n - [4.1 Rust \u7248 Client](#41-rust-\u7248-client)\n - [4.2 Python \u7248 Client](#42-python-\u7248-client)\n- [5. \u5f00\u542f `vnstat` \u652f\u6301](#5-\u5f00\u542f-vnstat-\u652f\u6301)\n- [6. FAQ](#6-faq)\n- [7. \u76f8\u5173\u9879\u76ee](#7-\u76f8\u5173\u9879\u76ee)\n- [8. \u6700\u540e](#8-\u6700\u540e)\n\n## 1. \u4ecb\u7ecd\n `ServerStatus` \u5a01\u529b\u52a0\u5f3a\u7248\uff0c\u4fdd\u6301\u8f7b\u91cf\u548c\u7b80\u5355\u90e8\u7f72\uff0c\u589e\u52a0\u4ee5\u4e0b\u4e3b\u8981\u7279\u6027\uff1a\n\n- \u4f7f\u7528 `rust` \u5b8c\u5168\u91cd\u5199 `server`\u3001`client`\uff0c\u5355\u4e2a\u6267\u884c\u6587\u4ef6\u90e8\u7f72\n- \u591a\u7cfb\u7edf\u652f\u6301 `Linux`\u3001`MacOS`\u3001`Windows`\u3001`Android`\u3001`Raspberry Pi`\n- \u652f\u6301\u4e0a\u4e0b\u7ebf\u548c\u7b80\u5355\u81ea\u5b9a\u4e49\u89c4\u5219\u544a\u8b66 (`telegram`\u3001`wechat`\u3001`email`\u3001`webhook`)\n- \u652f\u6301 `http` \u534f\u8bae\u4e0a\u62a5\uff0c\u65b9\u4fbf\u90e8\u7f72\u5230\u5404\u514d\u8d39\u5bb9\u5668\u670d\u52a1\u548c\u914d\u5408 `cf` \u7b49\u4f18\u5316\u4e0a\u62a5\u94fe\u8def\n- \u652f\u6301 `cloudflare tunnels` \u548c `mTLS` \u90e8\u7f72\n- \u652f\u6301\u4e3b\u673a\u5206\u7ec4\u52a8\u6001\u6ce8\u518c\uff0c\u7b80\u5316\u914d\u7f6e\n- \u652f\u6301 `vnstat` \u7edf\u8ba1\u6708\u6d41\u91cf\uff0c\u91cd\u542f\u4e0d\u4e22\u6d41\u91cf\u6570\u636e\n- \u652f\u6301 `railway` \u5feb\u901f\u90e8\u7f72\n- \u652f\u6301 `systemd` \u5f00\u673a\u81ea\u542f\n- \u5176\u5b83\u529f\u80fd\uff0c\u5982 \ud83d\uddfa\ufe0f \u89c1 [wiki](https://github.com/zdz/ServerStatus-Rust/wiki)\n\n\u6f14\u793a\uff1a[ssr.rs](https://ssr.rs) | [cn dns](https://ck.ssr.rs)\n|\n\u4e0b\u8f7d\uff1a[Releases](https://github.com/zdz/ServerStatus-Rust/releases)\n|\n[Changelog](https://github.com/zdz/ServerStatus-Rust/releases)\n|\n\u53cd\u9988\uff1a[Discussions](https://github.com/zdz/ServerStatus-Rust/discussions)\n\n\ud83d\udcda \u5b8c\u6574\u6587\u6863\u8fc1\u79fb\u81f3 [doc.ssr.rs](https://doc.ssr.rs)\n\n\ud83d\udcda \u4fdd\u59c6\u7ea7\u6559\u7a0b [Google](https://www.google.com/search?q=%22serverstatus-rust%22)\n|\n[Bing](https://www.bing.com/search?q=%22serverstatus-rust%22)\n\n### \ud83c\udf40 \u4e3b\u9898\n\n\u5982\u679c\u4f60\u89c9\u5f97\u4f60\u521b\u9020/\u4fee\u6539\u7684\u4e3b\u9898\u8fd8\u4e0d\u9519\uff0c\u6b22\u8fce\u5206\u4eab/PR\uff0c\u524d\u7aef\u5355\u72ec\u90e8\u7f72\u65b9\u6cd5\u53c2\u8003 [#37](https://github.com/zdz/ServerStatus-Rust/discussions/37)\n\n<details>\n <summary>ServerStatus-theme \u4e3b\u9898</summary>\n\n\u4f5c\u8005 [@JingBh](https://github.com/JingBh)\n\ud83d\udc49 [\u4e3b\u9898\u5730\u5740](https://github.com/JingBh/ServerStatus-theme)\n\u652f\u6301\u5feb\u901f\u90e8\u7f72\u4e00\u952e\u547d\u4ee4\u751f\u6210\n\n| <img width=\"1269\" alt=\"image\" src=\"https://github.com/zdz/ServerStatus-Rust/assets/152173/33eb8685-b0ed-4548-92af-8cfdded7d011\"> | <img width=\"596\" alt=\"image\" src=\"https://github.com/zdz/ServerStatus-Rust/assets/152173/15e9c405-6491-4f41-ad0e-68aae96d709c\"> |\n|-|-|\n\n[\u6f14\u793a\uff1aDemo](https://status.jingbh.cloud)\n\n</details>\n\n<details>\n <summary>ServerStatus-Theme-Light \u4e3b\u9898</summary>\n\n\ud83d\udc49 [\u4e3b\u9898\u5730\u5740](https://github.com/orilights/ServerStatus-Theme-Light)\n\u4f5c\u8005 [@orilights](https://github.com/orilights)\n\n<img width=\"1836\" alt=\"image\" src=\"https://github.com/zdz/ServerStatus-Rust/assets/152173/35fdd138-31b8-46d0-8ea8-c2d4e7ef2b52\">\n\n[\u6f14\u793a\uff1aDemo](https://sstl-demo.orilight.top)\n\n</details>\n\n<details>\n <summary>Hotaru \u4e3b\u9898</summary>\n\nHotaru \u4e3b\u9898\u7531 [@HinataKato](https://github.com/HinataKato) \u4fee\u6539\u63d0\u4f9b\uff0c[\u4e3b\u9898\u5730\u5740](https://github.com/HinataKato/hotaru_theme_for_RustVersion)\n\n<img width=\"1202\" alt=\"image\" src=\"https://user-images.githubusercontent.com/152173/167900971-5ef0c23a-af43-4f52-aab5-d58e4a66c8ea.png\">\n\n</details>\n\n<details>\n <summary>ServerStatus-web \u4e3b\u9898</summary>\n\nServerStatus-web \u4e3b\u9898\u7531 [@mjjrock](https://github.com/mjjrock) \u4fee\u6539\u63d0\u4f9b\uff0c[\u4e3b\u9898\u5730\u5740](https://github.com/mjjrock/ServerStatus-web)\n\n<img width=\"1425\" alt=\"image\" src=\"https://user-images.githubusercontent.com/102237118/171837653-3a5b2cd6-bf02-4602-a132-2c80a6707f68.png\">\n\n</details>\n\n\n<details>\n <summary>v1.5.7 \u7248\u672c\u4e3b\u9898</summary>\n\n[\u6f14\u793a\uff1aDemo](https://tz-rust.vercel.app)\n\n<img width=\"1215\" alt=\"image\" src=\"https://user-images.githubusercontent.com/152173/165957689-d35714a9-f7f8-49f7-9573-97d4cf3c2f79.png\">\n</details>\n\n## 2. \u5b89\u88c5\u90e8\u7f72\n\n### 2.1 \u5feb\u901f\u4f53\u9a8c\n```bash\n# for CentOS/Debian/Ubuntu x86_64\nmkdir -p /opt/ServerStatus && cd /opt/ServerStatus\n# apt install -y unzip / yum install -y unzip\nwget --no-check-certificate -qO one-touch.sh 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/scripts/one-touch.sh'\nbash -ex one-touch.sh\n# \u90e8\u7f72\u5b8c\u6bd5\uff0c\u6253\u5f00 http://127.0.0.1:8080/ \u6216 http://<\u4f60\u7684IP>:8080/\n# \u81ea\u5b9a\u4e49\u90e8\u7f72\u53ef\u53c2\u7167 scripts/one-touch.sh \u811a\u672c\n```\n\n### 2.2 \u5feb\u901f\u90e8\u7f72\n\n\ud83d\udc49 [\u5feb\u901f\u90e8\u7f72](https://doc.ssr.rs/rapid_deploy)\n\n### 2.3 \u670d\u52a1\u7ba1\u7406\u811a\u672c\n\n<details>\n <summary>\u670d\u52a1\u7ba1\u7406\u811a\u672c\u8bf4\u660e</summary>\n\n\u7531 [@Colsro](https://github.com/Colsro) &\n[@Yooona-Lim](https://github.com/Yooona-Lim) \u8d21\u732e\n\n```bash\n# \u4e0b\u8f7d\u811a\u672c\nwget --no-check-certificate -qO status.sh 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/scripts/status.sh'\n\n# \u5b89\u88c5 \u670d\u52a1\u7aef\nbash status.sh -i -s\n\n# \u5b89\u88c5 \u5ba2\u6237\u7aef\nbash status.sh -i -c\n# or\nbash status.sh -i -c protocol://username:password@master:port\n# eg:\nbash status.sh -i -c grpc://h1:p1@127.0.0.1:9394\nbash status.sh -i -c http://h1:p1@127.0.0.1:8080\n\n# \u66f4\u591a\u7528\u6cd5\uff1a\n\u276f bash status.sh\n\nhelp:\n -i,--install \u5b89\u88c5 Status\n -i -s \u5b89\u88c5 Server\n -i -c \u5b89\u88c5 Client\n -i -c conf \u81ea\u52a8\u5b89\u88c5 Client\n -up,--upgrade \u5347\u7ea7 Status\n -up -s \u5347\u7ea7 Server\n -up -c \u5347\u7ea7 Client\n -up -a \u5347\u7ea7 Server\u548cClient\n -un,--uninstall \u5378\u8f7d Status\n -un -s \u5378\u8f7d Server\n -un -c \u5378\u8f7d Client\n -un -a \u5378\u8f7d Server and Client\n -rc,--reconfig \u66f4\u6539 Status \u914d\u7f6e\n -rc \u66f4\u6539 Client \u914d\u7f6e\n -rc conf \u81ea\u52a8\u66f4\u6539 Client\u914d\u7f6e\n -s,--server \u7ba1\u7406 Status \u8fd0\u884c\u72b6\u6001\n -s {status|start|stop|restart}\n -c,--client \u7ba1\u7406 Client \u8fd0\u884c\u72b6\u6001\n -c {status|start|stop|restart}\n -b,--bakup \u5907\u4efd Status\n -b -s \u5907\u4efd Server\n -b -c \u5907\u4efd Client\n -b -a \u5907\u4efd Server and Client\n -rs,--restore \u6062\u590d Status\n -rs -s \u6062\u590d Server\n -rs -c \u6062\u590d Client\n -rs -a \u6062\u590d Server and Client\n -h,--help \u67e5\u770b\u5e2e\u52a9\n\u82e5\u65e0\u6cd5\u8bbf\u95ee Github:\n CN=true bash status.sh args\n```\n\n</details>\n\n### 2.4 Railway \u90e8\u7f72\n\n\u61d2\u5f97\u914d\u7f6e `Nginx`\uff0c`SSL` \u8bc1\u4e66\uff1f\u8bd5\u8bd5\n[\u5728 Railway \u90e8\u7f72 Server](https://github.com/zdz/ServerStatus-Rust/wiki/Railway)\n\n[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template/kzT46l?referralCode=pJYbdU)\n\n### 2.5 Heroku \u90e8\u7f72\n\n[\u5982\u4f55\u5728 Heroku \u4e0a\u90e8\u7f72 Rust \u7248 ServerStatus \u4e91\u63a2\u9488](https://github.com/zdz/ServerStatus-Rust/blob/master/heroku/README.md)\n\n## 3. \u670d\u52a1\u7aef\u8bf4\u660e\n\n### 3.1 \u914d\u7f6e\u6587\u4ef6 `config.toml`\n```toml\n# \u4fa6\u542c\u5730\u5740, ipv6 \u4f7f\u7528 [::]:9394\ngrpc_addr = \"0.0.0.0:9394\"\nhttp_addr = \"0.0.0.0:8080\"\n# \u9ed8\u8ba430s\u65e0\u4e0a\u62a5\u5224\u5b9a\u4e0b\u7ebf\noffline_threshold = 30\n\n# \u7ba1\u7406\u5458\u8d26\u53f7,\u4e0d\u8bbe\u7f6e\u9ed8\u8ba4\u968f\u673a\u751f\u6210\uff0c\u7528\u4e8e\u67e5\u770b /detail, /map\nadmin_user = \"\"\nadmin_pass = \"\"\n\n# hosts \u8ddf hosts_group \u4e24\u79cd\u914d\u7f6e\u6a21\u5f0f\u4efb\u6311\u4e00\u79cd\u914d\u7f6e\u5373\u53ef\n# name \u4e3b\u673a\u552f\u4e00\u6807\u8bc6\uff0c\u4e0d\u53ef\u91cd\u590d\uff0calias \u4e3a\u5c55\u793a\u540d\n# notify = false \u5355\u72ec\u7981\u6b62\u5355\u53f0\u673a\u5668\u7684\u544a\u8b66\uff0c\u4e00\u822c\u9488\u5bf9\u7f51\u7edc\u5dee\uff0c\u9891\u7e41\u4e0a\u4e0b\u7ebf\n# monthstart = 1 \u6ca1\u542f\u7528vnstat\u65f6\uff0c\u8868\u793a\u6708\u6d41\u91cf\u4ece\u6bcf\u6708\u54ea\u5929\u5f00\u59cb\u7edf\u8ba1\n# disabled = true \u5355\u673a\u7981\u7528\n# location \u652f\u6301\u56fd\u65d7 emoji https://emojixd.com/group/flags\n# \u6216\u56fd\u5bb6\u7f29\u5199\uff0c\u5982 cn us \u7b49\u7b49\uff0c\u6240\u6709\u56fd\u5bb6\u89c1\u76ee\u5f55 web/static/flags\n# \u81ea\u5b9a\u4e49\u6807\u7b7e labels = \"os=centos;ndd=2022/11/25;spec=2C/4G/60G;\"\n# os \u6807\u7b7e\u53ef\u9009\uff0c\u4e0d\u586b\u5219\u4f7f\u7528\u4e0a\u62a5\u6570\u636e\uff0cndd(next due date) \u4e0b\u6b21\u7eed\u8d39\u65f6\u95f4, spec \u4e3a\u4e3b\u673a\u89c4\u683c\n# os \u53ef\u7528\u503c centos debian ubuntu alpine pi arch windows linux\nhosts = [\n {name = \"h1\", password = \"p1\", alias = \"n1\", location = \"\ud83c\udfe0\", type = \"kvm\", labels = \"os=arch;ndd=2022/11/25;spec=2C/4G/60G;\"},\n {name = \"h2\", password = \"p2\", alias = \"n2\", location = \"\ud83c\udfe2\", type = \"kvm\", disabled = false},\n {name = \"h3\", password = \"p3\", alias = \"n3\", location = \"\ud83c\udfe1\", type = \"kvm\", monthstart = 1},\n {name = \"h4\", password = \"p4\", alias = \"n4\", location = \"cn\", type = \"kvm\", notify = true, labels = \"ndd=2022/11/25;spec=2C/4G/60G;\"},\n]\n\n# \u52a8\u6001\u6ce8\u518c\u6a21\u5f0f\uff0c\u4e0d\u518d\u9700\u8981\u9488\u5bf9\u6bcf\u4e00\u4e2a\u4e3b\u673a\u505a\u5355\u72ec\u914d\u7f6e\n# gid \u4e3a\u6a21\u677f\u7ec4id, \u52a8\u6001\u6ce8\u518c\u552f\u4e00\u6807\u8bc6\uff0c\u4e0d\u53ef\u91cd\u590d\nhosts_group = [\n # \u53ef\u4ee5\u6309\u56fd\u5bb6\u5730\u533a\u6216\u7528\u9014\u6765\u505a\u5206\u7ec4\n {gid = \"g1\", password = \"pp\", location = \"\ud83c\udfe0\", type = \"kvm\", notify = true},\n {gid = \"g2\", password = \"pp\", location = \"\ud83c\udfe2\", type = \"kvm\", notify = true},\n # \u4f8b\u5982\u4e0d\u53d1\u9001\u901a\u77e5\u53ef\u4ee5\u5355\u72ec\u505a\u4e00\u7ec4\n {gid = \"silent\", password = \"pp\", location = \"\ud83c\udfe1\", type = \"kvm\", notify = false},\n]\n# \u52a8\u6001\u6ce8\u518c\u6a21\u5f0f\u4e0b\uff0c\u65e0\u6548\u6570\u636e\u6e05\u7406\u95f4\u9694\uff0c\u9ed8\u8ba4 30s\ngroup_gc = 30\n\n# \u4e0d\u5f00\u542f\u544a\u8b66\uff0c\u53ef\u5ffd\u7565\u540e\u9762\u914d\u7f6e\uff0c\u6216\u8005\u5220\u9664\u4e0d\u9700\u8981\u7684\u901a\u77e5\u65b9\u5f0f\n# \u544a\u8b66\u95f4\u9694\u9ed8\u8ba4\u4e3a30s\nnotify_interval = 30\n# https://core.telegram.org/bots/api\n# https://jinja.palletsprojects.com/en/3.0.x/templates/#if\n[tgbot]\n# \u5f00\u5173 true \u6253\u5f00\nenabled = false\nbot_token = \"<tg bot token>\"\nchat_id = \"<chat id>\"\n# host \u53ef\u7528\u5b57\u6bb5\u89c1 payload.rs \u6587\u4ef6 HostStat \u7ed3\u6784, {{host.xxx}} \u4e3a\u5360\u4f4d\u53d8\u91cf\n# \u4f8b\u5982 host.name \u53ef\u66ff\u6362\u4e3a host.alias\uff0c\u5927\u5bb6\u6839\u636e\u81ea\u5df1\u7684\u559c\u597d\u6765\u7f16\u5199\u901a\u77e5\u6d88\u606f\n# {{ip_info.query}} \u4e3b\u673a ip, {{sys_info.host_name}} \u4e3b\u673a hostname\ntitle = \"\u2757<b>Server Status</b>\"\nonline_tpl = \"{{config.title}} \\n\ud83d\ude06 {{host.location}} {{host.name}} \u4e3b\u673a\u6062\u590d\u4e0a\u7ebf\u5566\"\noffline_tpl = \"{{config.title}} \\n\ud83d\ude31 {{host.location}} {{host.name}} \u4e3b\u673a\u5df2\u7ecf\u6389\u7ebf\u5566\"\n# custom \u6a21\u677f\u7f6e\u7a7a\u5219\u505c\u7528\u81ea\u5b9a\u4e49\u544a\u8b66\uff0c\u53ea\u4fdd\u7559\u4e0a\u4e0b\u7ebf\u901a\u77e5\ncustom_tpl = \"\"\"\n{% if host.memory_used / host.memory_total > 0.5 %}\n<pre>\ud83d\ude32 {{host.name}} \u4e3b\u673a\u5185\u5b58\u4f7f\u7528\u7387\u8d8550%, \u5f53\u524d{{ (100 * host.memory_used / host.memory_total) | round }}% </pre>\n{% endif %}\n\n{% if host.hdd_used / host.hdd_total > 0.5 %}\n<pre>\ud83d\ude32 {{host.name}} \u4e3b\u673a\u786c\u76d8\u4f7f\u7528\u7387\u8d8550%, \u5f53\u524d{{ (100 * host.hdd_used / host.hdd_total) | round }}% </pre>\n{% endif %}\n\"\"\"\n\n# wechat, email, webhook \u7b49\u5176\u5b83\u901a\u77e5\u65b9\u5f0f \u914d\u7f6e\u8be6\u7ec6\u89c1 config.toml\n```\n\n### 3.2 \u670d\u52a1\u7aef\u8fd0\u884c\n```bash\n# systemd \u65b9\u5f0f\uff0c \u53c2\u7167 scripts/one-touch.sh \u811a\u672c (\u63a8\u8350)\n\n# \ud83d\udcaa \u624b\u52a8\u65b9\u5f0f\n# help\n./stat_server -h\n# \u624b\u52a8\u8fd0\u884c\n./stat_server -c config.toml\n# \u6216\nRUST_BACKTRACE=1 RUST_LOG=trace ./stat_server -c config.toml\n\n# \u6d4b\u8bd5\u914d\u7f6e\u6587\u4ef6\u662f\u5426\u6709\u6548\n./stat_server -c config.toml -t\n# \u6839\u636e\u914d\u7f6e\u53d1\u9001\u6d4b\u8bd5\u6d88\u606f\uff0c\u9a8c\u8bc1\u901a\u77e5\u662f\u5426\u751f\u6548\n./stat_server -c config.toml --notify-test\n\n# \ud83d\udc33 docker \u65b9\u5f0f\nwget --no-check-certificate -qO docker-compose.yml 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/docker-compose.yml'\nwget --no-check-certificate -qO config.toml 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/config.toml'\ntouch stats.json\ndocker-compose up -d\n```\n\n## 4. \u5ba2\u6237\u7aef\u8bf4\u660e\n\n<details>\n <summary>\u7cfb\u7edf\u7248\u672c&\u67b6\u6784</summary>\n\n| OS | Release |\n| ---- | ---- |\n| Linux x86_64 | x86_64-unknown-linux-musl |\n| Linux arm64 | aarch64-unknown-linux-musl |\n| MacOS x86_64 | x86_64-apple-darwin |\n| MacOS arm64 | aarch64-apple-darwin |\n| Windows x86_64 | x86_64-pc-windows-msvc |\n| Raspberry Pi | armv7-unknown-linux-musleabihf |\n| Android 64bit | aarch64-linux-android |\n| Android 32bit | armv7-linux-androideabi |\n\n</details>\n\n### 4.1 Rust \u7248 Client\n```bash\n# \u516c\u7f51\u73af\u5883\u5efa\u8bae headscale/nebula \u7ec4\u7f51\u6216\u8d70 https, \u4f7f\u7528 nginx \u5bf9 server \u5957 ssl \u548c\u81ea\u5b9a\u4e49 location /report\n# alpine linux \u9700\u8981\u5b89\u88c5\u76f8\u5173\u547d\u4ee4 apk add procps iproute2 coreutils\n# \u5982\u679c Rust \u7248\u5ba2\u6237\u7aef\u5728\u4f60\u7684\u7cfb\u7edf\u65e0\u6cd5\u4f7f\u7528\uff0c\u8bf7\u5207\u6362\u5230\u4e0b\u9762 4.2 Python \u8de8\u5e73\u53f0\u7248\u672c\n\n# systemd \u65b9\u5f0f\uff0c \u53c2\u7167 scripts/one-touch.sh \u811a\u672c (\u63a8\u8350)\n\n# \ud83d\udcaa \u624b\u52a8\u65b9\u5f0f\n# Rust \u7248\u672c Client\n./stat_client -h\n./stat_client -a \"http://127.0.0.1:8080/report\" -u h1 -p p1\n# \u6216\n./stat_client -a \"grpc://127.0.0.1:9394\" -u h1 -p p1\n# \u4e0d\u540c\u7684\u4e3b\u673a\u53ef\u4ee5\u8fd0\u884c\u76f8\u540c\u7684\u547d\u4ee4\u6ce8\u518c\u5230\u540c\u4e00\u7ec4\n./stat_client -a \"http://127.0.0.1:8080/report\" -g g1 -p pp --alias \"$(hostname)\"\n\n# rust client \u53ef\u7528\u53c2\u6570\n./stat_client -h\nOPTIONS:\n -6, --ipv6 ipv6 only, default:false\n -a, --addr <ADDR> [default: http://127.0.0.1:8080/report]\n --alias <ALIAS> alias for host [default: unknown]\n --cm <CM_ADDR> China Mobile probe addr [default: cm.tz.cloudcpp.com:80]\n --ct <CT_ADDR> China Telecom probe addr [default: ct.tz.cloudcpp.com:80]\n --cu <CU_ADDR> China Unicom probe addr [default: cu.tz.cloudcpp.com:80]\n --disable-extra disable extra info report, default:false\n --disable-notify disable notify, default:false\n --disable-ping disable ping, default:false\n --disable-tupd disable t/u/p/d, default:false\n -g, --gid <GID> group id [default: ]\n -h, --help Print help information\n --ip-info show ip info, default:false\n --ip-source <IP_SOURCE> ip info source [env: SSR_IP_SOURCE=] [default: ip-api.com]\n --sys-info show sys info, default:false\n --json use json protocol, default:false\n --location <LOCATION> location [default: ]\n -n, --vnstat enable vnstat, default:false\n --vnstat-mr <VNSTAT_MR> vnstat month rotate 1-28 [default: 1]\n -p, --pass <PASS> password [default: p1]\n -t, --type <HOST_TYPE> host type [default: ]\n -u, --user <USER> username [default: h1]\n -V, --version Print version information\n -w, --weight <WEIGHT> weight for rank [default: 0]\n\n# \u4e00\u4e9b\u53c2\u6570\u8bf4\u660e\n--ip-info # \u663e\u793a\u672c\u673aip\u4fe1\u606f\u540e\u7acb\u5373\u9000\u51fa\uff0c\u76ee\u524d\u4f7f\u7528 ip-api.com \u6570\u636e\n--ip-source # \u6307\u5b9a ip \u4fe1\u606f\u6e90\uff0cip-api.com / ip.sb / ipapi.co / myip.la\n--sys-info # \u663e\u793a\u672c\u673a\u7cfb\u7edf\u4fe1\u606f\u540e\u7acb\u5373\u9000\u51fa\n--disable-extra # \u4e0d\u4e0a\u62a5\u7cfb\u7edf\u4fe1\u606f\u548cIP\u4fe1\u606f\n--disable-ping # \u505c\u7528\u4e09\u7f51\u5ef6\u65f6\u548c\u4e22\u5305\u7387\u63a2\u6d4b\n--disable-tupd # \u4e0d\u4e0a\u62a5 tcp/udp/\u8fdb\u7a0b\u6570/\u7ebf\u7a0b\u6570\uff0c\u51cf\u5c11CPU\u5360\u7528\n-w, --weight # \u6392\u5e8f\u52a0\u5206\uff0c\u5fae\u8c03\u8ba9\u4e3b\u673a\u9760\u524d\u663e\u793a\uff0c\u65e0\u5f3a\u8feb\u75c7\u53ef\u5ffd\u7565\n-g, --gid # \u52a8\u6001\u6ce8\u518c\u7684\u7ec4id\n--alias # \u52a8\u6001\u6ce8\u518c\u6a21\u5f0f\u4e0b\uff0c\u6307\u5b9a\u4e3b\u673a\u7684\u5c55\u793a\u540d\u5b57\n# \u603b\u6d41\u91cf\uff0c\u7f51\u5361\u6d41\u91cf/\u7f51\u901f\u7edf\u8ba1\n-i, --iface # \u975e\u7a7a\u65f6\uff0c\u53ea\u7edf\u8ba1\u6307\u5b9a\u7f51\u53e3\n-e, --exclude-iface # \u6392\u9664\u6307\u5b9a\u7f51\u53e3\uff0c\u9ed8\u8ba4\u6392\u9664 \"lo,docker,vnet,veth,vmbr,kube,br-\"\n```\n\n### 4.2 Python \u7248 Client\n\n<details>\n <summary> Python \u7248 Client \u8bf4\u660e</summary>\n\n```bash\n# Python \u7248\u672c Client \u4f9d\u8d56\u5b89\u88c5\n## Centos\nyum -y install epel-release\nyum -y install python3-pip gcc python3-devel\npython3 -m pip install psutil requests py-cpuinfo\n\n## Ubuntu/Debian\napt -y install python3-pip\npython3 -m pip install psutil requests py-cpuinfo\n\n## Alpine linux\napk add wget python3 py3-pip gcc python3-dev musl-dev linux-headers\napk add procps iproute2 coreutils\npython3 -m pip install psutil requests py-cpuinfo\n\nwget --no-check-certificate -qO stat_client.py 'https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/client/stat_client.py'\n\n## Windows\n# \u5b89\u88c5 python 3.10 \u7248\u672c\uff0c\u5e76\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\n# \u547d\u4ee4\u884c\u6267\u884c pip install psutil requests\n# \u4e0b\u8f7d https://raw.githubusercontent.com/zdz/ServerStatus-Rust/master/client/stat_client.py\npip install psutil requests py-cpuinfo\n\npython3 stat_client.py -h\npython3 stat_client.py -a \"http://127.0.0.1:8080/report\" -u h1 -p p1\n```\n</details>\n\n## 5. \u5f00\u542f `vnstat` \u652f\u6301\n[vnstat](https://zh.wikipedia.org/wiki/VnStat) \u662fLinux\u4e0b\u4e00\u4e2a\u6d41\u91cf\u7edf\u8ba1\u5de5\u5177\uff0c\u5f00\u542f `vnstat` \u540e\uff0c`server` \u5b8c\u5168\u4f9d\u8d56\u5ba2\u6237\u673a\u7684 `vnstat` \u6570\u636e\u6765\u663e\u793a\u6708\u6d41\u91cf\u548c\u603b\u6d41\u91cf\uff0c\u4f18\u70b9\u662f\u91cd\u542f\u4e0d\u4e22\u6d41\u91cf\u6570\u636e\u3002\n\n<details>\n <summary>\u5f00\u542f vnstat \u8bbe\u7f6e</summary>\n\n```bash\n# \u5728client\u7aef\u5b89\u88c5 vnstat\n## Centos\nsudo yum install epel-release -y\nsudo yum install -y vnstat\n## Ubuntu/Debian\nsudo apt install -y vnstat\n\n# \u4fee\u6539 /etc/vnstat.conf\n# BandwidthDetection 0\n# MaxBandwidth 0\n# \u9ed8\u8ba4\u4e0d\u662f eth0 \u7f51\u53e3\u7684\u9700\u8981\u7f6e\u7a7a Interface \u6765\u81ea\u52a8\u9009\u62e9\u7f51\u53e3\n# \u6ca1\u62a5\u9519\u4e00\u822c\u4e0d\u9700\u8981\u6539\n# Interface \"\"\nsystemctl restart vnstat\n\n# \u786e\u4fdd version >= 2.6\nvnstat --version\n# \u6d4b\u8bd5\u67e5\u770b\u6708\u6d41\u91cf (\u521a\u5b89\u88c5\u53ef\u80fd\u9700\u7b49\u4e00\u5c0f\u6bb5\u65f6\u95f4\u6765\u91c7\u96c6\u6570\u636e)\nvnstat -m\nvnstat --json m\n\n# client \u4f7f\u7528 -n \u53c2\u6570\u5f00\u542f vnstat \u7edf\u8ba1\n./stat_client -a \"grpc://127.0.0.1:9394\" -u h1 -p p1 -n\n# \u6216\npython3 stat_client.py -a \"http://127.0.0.1:8080/report\" -u h1 -p p1 -n\n```\n</details>\n\n## 6. FAQ\n\n<details>\n <summary>\u5982\u4f55\u4f7f\u7528\u81ea\u5b9a\u4e49\u4e3b\u9898</summary>\n\n\u66f4\u7b80\u5355\u7684\u65b9\u5f0f \ud83d\udc49 [#37](https://github.com/zdz/ServerStatus-Rust/discussions/37)\n\n```nginx\nserver {\n # ssl, domain \u7b49\u5176\u5b83 nginx \u914d\u7f6e\n\n # \u53cd\u4ee3 /report \u8bf7\u6c42\n location = /report {\n proxy_set_header Host $host;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header X-Forwarded-Proto $scheme;\n proxy_set_header X-Forwarded-Host $host;\n proxy_set_header X-Forwarded-Port $server_port;\n\n proxy_pass http://127.0.0.1:8080/report;\n }\n # \u53cd\u4ee3 json \u6570\u636e\u8bf7\u6c42\n location = /json/stats.json {\n proxy_set_header Host $host;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header X-Forwarded-Proto $scheme;\n proxy_set_header X-Forwarded-Host $host;\n proxy_set_header X-Forwarded-Port $server_port;\n\n proxy_pass http://127.0.0.1:8080/json/stats.json;\n }\n # v1.4.0\u540e\uff0c\u540c\u6837\u9700\u8981\u53cd\u4ee3 /detail, /map\n\n # \u5176\u5b83 html,js,css \u7b49\uff0c\u8d70\u672c\u5730\u6587\u672c\n location / {\n root /opt/ServerStatus/web; # \u4f60\u81ea\u5df1\u4fee\u6539\u7684\u4e3b\u9898\u76ee\u5f55\n index index.html index.htm;\n }\n}\n```\n</details>\n\n<details>\n <summary>\u5982\u4f55\u6e90\u7801\u7f16\u8bd1</summary>\n\n```bash\n#\ncargo install stat_server\ncargo install stat_client\n# or\n# \u6309\u63d0\u793a\u5b89\u88c5 rust \u7f16\u8bd1\u5668\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\nyum install -y openssl-devel\ngit clone https://github.com/zdz/ServerStatus-Rust.git\ncd ServerStatus-Rust\ncargo build --release\n# \u7f16\u8bd1\u597d\u7684\u6587\u4ef6\u76ee\u5f55 target/release\n```\n</details>\n\n<details>\n <summary>\u5982\u4f55\u81ea\u5b9a\u4e49 ping \u5730\u5740</summary>\n\n```bash\n# \u4f8b\u5982\u81ea\u5b9a\u4e49\u79fb\u52a8\u63a2\u6d4b\u5730\u5740\uff0c\u7528 --cm \u6307\u5b9a\u5730\u5740\n./stat_client -a \"grpc://127.0.0.1:9394\" -u h1 -p p1 --cm=cm.tz.cloudcpp.com:80\n\n# \u7535\u4fe1\u8054\u901a\u53c2\u6570\u53ef\u4ee5\u4f7f\u7528 -h \u547d\u4ee4\u67e5\u770b\n./stat_client -h\nOPTIONS:\n --cm <CM_ADDR> China Mobile probe addr [default: cm.tz.cloudcpp.com:80]\n --ct <CT_ADDR> China Telecom probe addr [default: ct.tz.cloudcpp.com:80]\n --cu <CU_ADDR> China Unicom probe addr [default: cu.tz.cloudcpp.com:80]\n```\n</details>\n\n<details>\n <summary>\u5173\u4e8e\u8fd9\u4e2a\u8f6e\u5b50</summary>\n\n \u4e4b\u524d\u4e00\u76f4\u5728\u4f7f\u7528 `Prometheus` + `Grafana` + `Alertmanager` + `node_exporter` \u505aVPS\u76d1\u63a7\uff0c\u8fd9\u4e5f\u662f\u4e1a\u754c\u6bd4\u8f83\u6210\u719f\u7684\u76d1\u63a7\u65b9\u6848\uff0c\u7528\u8fc7\u4e00\u6bb5\u65f6\u95f4\u540e\uff0c\u53d1\u73b0\u975e\u751f\u4ea7\u73af\u5883\uff0c\u5f88\u591a\u76d1\u63a7\u6307\u6807\u90fd\u7528\u4e0d\u4e0a\uff0c\u8fd0\u7ef4\u6210\u672c\u6709\u70b9\u5927\u3002\n \u800c `ServerStatus` \u5f88\u597d\uff0c\u8db3\u591f\u7b80\u5355\u548c\u8f7b\u91cf\uff0c\u4e00\u773c\u53ef\u4ee5\u770b\u5c3d\u6240\u6709\u5c0f\u673a\u673a\uff0c\u53ea\u662f `c++` \u7248\u672c\u5f88\u4e45\u6ca1\u8fed\u4ee3\u8fc7\uff0c\u81ea\u5df1\u7684\u4e00\u4e9b\u9700\u6c42\u5728\u539f\u7248\u4e0a\u4e0d\u662f\u5f88\u597d\u4fee\u6539\uff0c\u5982\u81ea\u5e26 `tcp` \u4e0a\u62a5\u5bf9\u8de8\u533a\u673a\u5668\u4e0d\u662f\u5f88\u53cb\u597d\uff0c\u4e5f\u4e0d\u65b9\u4fbf\u5bf9\u4e0a\u62a5\u7684\u94fe\u8def\u505a\u4f18\u5316 \u7b49\u7b49\u3002\u8fd9\u662f\u5b66\u4e60 `Rust` \u7ec3\u624b\u7684\u5c0f\u9879\u76ee\uff0c\u6240\u4ee5\u4e0d\u4f1a\u589e\u52a0\u590d\u6742\u529f\u80fd\uff0c\u4fdd\u6301\u5c0f\u800c\u7f8e\uff0c\u7b80\u5355\u90e8\u7f72\uff0c\u914d\u5408 [Uptime Kuma](https://github.com/louislam/uptime-kuma) \u57fa\u672c\u4e0a\u53ef\u4ee5\u6ee1\u8db3\u4e2a\u4eba\u5927\u90e8\u5206\u76d1\u63a7\u9700\u6c42\u3002\n\n</details>\n\n## 7. \u76f8\u5173\u9879\u76ee\n- https://github.com/BotoX/ServerStatus\n- https://github.com/cppla/ServerStatus\n- https://github.com/mojeda/ServerStatus\n- https://github.com/cokemine/ServerStatus-Hotaru\n- https://github.com/ToyoDAdoubiBackup/ServerStatus-Toyo\n\n## 8. \u6700\u540e\n\n \u5f88\u9ad8\u5174\u6211\u7684\u4ee3\u7801\u80fd\u8dd1\u5728\u4f60\u7684\u670d\u52a1\u5668\u4e0a\uff0c\u5982\u679c\u5bf9\u4f60\u6709\u5e2e\u52a9\u7684\u8bdd\uff0c\u6b22\u8fce\u7559\u4e0b\u4f60\u7684 star \u2b50 \u652f\u6301\u4e00\u4e0b\n\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "A simple server monitoring tool",
"version": "1.8.1",
"project_urls": {
"Documentation": "https://doc.ssr.rs",
"Homepage": "https://github.com/zdz/ServerStatus-Rust",
"Issues": "https://github.com/zdz/ServerStatus-Rust/issues",
"Repository": "https://github.com/zdz/ServerStatus-Rust"
},
"split_keywords": [
"stat_client",
"serverstatus",
"monitor"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6ff2b616f7bacade1eeb060e0de13eb4022ae33c429f457c3a4d1fdd845764b8",
"md5": "7833a8d8bb76ea21e017acb321f4d091",
"sha256": "8f8d9a7203b4702907a49d19f99c217007e9ffed5d3c62ea30ce4d29aed467ce"
},
"downloads": -1,
"filename": "stat_client-1.8.1-py3-none-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "7833a8d8bb76ea21e017acb321f4d091",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2250992,
"upload_time": "2024-03-18T14:33:02",
"upload_time_iso_8601": "2024-03-18T14:33:02.667239Z",
"url": "https://files.pythonhosted.org/packages/6f/f2/b616f7bacade1eeb060e0de13eb4022ae33c429f457c3a4d1fdd845764b8/stat_client-1.8.1-py3-none-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6474fba8ec52243a1d3710eb43883d2adba1761d8198e9f3b2a678417c38826a",
"md5": "9bc80ee913510dc51bc4949378c99830",
"sha256": "22a873e1f3aeb69be2e7aa4458e30a059ebe0bea6a49d086a284f3e654501fc8"
},
"downloads": -1,
"filename": "stat_client-1.8.1-py3-none-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "9bc80ee913510dc51bc4949378c99830",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2130463,
"upload_time": "2024-03-18T14:33:05",
"upload_time_iso_8601": "2024-03-18T14:33:05.386750Z",
"url": "https://files.pythonhosted.org/packages/64/74/fba8ec52243a1d3710eb43883d2adba1761d8198e9f3b2a678417c38826a/stat_client-1.8.1-py3-none-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ed1d2a9848823e9e9c690a186b33b3622b4c52183aa61d77920b9989a43901dd",
"md5": "4fe9eb772e281efcfc8a7654005e5e83",
"sha256": "146acfd7a3f05c623c024892bdbba3d9fd0af45f9015fac20afaac42846a5438"
},
"downloads": -1,
"filename": "stat_client-1.8.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "4fe9eb772e281efcfc8a7654005e5e83",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2425847,
"upload_time": "2024-03-18T14:33:07",
"upload_time_iso_8601": "2024-03-18T14:33:07.224575Z",
"url": "https://files.pythonhosted.org/packages/ed/1d/2a9848823e9e9c690a186b33b3622b4c52183aa61d77920b9989a43901dd/stat_client-1.8.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6e2e2399ef24a05261eba76d51e478053ee57bed2f22adbab8bcc238b41416e9",
"md5": "248ca74b1a6f569414e3dc7ba52414d4",
"sha256": "3fdb1c8577146586324d09788b585219bd039ff0a75448fbe9b8d0a0b653d4fc"
},
"downloads": -1,
"filename": "stat_client-1.8.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
"has_sig": false,
"md5_digest": "248ca74b1a6f569414e3dc7ba52414d4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 2639511,
"upload_time": "2024-03-18T14:33:09",
"upload_time_iso_8601": "2024-03-18T14:33:09.058447Z",
"url": "https://files.pythonhosted.org/packages/6e/2e/2399ef24a05261eba76d51e478053ee57bed2f22adbab8bcc238b41416e9/stat_client-1.8.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-18 14:33:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zdz",
"github_project": "ServerStatus-Rust",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "stat-client"
}