mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-04-25 21:55:31 +08:00
feat: 目录及代码优化调整
This commit is contained in:
13
devops/machine/shell/monitor.sh
Normal file
13
devops/machine/shell/monitor.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# 获取监控信息
|
||||
function get_monitor_info() {
|
||||
cpu_rate=$(cat /proc/stat | awk '/cpu/{printf("%.2f%\n"), ($2+$4)*100/($2+$4+$5)}' | awk '{print $0}' | head -1)
|
||||
mem_rate=$(free -m | sed -n '2p' | awk '{print""($3/$2)*100"%"}')
|
||||
sys_load=$(uptime | cut -d: -f5)
|
||||
cat <<EOF | column -t
|
||||
cpuRate:${cpu_rate},memRate:${mem_rate},sysLoad:${sys_load}
|
||||
EOF
|
||||
}
|
||||
|
||||
get_monitor_info
|
||||
Reference in New Issue
Block a user