开源项目地址

部署服务器端

  • 安装服务

    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

    {
    "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

    域名 {
    reverse_proxy localhost:8080
    }

    部署客户端

  • kvm开启bbr(可选)

    echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
    echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
    sysctl -p
  • openvz开启bbr(可选)

    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系统服务

[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系统依赖

apk add python3 procps iproute2 coreutils

alpine系统服务,vim /etc/init.d/status-client

#!/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
}

设置权限

chmod +x /etc/init.d/status-client

其他

  • 网络测试脚本
    wget -qO- bench.sh | bash
  • tcp/http/docker监听
    docker run -d --restart=always -p 3001:3001 -v /mnt/disk/docker/kuma:/app/data --name uptime-kuma louislam/uptime-kuma:1