Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

监控开启设置修复 #648

Merged
merged 5 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions scripts/init.d/mw.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -447,17 +447,17 @@ mw_connect_mysql(){
${ROOT_PATH}/mariadb/bin/mariadb -S ${ROOT_PATH}/mariadb/mysql.sock -uroot -p"${pwd}"
fi

if [ "$CHOICE_DB" == "mysql-community" ];then
${ROOT_PATH}/mysql-community/bin/mysql -S ${ROOT_PATH}/mysql-community/mysql.sock -uroot -p"${pwd}"
fi

if [ "$CHOICE_DB" == "mysql-apt" ];then
${ROOT_PATH}/mysql-apt/bin/usr/bin/mysql -S ${ROOT_PATH}/mysql-apt/mysql.sock -uroot -p"${pwd}"
fi

if [ "$CHOICE_DB" == "mysql-yum" ];then
${ROOT_PATH}/mysql-yum/bin/usr/bin/mysql -S ${ROOT_PATH}/mysql-yum/mysql.sock -uroot -p"${pwd}"
fi

if [ "$CHOICE_DB" == "mysql-community" ];then
${ROOT_PATH}/mysql-community/bin/mysql -S ${ROOT_PATH}/mysql-community/mysql.sock -uroot -p"${pwd}"
fi
}


Expand Down Expand Up @@ -544,6 +544,19 @@ mw_clean_lib(){
cd ${PANEL_DIR} && rm -rf include
}

mw_list(){
echo -e "mw default - 显示面板默认信息"
echo -e "mw db - 连接MySQL"
echo -e "mw pgdb - 连接PostgreSQL"
echo -e "mw mongdb - 连接MongoDB"
echo -e "mw redis - 连接Redis"
echo -e "mw valkey - 连接WalKey"
echo -e "mw update - 更新到正式环境最新代码"
echo -e "mw update_dev - 更新到测试环境最新代码"
echo -e "mw debug - 调式开发面板"
echo -e "mw list - 显示命令列表"
}

mw_default(){
cd ${PANEL_DIR}
port=7200
Expand Down Expand Up @@ -644,6 +657,7 @@ case "$1" in
'mongodb') mw_mongodb;;
'venv') mw_update_venv;;
'clean_lib') mw_clean_lib;;
'list') mw_list;;
'default') mw_default;;
*)
cd ${PANEL_DIR} && python3 ${PANEL_DIR}/panel_tools.py cli $1
Expand Down
18 changes: 13 additions & 5 deletions web/admin/system/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,29 @@ def set_control():
stype = request.form.get('type', '')
day = request.form.get('day', '')



if stype == '0':
_day = int(day)
if _day < 1:
return mw.returnData(False, "保存天数异常!")
thisdb.setOption('monitor_day', day, type='monitor')
thisdb.setOption('monitor_status', 'close', type='monitor')
return mw.returnData(True, "设置成功!")
return mw.returnData(True, "关闭监控成功!")
elif stype == '1':
_day = int(day)
if _day < 1:
return mw.returnData(False, "设置失败!")
return mw.returnData(False, "保存天数异常!")

thisdb.setOption('monitor_day', day, type='monitor')
return mw.returnData(True, "设置成功!")
thisdb.setOption('monitor_status', 'open', type='monitor')
return mw.returnData(True, "开启监控成功!")
elif stype == '2':
thisdb.setOption('monitor_only_netio', 'close', type='monitor')
return mw.returnData(True, "设置成功!")
return mw.returnData(True, "关闭仅统计外网成功!")
elif stype == '3':
thisdb.setOption('monitor_only_netio', 'open', type='monitor')
return mw.returnData(True, "设置成功!")
return mw.returnData(True, "开启仅统计外网成功!")
elif stype == 'del':
if not mw.isRestart():
return mw.returnData(False, '请等待所有安装任务完成再执行')
Expand Down
Loading