示例#1
0
def sqlcontentupdate(req):
    if not req.session.get("sess_userid", False):
        return HttpResponseRedirect("/login/")
    else:
        nUrldata = req.path
        nRightUserid = req.session["sess_userid"]
        nHaveRight = Right.userrightcheck(nRightUserid, nUrldata)
        if nHaveRight[0]["num"] == 0:
            return HttpResponseRedirect("/noright/")
        else:
            if req.method == 'GET':
                nTaskid = req.GET['taskid']
                datalist = MysqlIncedata.sqlcontentinfo(nTaskid)
                nRightUserid = req.session["sess_userid"]
                nUserRole = req.session["sess_userrole"]
                mysqllist = MysqlIncedata.mysqllist(nUserRole, nRightUserid)
                return render_to_response('mysqlincedata/mysql-sqlcontentupdate.html', {'data': datalist ,'mysqldata': mysqllist})
            else:
                nTaskid = req.POST.get('taskid')
                nDbid = req.POST.get('dbid')
                nSqlcontent = req.POST.get('sqlcontent')
                MysqlIncedata.sqlcontentupdate(nTaskid, nDbid, nSqlcontent)


                return HttpResponseRedirect('/mysql/tobeexecutemysqltask/')
示例#2
0
def mysqlgraphinfo(req):
    if not req.session.get("sess_userid", False):
        return HttpResponseRedirect("/login/")
    else:
        nUrldata = req.path
        nRightUserid = req.session["sess_userid"]
        nHaveRight = Right.userrightcheck(nRightUserid, nUrldata)
        if nHaveRight[0]["num"] == 0:
            return HttpResponseRedirect("/noright/")
        else:
            if req.method == 'GET':
                nDbid = int(req.GET['dbid'])
                nEndtime = datetime.datetime.now().strftime(
                    "%Y-%m-%d %H:%M:%S")
                nBegintime = time.strftime(
                    "%Y-%m-%d %H:%M:%S",
                    time.localtime(time.time() - 24 * 60 * 60))
                datalist = Mmonitor.mysqllist()
                dataredisinfo = Mmonitor.mysqlinfo(nDbid)
                datamysqlqps = Mmonitor.mysqldatagrephqps(
                    nDbid, nBegintime, nEndtime)
                datagrephvieprocessllist = Mmonitor.datagrephvieprocessllist(
                    nDbid, nBegintime, nEndtime)

                return render_to_response(
                    'monitor/mysql-graph-info.html', {
                        'data': datalist,
                        'datas': datamysqlqps,
                        'num5': nBegintime,
                        'num6': nEndtime,
                        'datamen': datagrephviewmen,
                        'dataprocesslist': datagrephvieprocessllist
                    })
            else:
                nDbid = req.POST.get('dbid')
                nEndtime = req.POST.get('endtime')
                nBegintime = req.POST.get('begintime')
                datalist = MysqlIncedata.mysqllist()
                datamysqlqps = MysqlIncedata.mysqlinfo(nDbid)
                datagrephviewmen = Mmonitor.mysqldatagrephqps(
                    nDbid, nBegintime, nEndtime)
                datagrephvieprocessllist = Mmonitor.datagrephvieprocessllist(
                    nDbid, nBegintime, nEndtime)

                return render_to_response(
                    'monitor/mysql-graph-info.html', {
                        'data': datalist,
                        'datas': datamysqlqps,
                        'num5': nBegintime,
                        'num6': nEndtime,
                        'datamen': datagrephviewmen,
                        'dataprocesslist': datagrephvieprocessllist
                    })
示例#3
0
def sqltaskdelete(req):
    if not req.session.get("sess_userid", False):
        return HttpResponseRedirect("/login/")
    else:
        nUrldata = req.path
        nRightUserid = req.session["sess_userid"]
        nHaveRight = Right.userrightcheck(nRightUserid, nUrldata)
        if nHaveRight[0]["num"] == 0:
            return HttpResponseRedirect("/noright/")
        else:
            nTaskid = req.GET['taskid']
            MysqlIncedata.sqltaskdelete(nTaskid)
            return HttpResponseRedirect("/mysql/tobeexecutemysqltask/")
