Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
zdz committed Feb 19, 2022
1 parent 871f0d3 commit 7bd33bd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ bash -ex one-touch.sh
```toml
tcp_addr = "0.0.0.0:34512"
http_addr = "0.0.0.0:8080"
# 默认30s无上报判断下线
# 默认30s无上报判定下线
offline_threshold = 30

# 使用vnstat来更精准统计月流量,开启参考下面 vnstat 一节
vnstat = false

# name 不可重复,代替原来的 ClientID, alias 为展示名
# name 主机唯一标识,不可重复,alias 为展示名
# 批量部署时可以用主机 hostname 作为 name,统一密码
hosts = [
{name = "h1", password = "p1", alias = "n1", location = "🇨🇳", type = "kvm", monthstart = 1},
{name = "h2", password = "p2", alias = "n2", location = "🇺🇸", type = "kvm", monthstart = 1},
Expand Down Expand Up @@ -95,14 +96,16 @@ custom_tpl = """

### 3.2 服务端运行
```bash
## systemd 方式, 参照 one-touch.sh 脚本 (推荐)
# systemd 方式, 参照 one-touch.sh 脚本 (推荐)
systemctl enable stat_server
systemctl start stat_server

# 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 network create traefik_gw
# 默认使用 watchtower 自动更新,不需要可以去除
docker-compose up -d

# 源码编译
Expand Down Expand Up @@ -148,7 +151,7 @@ systemctl start stat_client
```

## 5.开启 `vnstat` 支持
[vnstat](https://zh.wikipedia.org/wiki/VnStat) 是Linux下一个流量统计工具,开启 `vnstat` 后,`server` 完全依赖客户机的 `vnstat` 数据来显示月流量,优点是重启不丢流量数据,数据更准确。
[vnstat](https://zh.wikipedia.org/wiki/VnStat) 是Linux下一个流量统计工具,开启 `vnstat` 后,`server` 完全依赖客户机的 `vnstat` 数据来显示月流量和总流量,优点是重启不丢流量数据,数据更准确。
```bash
# 在client端安装 vnstat
## Centos
Expand Down
3 changes: 2 additions & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ offline_threshold = 30
# 使用vnstat来更精准统计月流量,开启参考下面 vnstat 一节
vnstat = false

# name 不可重复,代替原来的 ClientID, alias 为展示名
# name 主机唯一标识,不可重复,alias 为展示名
# 批量部署时可以用主机 hostname 作为 name,统一密码
hosts = [
{name = "h1", password = "p1", alias = "n1", location = "🇨🇳", type = "kvm", monthstart = 1},
{name = "h2", password = "p2", alias = "n2", location = "🇺🇸", type = "kvm", monthstart = 1},
Expand Down
14 changes: 11 additions & 3 deletions one-touch.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash
set -ex
WORKSPACE=/opt/ServerStatus

# 下载
WORKSPACE=/opt/ServerStatus
mkdir -p ${WORKSPACE}
cd ${WORKSPACE}

# 下载, arm 机器替换 x86_64 为 aarch64
wget --no-check-certificate -qO ServerStatus-x86_64-unknown-linux-musl.zip "https://github.com/zdz/ServerStatus-Rust/releases/download/latest/ServerStatus-x86_64-unknown-linux-musl.zip"
unzip -o ServerStatus-x86_64-unknown-linux-musl.zip

Expand All @@ -26,4 +27,11 @@ systemctl status stat_client
# systemctl enable stat_server
# systemctl enable stat_client

# 修改 /etc/systemd/system/stat_client.service 文件,将IP改为你服务器的IP
# 停止
# systemctl stop stat_server
# systemctl stop stat_client

# https://fedoraproject.org/wiki/Systemd/zh-cn
# https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html

# 修改 /etc/systemd/system/stat_client.service 文件,将IP改为你服务器的IP或你的域名

0 comments on commit 7bd33bd

Please sign in to comment.