1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-07-01 22:54:56 +08:00

Merge branch 'koogua/v1.6.2' into demo

This commit is contained in:
xiaochong0302 2022-12-20 23:20:47 +08:00
commit 9b8338615f
4 changed files with 31 additions and 4 deletions

View File

@ -1,3 +1,7 @@
### [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)
- 富文本编辑器增加粘贴图片和远程图片本地化

View File

@ -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));
}

View File

@ -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;
}
}

View File

@ -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;