From 2a20d1eb2eadd78f0cfde526c42d52f3179dd7b4 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Thu, 15 Dec 2022 11:08:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?v1.6.2=E5=BC=80=E5=A7=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ app/Library/AppInfo.php | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1065dd5a..a8e1dc87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### [v1.6.2](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.1)(2023-01-12) + + ### [v1.6.1](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.1)(2022-12-12) - 富文本编辑器增加粘贴图片和远程图片本地化 diff --git a/app/Library/AppInfo.php b/app/Library/AppInfo.php index 1242f294..70774c80 100644 --- a/app/Library/AppInfo.php +++ b/app/Library/AppInfo.php @@ -16,7 +16,7 @@ class AppInfo protected $link = 'https://www.koogua.com'; - protected $version = '1.6.1'; + protected $version = '1.6.2'; public function __get($name) { @@ -28,6 +28,8 @@ class AppInfo if (isset($this->{$name})) { return $this->{$name}; } + + return null; } } \ No newline at end of file From 254a78f246fd197da6d7b0f25383ccd65849bf3b Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Tue, 20 Dec 2022 16:36:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?ServerMonitor=E8=B5=84=E6=BA=90=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=E9=98=80=E5=80=BC=E5=8F=AF=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + app/Console/Tasks/ServerMonitorTask.php | 12 +++++++++--- config/config.default.php | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8e1dc87..97bde1bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### [v1.6.2](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.1)(2023-01-12) +- ServerMonitor资源监控阀值可配置 ### [v1.6.1](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.1)(2022-12-12) diff --git a/app/Console/Tasks/ServerMonitorTask.php b/app/Console/Tasks/ServerMonitorTask.php index 1ac2e14b..8f054931 100644 --- a/app/Console/Tasks/ServerMonitorTask.php +++ b/app/Console/Tasks/ServerMonitorTask.php @@ -53,7 +53,9 @@ class ServerMonitorTask extends Task $load = sys_getloadavg(); - if ($load[1] > $cpuCount * 0.8) { + $limit = $this->getConfig()->path('server_monitor.cpu', 0.8); + + if ($load[1] > $cpuCount * $limit) { return sprintf("cpu负载超过%s", $load[1]); } @@ -82,7 +84,9 @@ class ServerMonitorTask extends Task $left = 100 * ($available / $total); - if ($left < 20) { + $limit = $this->getConfig()->path('server_monitor.memory', 10); + + if ($left < $limit) { return sprintf("memory剩余不足%s%%", round($left)); } @@ -96,7 +100,9 @@ class ServerMonitorTask extends Task $left = 100 * $free / $total; - if ($left < 20) { + $limit = $this->getConfig()->path('server_monitor.disk', 20); + + if ($left < $limit) { return sprintf("disk剩余不足%s%%", round($left)); } diff --git a/config/config.default.php b/config/config.default.php index 41836295..2ee61586 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -172,4 +172,19 @@ $config['websocket']['connect_address'] = 'your_domain.com:8282'; */ $config['websocket']['register_address'] = '127.0.0.1:1238'; +/** + * 资源监控: CPU负载(0.1-1.0) + */ +$config['server_monitor']['cpu'] = 0.8; + +/** + * 资源监控: 内存剩余占比(10-100)% + */ +$config['server_monitor']['memory'] = 10; + +/** + * 资源监控: 磁盘剩余占比(10-100)% + */ +$config['server_monitor']['disk'] = 20; + return $config;