mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-07 03:46:07 +08:00
增加资源占用提示
This commit is contained in:
parent
5530ce76e3
commit
c6624e9001
|
@ -119,24 +119,25 @@ handle_log_path() {
|
||||||
}
|
}
|
||||||
|
|
||||||
check_server() {
|
check_server() {
|
||||||
cpu_idle=$(top -b -n 1 | grep Cpu | awk '{print $8}' | cut -f 1 -d "%")
|
cpu_use=$(top -b -n 1 | grep Cpu | awk '{print $8}' | cut -f 1 -d "%")
|
||||||
eval echo -e "当前CPU占用 $cpu_use " $cmd
|
|
||||||
|
mem_free=$(free -m | grep "Mem" | awk '{print $3}')
|
||||||
|
mem_total=$(free -m | grep "Mem" | awk '{print $2}')
|
||||||
|
mem_use=$(printf "%d%%" $((mem_free * 100 / mem_total)) | cut -f 1 -d "%")
|
||||||
|
|
||||||
|
disk_use=$(df -P | grep /dev | grep -v -E '(tmp|boot|shm)' | awk '{print $5}' | cut -f 1 -d "%")
|
||||||
|
|
||||||
|
eval echo "当前CPU占用 $cpu_use% 内存占用 $mem_use% 磁盘占用 $disk_use% \\\n" $cmd
|
||||||
if [[ $cpu_use -gt $cpu_warn ]]; then
|
if [[ $cpu_use -gt $cpu_warn ]]; then
|
||||||
notify_api "CPU异常警告" "当前CPU占用 $cpu_use%"
|
notify_api "CPU异常警告" "当前CPU占用 $cpu_use%"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mem_free=$(free -m | grep "Mem" | awk '{print $3}')
|
|
||||||
mem_total=$(free -m | grep "Mem" | awk '{print $2}')
|
|
||||||
mem_use=$(printf "%d%%" $((mem_free * 100 / mem_total)) | cut -f 1 -d "%")
|
|
||||||
eval echo -e "内存剩余 $mem_use% " $cmd
|
|
||||||
if [[ $mem_free -lt $mem_warn ]]; then
|
if [[ $mem_free -lt $mem_warn ]]; then
|
||||||
notify_api "内存异常警告" "当前内存占用 $mem_use%"
|
notify_api "内存异常警告" "当前内存占用 $mem_use%"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
disk_use=$(df -P | grep /dev | grep -v -E '(tmp|boot|shm)' | awk '{print $5}' | cut -f 1 -d "%")
|
|
||||||
eval echo -e "磁盘占用 $disk_use% \\\n" $cmd
|
|
||||||
if [[ $disk_use -gt $disk_warn ]]; then
|
if [[ $disk_use -gt $disk_warn ]]; then
|
||||||
notify_api "磁盘异常警告" "当前磁盘占用 $disk_use%"
|
notify_api "磁盘异常警告" "当前磁盘占用 $disk_use%"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -102,6 +102,7 @@ const CheckUpdate = ({ socketMessage }: any) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const showUpdatingModal = () => {
|
const showUpdatingModal = () => {
|
||||||
|
setValue('');
|
||||||
modalRef.current = Modal.info({
|
modalRef.current = Modal.info({
|
||||||
width: 600,
|
width: 600,
|
||||||
maskClosable: false,
|
maskClosable: false,
|
||||||
|
@ -159,12 +160,13 @@ const CheckUpdate = ({ socketMessage }: any) => {
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
setValue(newMessage);
|
|
||||||
|
|
||||||
if (updateFailed) {
|
if (updateFailed && !value.includes('失败,请检查')) {
|
||||||
message.error('更新失败,请检查网络及日志或稍后再试');
|
message.error('更新失败,请检查网络及日志或稍后再试');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setValue(newMessage);
|
||||||
|
|
||||||
document.getElementById('log-identifier') &&
|
document.getElementById('log-identifier') &&
|
||||||
document
|
document
|
||||||
.getElementById('log-identifier')!
|
.getElementById('log-identifier')!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user