-
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:
There are many ways:
- (Recomended) Docker compose
- Executable
version: "3.0"
services:
srvbox:
image: lollipopkit/srvbox_monitor:latest
container_name: srvbox
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.pem
ports:
- 3770:3770Choose 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.
- 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 # Please change 'xxx' to your username 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 servicerun 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(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:
In order to use App push, you need to get a Token in the App, you can find it in the settings page of the App.
Attention: Self-compiled version (non-AppStore version) cannot use the App push service provided by this project, you need to modify the source code of this project and compile it yourself, or build your own push service.
- Add home widget
- Long press the widget and click
Edit Widget - Input
Url,such ashttps://server1.srvbox.example.com/status- Url must end with
/status, this is the api for getting status - Due to Apple's security policy, you must use https
- If you don't know how to use reverse proxy and https, I recommend learning to use:
-
caddywill automatically configure https:# Make sure your domain name has been resolved to the target server, and replace the domain name below with your domain name # And replace DEVICE_IP with the IP of your server, if you install it on "localhost", please use 127.0.0.1 server1.srvbox.example.com { reverse_proxy 127.0.0.1:3770 } - Via
tailscaleaccess internal network service:https://server1:3770/status(server1is the hostname provided bytailscale'sMagic DNS)
-
- You can use the internal network address
- Url must end with
- Go back to the home screen
Attention:
- You can repeat the above steps to add multiple widgets, each widget can use a different link, which can display the status of different servers.
- Because of iOS restrictions, the fastest refresh rate is half an hour
- Add home widget
- Remember the
IDdisplay on the widget - Open the app settings page, click
Config home widget link - Input with this format
{"ID1": "URL1", "ID2": "URL2"}- eg:
{"17": "https://example.com/status"}
- eg:
- Save
- Back to home screen, and click the widget to refresh.
Attention:
- You can repeat the above steps to add multiple widgets, each widget can use a different link, which can display the status of different servers. You need to config urls (Step 4) likes:
{"17": "https://example.com/status", "18": "https://xxx.xx/status"}
{ "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) "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 "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 "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 // {{key}} and {{value}} will be replaced with the key and value of the check result "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 } } ] }