Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FLIPPED-AURORA
gin-vue-admin
提交
abbe1cb5
G
gin-vue-admin
项目概览
FLIPPED-AURORA
/
gin-vue-admin
大约 1 年 前同步成功
通知
332
Star
18154
Fork
5505
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
abbe1cb5
编写于
9月 24, 2020
作者:
Sliver_Horn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增服务器参数工具文件,修改8000->8888,删除多余的依赖文件
上级
bfda990c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
64 addition
and
2 deletion
+64
-2
server/core/server.go
server/core/server.go
+1
-1
server/go.mod
server/go.mod
+1
-1
server/utils/server.go
server/utils/server.go
+62
-0
未找到文件。
server/core/server.go
浏览文件 @
abbe1cb5
...
...
@@ -29,7 +29,7 @@ func RunWindowsServer() {
fmt
.
Printf
(
`欢迎使用 Gin-Vue-Admin
默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
默认前端文件运行地址:http://127.0.0.1:80
0
0
默认前端文件运行地址:http://127.0.0.1:80
8
0
`
,
address
)
global
.
GVA_LOG
.
Error
(
s
.
ListenAndServe
()
.
Error
())
}
server/go.mod
浏览文件 @
abbe1cb5
...
...
@@ -32,10 +32,10 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/qiniu/api.v7/v7 v7.4.1
github.com/satori/go.uuid v1.2.0
github.com/shirou/gopsutil v2.20.8+incompatible
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.6.2
github.com/swaggo/gin-swagger v1.2.0
github.com/swaggo/swag v1.6.7
...
...
server/utils/server.go
0 → 100644
浏览文件 @
abbe1cb5
package
utils
import
(
"fmt"
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/load"
"github.com/shirou/gopsutil/mem"
"runtime"
"time"
)
const
(
B
=
1
KB
=
1024
*
B
MB
=
1024
*
KB
GB
=
1024
*
MB
)
//服务器硬盘使用量
func
DiskCheck
()
{
u
,
_
:=
disk
.
Usage
(
"/"
)
usedMB
:=
int
(
u
.
Used
)
/
MB
usedGB
:=
int
(
u
.
Used
)
/
GB
totalMB
:=
int
(
u
.
Total
)
/
MB
totalGB
:=
int
(
u
.
Total
)
/
GB
usedPercent
:=
int
(
u
.
UsedPercent
)
fmt
.
Printf
(
"Free space: %dMB (%dGB) / %dMB (%dGB) | Used: %d%%
\n
"
,
usedMB
,
usedGB
,
totalMB
,
totalGB
,
usedPercent
)
}
//OS
func
OSCheck
()
{
fmt
.
Printf
(
"goOs:%s,compiler:%s,numCpu:%d,version:%s,numGoroutine:%d
\n
"
,
runtime
.
GOOS
,
runtime
.
Compiler
,
runtime
.
NumCPU
(),
runtime
.
Version
(),
runtime
.
NumGoroutine
())
}
//CPU 使用量
func
CPUCheck
()
{
cores
,
_
:=
cpu
.
Counts
(
false
)
cpus
,
err
:=
cpu
.
Percent
(
time
.
Duration
(
200
)
*
time
.
Millisecond
,
true
)
if
err
==
nil
{
for
i
,
c
:=
range
cpus
{
fmt
.
Printf
(
"cpu%d : %f%%
\n
"
,
i
,
c
)
}
}
a
,
_
:=
load
.
Avg
()
l1
:=
a
.
Load1
l5
:=
a
.
Load5
l15
:=
a
.
Load15
fmt
.
Println
(
l1
)
fmt
.
Println
(
l5
)
fmt
.
Println
(
l15
)
fmt
.
Println
(
cores
)
}
//内存使用量
func
RAMCheck
()
{
u
,
_
:=
mem
.
VirtualMemory
()
usedMB
:=
int
(
u
.
Used
)
/
MB
totalMB
:=
int
(
u
.
Total
)
/
MB
usedPercent
:=
int
(
u
.
UsedPercent
)
fmt
.
Printf
(
"usedMB:%d,totalMB:%d,usedPercent:%d"
,
usedMB
,
totalMB
,
usedPercent
)
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录