<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%@include file="/common/common_css.jsp"%>
<%@include file="/common/common_js.jsp"%>
<title>开放平台监控系统</title>
</head>
<body>
<%@include file="../../menu/header.jsp"%>
<%@include file="../../menu/left.jsp"%>
<div class="control">
<div>
<ul class="breadcrumb">
<li style="font-size: large;"><a href="javascript:void(0)">异常监控策略列表</a>
</li>
</ul>
</div>
<div style="margin-top: 10px;">
<button type="button" class="btn" id="newAppBtn" οnclick="showAdd()">新建监控策略</button>
</div>
<div id="create_area" style="display: none">
<form class="form-horizontal" id="createForm">
<fieldset>
<input type="hidden" id="ruleId" value="">
<div class="control-group">
<label class="control-label">主机ip</label>
<div class="controls">
<input type="text" id="hostIp" size="64" class="span5">
</div>
</div>
<div class="control-group">
<label class="control-label">异常类型</label>
<div class="controls">
<input type="text" id="exceptionType" size="64" class="span5">
</div>
</div>
<div class="control-group">
<label class="control-label">异常内容(模糊匹配)</label>
<div class="controls">
<input type="text" id="content" size="64" class="span5">
</div>
</div>
<div class="control-group">
<label class="control-label">时间间隔(分钟)</label>
<div class="controls">
<input type="text" id="timeLag" size="64" class="span5">
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="button" class="btn" id="create" οnclick="add()">确定</button>
<button type="button" class="btn" id="cancel"
οnclick="cancelAdd()">取消</button>
</div>
</div>
</fieldset>
</form>
</div>
<div style="margin-top: 10px;">
<table class="table table-bordered table-striped">
<tr>
<th>主机ip</th>
<th>异常类型</th>
<th>异常内容</th>
<th>时间间隔</th>
<th>操作</th>
</tr>
<c:forEach var="result" items="${results}">
<tr id="${result.id}">
<c:choose>
<c:when test="${result.hostIp == null }">
<td>所有服务器</td>
</c:when>
<c:otherwise>
<td id="ip">${result.hostIp}</td>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${result.exceptionType == null }">
<td>所有异常</td>
</c:when>
<c:otherwise>
<td id="extype">${result.exceptionType}</td>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${result.content == null }">
<td>无</td>
</c:when>
<c:otherwise>
<td id="con">${result.content}</td>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${result.timeLag == null }">
<td>默认30分钟</td>
</c:when>
<c:otherwise>
<td id="lag">${result.timeLag}</td>
</c:otherwise>
</c:choose>
<td>
<a href="javascript:void(0);" οnclick="del('${result.id}')">删除</a> <a
href="javascript:void(0);" οnclick="update('${result.id}','${result.hostIp}','${result.exceptionType}','${result.content}','${result.timeLag}')">更新</a>
</td>
</tr>
</c:forEach>
</table>
</div>
</div>
</body>
<script type="text/javascript">
function update(id,hostIp,exceptionType,content,timeLag){
showAdd();
$('#hostIp').val(hostIp);
$('#exceptionType').val(exceptionType) ;
$('#content').val(content) ;
$('#timeLag').val(timeLag) ;
}
function del(key){
$.post("/monitor/rules/remove",{id:key},function (data){
if(data == 1){
alert("删除成功");
$('#'+key).remove();
}else{
alert("删除失败");
}
})
}
function showAdd(){
$('#create_area').css('display','block');
}
function cancelAdd(){
document.getElementById("createForm").reset();
$('#create_area').css('display','none');
}
function add(){
var id = $('#ruleId').val();
var hostIp = $('#hostIp').val();
var exceptionType = $('#exceptionType').val();
var content = $('#content').val();
var timeLag = $('#timeLag').val();
var params = {id:id,hostIp:hostIp,exceptionType:exceptionType,content:content,timeLag:timeLag};
$.post("/monitor/rules/update",params,function (data){
if(data == 1){
alert("添加成功");
location.reload();
}else{
alert("添加失败");
}
})
}
</script>
</html>
<%@ include file="/common/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%@include file="/common/common_css.jsp"%>
<%@include file="/common/common_js.jsp"%>
<title>开放平台监控系统</title>
</head>
<body>
<%@include file="../../menu/header.jsp"%>
<%@include file="../../menu/left.jsp"%>
<div class="control">
<div>
<ul class="breadcrumb">
<li style="font-size: large;"><a href="javascript:void(0)">异常监控策略列表</a>
</li>
</ul>
</div>
<div style="margin-top: 10px;">
<button type="button" class="btn" id="newAppBtn" οnclick="showAdd()">新建监控策略</button>
</div>
<div id="create_area" style="display: none">
<form class="form-horizontal" id="createForm">
<fieldset>
<input type="hidden" id="ruleId" value="">
<div class="control-group">
<label class="control-label">主机ip</label>
<div class="controls">
<input type="text" id="hostIp" size="64" class="span5">
</div>
</div>
<div class="control-group">
<label class="control-label">异常类型</label>
<div class="controls">
<input type="text" id="exceptionType" size="64" class="span5">
</div>
</div>
<div class="control-group">
<label class="control-label">异常内容(模糊匹配)</label>
<div class="controls">
<input type="text" id="content" size="64" class="span5">
</div>
</div>
<div class="control-group">
<label class="control-label">时间间隔(分钟)</label>
<div class="controls">
<input type="text" id="timeLag" size="64" class="span5">
</div>
</div>
<div class="control-group">
<div class="controls">
<button type="button" class="btn" id="create" οnclick="add()">确定</button>
<button type="button" class="btn" id="cancel"
οnclick="cancelAdd()">取消</button>
</div>
</div>
</fieldset>
</form>
</div>
<div style="margin-top: 10px;">
<table class="table table-bordered table-striped">
<tr>
<th>主机ip</th>
<th>异常类型</th>
<th>异常内容</th>
<th>时间间隔</th>
<th>操作</th>
</tr>
<c:forEach var="result" items="${results}">
<tr id="${result.id}">
<c:choose>
<c:when test="${result.hostIp == null }">
<td>所有服务器</td>
</c:when>
<c:otherwise>
<td id="ip">${result.hostIp}</td>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${result.exceptionType == null }">
<td>所有异常</td>
</c:when>
<c:otherwise>
<td id="extype">${result.exceptionType}</td>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${result.content == null }">
<td>无</td>
</c:when>
<c:otherwise>
<td id="con">${result.content}</td>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${result.timeLag == null }">
<td>默认30分钟</td>
</c:when>
<c:otherwise>
<td id="lag">${result.timeLag}</td>
</c:otherwise>
</c:choose>
<td>
<a href="javascript:void(0);" οnclick="del('${result.id}')">删除</a> <a
href="javascript:void(0);" οnclick="update('${result.id}','${result.hostIp}','${result.exceptionType}','${result.content}','${result.timeLag}')">更新</a>
</td>
</tr>
</c:forEach>
</table>
</div>
</div>
</body>
<script type="text/javascript">
function update(id,hostIp,exceptionType,content,timeLag){
showAdd();
//设置表单值
$('#hostIp').val(hostIp);
$('#exceptionType').val(exceptionType) ;
$('#content').val(content) ;
$('#timeLag').val(timeLag) ;
}
function del(key){
$.post("/monitor/rules/remove",{id:key},function (data){
if(data == 1){
alert("删除成功");
$('#'+key).remove();
}else{
alert("删除失败");
}
})
}
function showAdd(){
$('#create_area').css('display','block');
}
function cancelAdd(){
document.getElementById("createForm").reset();
$('#create_area').css('display','none');
}
function add(){
var id = $('#ruleId').val();
var hostIp = $('#hostIp').val();
var exceptionType = $('#exceptionType').val();
var content = $('#content').val();
var timeLag = $('#timeLag').val();
var params = {id:id,hostIp:hostIp,exceptionType:exceptionType,content:content,timeLag:timeLag};
$.post("/monitor/rules/update",params,function (data){
if(data == 1){
alert("添加成功");
location.reload();
}else{
alert("添加失败");
}
})
}
</script>
</html>