- 
                Notifications
    You must be signed in to change notification settings 
- Fork 27
Home
English | 简体中文
In order to make full use of the functions of this project, you need to take the following steps:
About app config, please refer to App Wiki.
version: "3.0"
services:
  srvbox:
    image: lollipopkit/srvbox_monitor:latest
    container_name: srvbox
    ports:
      - 3770:3770
    volumes:
      - ./config:/root/.config/server_box
    environment:
      - TZ=Asia/Shanghai
      # Custom listen address
      # - SBM_ADDR=0.0.0.0:3770
      # TLS Cert
      # - SBM_TLS_CRT=/root/.config/server_box/cert.pem
      # TLS Key
      # - SBM_TLS_KEY=/root/.config/server_box/key.pemAttention:
- To ensure that the server can read the network interface normally, you need to ensure that network_modeishost.
- Please edit this file according to your needs, and pay attention to the comments.
- If port 3770 is occupied, you can change it to another port by modifying SBM_ADDR.
Choose a directory you like, write the above content into docker-compose.yml and run docker compose up -d.
- 
docker rm srvbox -f && docker rmi lollipopkit/srvbox_monitor:latestto delete old image.
- 
docker compose up -dto run with new image.
- The following command will install newest version for rootand configsystemd.
- If you want to install as rootlessordocker, please refer to other instructions.
curl -fsSL https://raw.githubusercontent.com/lollipopkit/server_box_monitor/main/install.sh | sh -s -x -- installcurl -fsSL https://raw.githubusercontent.com/lollipopkit/server_box_monitor/main/install.sh | sh -x -s -- installcurl -fsSL https://raw.githubusercontent.com/lollipopkit/server_box_monitor/main/install.sh | sh -x -s -- upgrade- If you have goinstalled, you can rungo install github.com/lollipopkit/server_box_monitor@latest
- If you don't have goinstalled, you can download the binary from release page
If you are using the executable file, you probably want it to run continuously. It is recommended to use systemd:
- Example (Read comment!):
[Unit] Description=ServerBox Monitor Service After=network.target [Service] Type=simple # Uncomment the following line to run as a specific user # User=root Restart=on-failure RestartSec=5s # Make sure the path is correct ExecStart=/usr/bin/server_box_monitor # /home/xxx is your home directory WorkingDirectory=/home/xxx/.config/server_box [Install] WantedBy=default.target
- Rootless
- Copy file to ~/.config/systemd/user/srvbox.service
- Run systemctl --user enable --now srvbox
- You can run sudo loginctl enable-linger $USERto make the service run after logout
 
- Copy file to 
- Rootful
- Copy file to /etc/systemd/system/srvbox.service
- Uncomment Userin the file
- Run systemctl enable --now srvbox
 
- Copy file to 
You need manually update the executable file.
Before the next section, you need to confirm that the service is running, you can confirm it in the following ways:
- If you are using Docker:docker logs srvbox
- If you are using systemd: such assystemctl status srvbox
- Web access http://DEVICE_IP:3770/status(If you have modified the listening address, please replace it yourself)
If there is a display similar to the below, it means that the service has been successfully started and you can continue to the next step.

Different installation methods, the configuration file is in different paths:
- Executable: ~/.config/server_box/config.json
- 
Docker:./config/config.json
Here is a complete example of the server configuration, you need to modify it according to your needs:
{ "version": 2, // Interval of checking // Default: 7s // Values greater than 10s will be ignored "interval": "7s", // Rate limiter for msg push // eg: 3/1m (3 times every minute), 1/10s (1 time every 10 seconds) // If you set it too low, messages may be delayed "rate": "1/10s", // Name of this server "name": "Server 1", // Check rules // // Type: // cpu, mem, net, disk, temp (temperature), swap // // Threshold: // format: COMPARE_OPERATOR VALUE UNIT // COMPARE_OPERATOR: >, >=, <, <=, = // VALUE: int/float: 0.1 1 1.1 // UNIT: % (percent), m/s (speed), m (size), c (celsius) // Speed only valid in per second: b/s k/s, m/s, g/s ... // // Matcher: // cpu: cpu, cpu0, 1, 2, 3, ... // mem: free, used, avail // net: eth0, eth1-in, docker-out, ... // disk: /, /home, /dev/sda1, ... // temp: x86_pkg_temp, x86_core_temp, ... // swap: free, used "rules": [ { "type": "cpu", "threshold": ">=77.7%", // "" / "cpu" -> all cpus, in this case, you can omit attribute "matcher" // "X" / "cpuX" -> NO.X cpu "matcher": "0" }, { "type": "net", // speed only support per second "threshold": ">=7.7m/s", // network interface name // if empty, will use all network interfaces "matcher": "eth0" }, { "type": "temp", // temperature only support celsius "threshold": ">=37.7c", // you can run `cat /sys/class/thermal/thermal_zone*/type` to get all thermal types "matcher": "x86_pkg_temp" }, { "type": "disk", "threshold": ">=77.7%", // mount point or filesystem // you can use `df -h` to get all valid matchers // If you use docker, you need run `df -h` in the container "matcher": "/dev/sda1" }, { "type": "mem", // support: size, percent "threshold": "<=17.7%", // support: free, used, avail "matcher": "free" }, { "type": "swap", // support: size, percent "threshold": ">=37.7%", // support: free, used "matcher": "used" } ], // Push rules // // type: webhook, ios, serverchan (more to come) // iface: interface for the push type // body_regex: regex to match the response body // code: response code to match // // Format args: // "{{msg}}" will be replaced with the message of the check result // "{{name}}" will be replaced with the name of the server "pushes": [ { // This is a example for QQ Group message "type": "webhook", "name": "QQ Group", "iface": { // Webhook url "url": "http://localhost:5700", // Headers for the request "headers": { "Authorization": "Bearer YOUR_TOKEN", "Content-Type": "application/json" }, // UPPERCASED HTTP method "method": "POST", // Body for the request "body": { "action": "send_group_msg", "params": { "group_id": 123456789, "message": "{{name}}\n{{msg}}" } }, // Check push is successful or not: // Will skip if not set or empty // // If the response body matches the regex, the push is considered successful "body_regex": ".*", // If the response code equals, the push is considered successful "code": 200 } }, { "type": "ios", "name": "ServerBox iOS App", "iface": { // You can get it from settings page of ServerBox iOS app "token": "YOUR_TOKEN", "title": "{{name}}", "content": "{{msg}}", "body_regex": ".*", "code": 200 } }, { "type": "server_chan", "name": "ServerChan", "iface": { // Details please refer to https://sct.ftqq.com/ "sckey": "YOUR_SCKEY", "title": "{{name}}", "desp": "{{msg}}", "body_regex": ".*", "code": 200 } }, { "type": "bark", "name": "Bark", "iface": { // Details: https://github.com/Finb/Bark // Default https://api.day.app "server": "", "key": "YOUR KEY", "title": "{{name}} 提示", "body": "{{msg}}", "level": "timeSensitive", "body_regex": ".*", "code": 200 } } ] }