去不图床数据托管量已超过 23 万,有一些小伙伴反馈说外链速度慢了些,于是杜老师有增加几个节点。由于是自建 CDN,为了保障外链稳定,设置了云监控,同时将该工具分享给需要的小伙伴们!
工具介绍 {#工具介绍}
通过下方截图可以看出,去不图床托管图片数超过了 23 万,数据占用超过了 93G。有一些小伙伴反馈说外链速度慢了些,于是杜老师有增加几个节点。由于是自建 CDN,为了保障外链稳定,设置了云监控,ServerStatus 中文版是一个酷炫高逼格的云探针、服务器云监控、多服务器探针:
配置文件 {#配置文件}
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| { "servers": [ { "username": "s01", "name": "vps-1", "type": "kvm", "host": "chengdu", "location": "🇨🇳", "password": "USER_DEFAULT_PASSWORD", "monthstart": 1 }, ], "watchdog": [ { "name": "服务器负载高监控,排除内存大于32G物理机,同时排除俄勒冈机器", "rule": "cpu>90&load_1>4&memory_total<33554432&name!='俄勒冈'", "interval": 600, "callback": "https://yourSMSurl" }, { "name": "服务器内存使用率过高监控", "rule": "(memory_used/memory_total)*100>90", "interval": 600, "callback": "https://yourSMSurl" }, { "name": "服务器宕机告警,排出俄勒冈,排除s02", "rule": "online4=0&online6=0&name!='俄勒冈'&username!='s02'", "interval": 600, "callback": "https://yourSMSurl" }, { "name": "DDOS和CC攻击监控", "rule": "tcp_count>600", "interval": 300, "callback": "https://yourSMSurl" }, { "name": "服务器月出口流量999GB告警", "rule": "(network_out-last_network_out)/1024/1024/1024>999", "interval": 3600, "callback": "https://yourSMSurl" }, { "name": "你可以组合任何已知字段的表达式", "rule": "(hdd_used/hdd_total)*100>95", "interval": 1800, "callback": "https://yourSMSurl" } ] }
|
杜老师收集了几个参数作用,供小伙伴参考:
| 参数 | 作用 | |----------------------|--------------------------------------------------------------------------------------------------------------| | ! rule | 可设置为任何已知字段的表达式 | | ! interval | 最小通知间隔 | | ! callback | 可自定义为 POST 方法的 URL,告警内容将拼接其后并发起回调 | | ! callback Telegram | https://api.telegram.org/bot /sendMessage?parse_mode=HTML&disable_web_page_preview=true&chat_id= &text= | | ! callback Server酱 | https://sctapi.ftqq.com/ .send?title=ServerStatus&desp= | | ! callback PushDeer | https://api2.pushdeer.com/message/push?pushkey= &text= | | ! callback BasicAuth | https://USER:PASS@URL/api/push?message= |
部署方法 {#部署方法}
Server 服务端,首先在配置文件同级目录执行 mkdir serverstatus-monthtraffic
创建目录,然后执行下方命令即可启用服务:
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1
| docker run -d --restart=always --name=serverstatus -v ~/serverstatus-config.json:/ServerStatus/server/config.json -v ~/serverstatus-monthtraffic:/usr/share/nginx/html/json -p 80:80 -p 35601:35601 cppla/serverstatus:latest
|
Client 客户端,客户端不支持用 Docker 部署,直接使用下方命令即可自动部署:
|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1
| wget --no-check-certificate -qO client-linux.py 'https://raw.githubusercontent.com/penndu/ServerStatus/master/clients/client-linux.py' && nohup python3 client-linux.py SERVER={$SERVER} USER={$USER} PASSWORD={$PASSWORD} > /dev/null 2>&1 &
|
不同主题 {#不同主题}
默认监控页面如下,点击服务器项可以查看详细信息,包含内存、硬盘、网络情况等等,页面每三秒会自动刷新: