<html>
<head>
<title>运维平台</title>
<link rel="stylesheet" type="text/css" href="/static/Css/Monitor/addmqmonitor.css">
<link rel="stylesheet" type="text/css" href="/static/Css/Public/header.css">
<link rel="stylesheet" type="text/css" href="/static/Css/Public/menu.css">
</head>
<body>
<include file="Public:header"/>
<div class="content">
<include file="Public:menu"/>
<div class="con fl">
<form id="condition" action="/addmqmonitor/" method="post">
<label class="condition">应用</label><input type="text" name="app" class="equipment_sz">
<label class="condition">队列管理器</label><input type="text" name="qmgr" class="equipment_sz">
<label class="condition">通道名称</label><input type="text" name="channel" class="equipment_sz">
<br />
<label class="condition">IPADDR</label><input type="text" name="ipaddr" class="equipment_sz">
<label class="condition">PORT</label><input type="text" name="port" class="equipment_sz">
<label class="condition">队列监控阈值</label><input type="text" name="depth" class="equipment_sz">
<label class="condition">是否监控</label><input type="text" name="flag" class="equipment_sz">
<br />
<input type="submit" value="设备添加" class="equipment_add_btn">
</form>
</div>
</div>
</body>
<script type="text/javascript" src="/static/Js/jquery-2.2.2.min.js"></script>
<!-- <script type="text/javascript" src="/static/Js/Equipment/addEquipment.js"></script> -->
</html>
def addmqmonitor(req):
print req.get_full_path()
app= req.POST['app']
qmgr= req.POST['qmgr']
channel= req.POST['channel']
ipaddr= req.POST['ipaddr']
port= req.POST['port']
depth= req.POST['depth']
flag= req.POST['flag']
conn= MySQLdb.connect(
host='127.0.0.1',
port = 3306,
user='root',
passwd='1234567',
db ='DEVOPS',
charset="UTF8"
)
cursor = conn.cursor()
sql = "insert into mon_mq(name,qmgr,channel,ipaddr,port,depth,flag) values('%s','%s','%s','%s','%s','%s','%s')" % (app,qmgr,channel,ipaddr,port,depth,flag)
cursor.execute(sql)
conn.commit()
a = cursor.execute("select name,qmgr,channel,ipaddr,port,flag from mon_mq" )
info = cursor.fetchall()
print info
print type(info)
return render(req,'listmqinfo.html',{'info':info})
[root@yyjk templates]#cat listmqinfo.html
<html>
<head>
<title>运维平台</title>
<link rel="stylesheet" type="text/css" href="/static/Css/Equipment/modifyBtn.css">
<link rel="stylesheet" type="text/css" href="/static/Css/Public/header.css">
<link rel="stylesheet" type="text/css" href="/static/Css/Public/menu.css">
</head>
<table border="10">
{% for x in info %}
<tr>
<th>{{x.0}}</th>
<th>{{x.1}}</th>
<td>{{x.2}}</td>
<td>{{x.3}}</td>
<td>{{x.4}}</td>
<td>{{x.5}}</td>
</tr>
{% endfor %}
</table>