示例#4
0
def mysqllist(req):
    if not req.session.get("sess_userid", False):
        return HttpResponseRedirect("/login/")
    else:
        nUrldata = req.path
        nRightUserid = req.session["sess_userid"]
        nUserRole = req.session["sess_userrole"]
        nHaveRight = Right.userrightcheck(nRightUserid, nUrldata)
        if nHaveRight[0]["num"] == 0:
            return HttpResponseRedirect("/noright/")
        else:
            datalist = MysqlIncedata.mysqllist(nUserRole, nRightUserid)
            rowdata = MysqlIncedata.gettastnum(nUserRole, nRightUserid)
            return render_to_response('mysqlincedata/mysql-list.html', {'data': datalist, 'nums': rowdata})
def sqlauditingadd(req):
    if not req.session.get("sess_userid", False):
        return HttpResponseRedirect("/login/")
    else:
        nUrldata = req.path
        nRightUserid = req.session["sess_userid"]
        nUserRole = req.session["sess_userrole"]
        nHaveRight = Right.userrightcheck(nRightUserid, nUrldata)
        if nHaveRight[0]["num"] == 0:
            return HttpResponseRedirect("/noright/")
        else:
            if req.method == 'GET':
                nRightUserid = req.session["sess_userid"]
                nUserRole = req.session["sess_userrole"]
                datalist = MysqlIncedata.mysqllist(nUserRole, nRightUserid)
                return render_to_response(
                    'mysqlsqladvisor/mysql-sqlauditingadd.html',
                    {'data': datalist})
            else:
                nUserid = req.session["sess_userid"]
                nDbid = req.POST.get('dbid')
                nSqlcontent = req.POST.get('sqlcontent')
                MysqlAdvisor.sqladvisor(nDbid, nSqlcontent, nUserid)

                return HttpResponseRedirect('/mysqlindex/sqlauditinglist/')
示例#6
0
def sqlcheckresult(req):
    if not req.session.get("sess_userid", False):
        return HttpResponseRedirect("/login/")
    else:
        nUrldata = req.path
        nRightUserid = req.session["sess_userid"]
        nHaveRight = Right.userrightcheck(nRightUserid, nUrldata)
        if nHaveRight[0]["num"] == 0:
            return HttpResponseRedirect("/noright/")
        else:
            nTaskid = req.GET['taskid']
            datalist = MysqlIncedata.sqlcheckresult(nTaskid)
            return render_to_response('mysqlincedata/mysql-sqlcheckresult.html', {'data': datalist})
示例#7
0
def tobeexecutemysqltask(req):
    if not req.session.get("sess_userid", False):
        return HttpResponseRedirect("/login/")
    else:
        nUrldata = req.path
        nRightUserid = req.session["sess_userid"]
        nHaveRight = Right.userrightcheck(nRightUserid, nUrldata)
        if nHaveRight[0]["num"] == 0:
            return HttpResponseRedirect("/noright/")
        else:
            nRightUserid = req.session["sess_userid"]
            nUserRole = req.session["sess_userrole"]
            datalist = MysqlIncedata.tobeexecutemysqltask(nUserRole, nRightUserid)
            return render_to_response('mysqlincedata/mysql-tobeexecute.html', {'data': datalist})
示例#8
0
def sqlresultselect(req):
    if not req.session.get("sess_userid", False):
        return HttpResponseRedirect("/login/")
    else:
        nUrldata = req.path
        nRightUserid = req.session["sess_userid"]
        nHaveRight = Right.userrightcheck(nRightUserid, nUrldata)
        if nHaveRight[0]["num"] == 0:
            return HttpResponseRedirect("/noright/")
        else:
            if req.method == 'GET':
                datalist = ''
                return render_to_response('mysqlincedata/mysql-resultselect.html', {'data': datalist})
            else:
                nContentinfo = req.POST.get('contentinfo')
                nSelectDate = req.POST.get('selecttime')
                print nContentinfo,nSelectDate


                datalist = MysqlIncedata.sqlresultselect(nContentinfo, nSelectDate)
                return render_to_response('mysqlincedata/mysql-resultselect.html', {'data': datalist, 'num1':nSelectDate, 'num2':nContentinfo})