ServerStatus-Rust

作者: zhuangjie 分类: 未分类 发布时间: 2025-03-04 09:56

Rust版/加强版的ServerStatus多服务器状态探针,当下线/上线/内存可设置邮件通知,还有面板主题

https://github.com/zdz/ServerStatus-Rust

服务端

bash -c "$(curl -sSL https://raw.githubusercontent.com/zdz/ServerStatus-Rust/refs/heads/master/scripts/one-touch.sh)"

#主要配置在/opt/ServerStatus/config.toml,在客户端连接前要设置一下客户端的“插槽”基本信息,邮件通知也是在这里设置,所有配置都在这里

systemctl restart stat_server.service systemctl enable stat_server.service

客户端/要监听的服务端

bash -c "$(curl -sSL https://raw.githubusercontent.com/zdz/ServerStatus-Rust/refs/heads/master/scripts/one-touch.sh)"
#会安装服务端的,所以下面要把服务端的停止
systemctl disable stat_server.service
systemctl stop stat_server.service
#编辑客户端要通信的服务端信息
#修改 /etc/systemd/system/stat_client.service 文件,将IP改为你服务器的IP或你的域名/用户名、密码(在服务端/opt/ServerStatus/config.toml中配置了)

#上面配置好后重启一下客户端 systemctl daemon-reload systemctl restart stat_client.service systemctl enable stat_client.service

主题安装

就是部署一个前端项目(主题),有这些主题

外部访问这个前端主题,nginx配置在这里(下面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;
}
}

其它相关

ServerStatus原始版部署使用

[官方演示地址](https://tz.cloudcpp.com/)

1、服务端

mkdir -p /opt/ServerStatus/server && cd /opt/ServerStatus/server &&  wget --no-check-certificate -qO ~/serverstatus-config.json https://raw.githubusercontent.com/cppla/ServerStatus/master/server/config.json && mkdir /opt/ServerStatus/serverstatus-monthtraffic    
docker run -d --restart=always --name=serverstatus -v /opt/ServerStatus/serverstatus-config.json:/ServerStatus/server/config.json -v /opt/ServerStatus/serverstatus-monthtraffic:/usr/share/nginx/html/json -p 9090:80 -p 35601:35601 cppla/serverstatus:latest   

#serverstatus-config.json存放了服务器位置,这个文件是客户端连接必看的必编辑的

2、服务端

#执行下面要求输入服务端ip,USER(在服务端serverstatus-config.json文件中定义),PASSWORD(在服务端serverstatus-config.json文件中定义)
bash -c "$(curl -sSL https://raw.githubusercontent.com/18476305640/xiaozhuang/refs/heads/dev/bash/ServerStatusClient.sh)"

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

标签云