开源项目地址
部署服务器端
1
| docker run -d --restart=always --name=serverstatus -v /root/.docker/serverstatus/serverstatus-config.json:/ServerStatus/server/config.json -v /root/.docker/serverstatus/serverstatus-monthtraffic:/usr/share/nginx/html/json -p 127.0.0.1:8080:80 -p 35601:35601 cppla/serverstatus
|
- 配置服务器文件,
/root/.docker/serverstatus/serverstatus-config.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| { "servers": [ { "username": "自定义用户名", "name": "服务器名称", "type": "kvm", "host": "host1", "location": "中国", "password": "自定义密码", "monthstart": 1 } ], "watchdog": [ { "name": "cpu high warning", "rule": "cpu>90&load_1>3", "interval": 600, "callback": "https://yourSMSurl" }, { "name": "memory high warning", "rule": "(memory_used/memory_total)*100>90", "interval": 300, "callback": "https://yourSMSurl" }, { "name": "offline warning", "rule": "online4=0&online6=0", "interval": 600, "callback": "https://yourSMSurl" }, { "name": "you can parse an expression combining any known field", "rule": "load_5>3", "interval": 900, "callback": "https://yourSMSurl" } ] }
|
- 配置https(caddy),编辑
/etc/caddy/Caddyfile
1 2 3
| 域名 { reverse_proxy localhost:8080 }
|
部署客户端
1 2 3
| echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf sysctl -p
|
1
| wget --no-cache -O lkl-haproxy.sh https://github.com/mzz2017/lkl-haproxy/raw/master/lkl-haproxy.sh && bash lkl-haproxy.sh
|
- 新建服务服务,
vim /lib/systemd/system/status-client.service
debian系统服务
1 2 3 4 5 6 7 8 9
| [Unit] Description=ServerStatus-Client After=network.target [Service] ExecStart=/usr/bin/python3 /root/.tool/client-linux.py ExecReload=/bin/kill -HUP $MAINPID Restart=on-failure [Install] WantedBy=multi-user.target
|
安装alpine系统依赖
1
| apk add python3 procps iproute2 coreutils
|
alpine系统服务,vim /etc/init.d/status-client
1 2 3 4 5 6 7 8 9 10
| #!/sbin/openrc-run # Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2
command="/usr/bin/python3 /root/.tool/client-linux.py" command_background=true pidfile="/run/${RC_SVCNAME}.pid" depend() { need net }
|
设置权限
1
| chmod +x /etc/init.d/status-client
|
其他
1
| wget -qO- bench.sh | bash
|
1
| docker run -d --restart=always -p 3001:3001 -v /mnt/disk/docker/kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1
|