예제 #1
0
def add_backup(info):
    result_info = check_backup_parameters(info)
    if (result_info.flag == 1):
        info.host_name = cache.Cache().get_host_info(int(
            info.backup_host_id)).remark
        backup_infos[info.backup_host_id] = info
        result_info.message = "add backup task success."
    return json.loads(result_info)
예제 #2
0
def get_mysql_processlist(host_id):
    return render_template(
        "show_processlist.html",
        processlist_infos=mysql_manager.get_show_processlist_infos(host_id),
        host_info=cache.Cache().get_host_info(host_id))
예제 #3
0
def get_binlog():
    return render_template("binlog.html",
                           host_infos=cache.Cache().get_all_host_infos())
예제 #4
0
def get_mysql_host_infos():
    return render_template("mysql_host_view.html",
                           mysql_host_infos=cache.Cache().get_all_host_infos())
예제 #5
0
def get_chart_home(host_id):
    return render_template("chart_auto.html",
                           host_info=cache.Cache().get_host_info(host_id))
예제 #6
0
def open_new_chart_page(host_id):
    return render_template("chart_mysql.html",
                           host_info=cache.Cache().get_host_info(host_id))
예제 #7
0
from monitor import cache, server, mysql_manager, tablespace, chart, common, binlog_util

# region load data on run

reload(sys)
sys.setdefaultencoding("UTF-8")

app = Flask("mysql_web")
app.secret_key = os.urandom(24)
app.config["SECRET_KEY"] = os.urandom(24)
login_manager = LoginManager()
login_manager.session_protection = "strong"
login_manager.login_view = "login_home"
login_manager.init_app(app=app)

mysql_cache = cache.Cache()
mysql_cache.load_all_host_infos()
monitor_server = server.MonitorServer()
monitor_server.load()
monitor_server.start()
#monitor_server.invoke_check_tablespace_method()

# endregion

# region mysql api


@app.route("/mysql", methods=['GET', 'POST'])
@login_required
def get_mysql_data():
    return gzip_compress(