Authored by bblu

Merge branch 'master' into switch_conf

package com.ui.model.req;
import lombok.Data;
/**
* Created by yoho on 2016/10/21.
*/
@Data
public class CompareReq {
String service;
String net;
}
... ...
package com.ui.ctrl;
import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
import com.ui.model.req.CompareReq;
import com.ui.model.req.NginxSyncTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
/**
* Created by yoho on 2016/8/23.
*/
@RestController
@RequestMapping(value = "/compareIps")
public class CompareIpsCtrl {
@Autowired
HttpRestClient httpRestClient;
@RequestMapping("/toCompareIps")
public ModelAndView toCompareIpsView() {
return new ModelAndView("compare/compareIps");
}
@RequestMapping("/compare")
public BaseResponse pushTask(CompareReq req)
{
BaseResponse response = httpRestClient.defaultPost("/compareIps/compare", req, BaseResponse.class);
return response;
}
}
... ...
<%@ page import="org.aspectj.weaver.ast.Var" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=basePath %>css/bootstrap.min.css"/>
<link rel="stylesheet" href="<%=basePath %>css/bootstrap-datetimepicker.css"/>
<link href="<%=basePath %>js/bootstrap-plugin/css/bootstrap.table.css" rel="stylesheet" media="screen"/>
<link rel="stylesheet" href="<%=basePath %>css/bootstrap-responsive.min.css"/>
<link rel="stylesheet" href="<%=basePath %>css/fullcalendar.css"/>
<link rel="stylesheet" href="<%=basePath %>css/unicorn.main.css"/>
<link rel="stylesheet" href="<%=basePath %>css/unicorn.grey.css"/>
<link rel="stylesheet" href="<%=basePath %>css/jquery-ui.css"/>
<link rel="stylesheet" href="<%=basePath %>css/uniform.css"/>
<link rel="stylesheet" href="<%=basePath %>css/select2.css"/>
<link rel="stylesheet" href="<%=basePath %>js/jstree/themes/proton/style.css"/>
<link rel="stylesheet" href="<%=basePath %>css/select2.css"/>
<link rel="stylesheet" href="<%=basePath %>css/yoho.css"/>
<script src="<%=basePath %>js/excanvas.min.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/jquery-1.12.0.min.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/jquery-ui.custom.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>/js/bootstrap.min.js"></script>
<script src="<%=basePath %>/js/unicorn.js"></script>
<script src="<%=basePath %>js/bootstrap-plugin/datetimepicker/moment-with-locales.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/datetimepicker/bootstrap-datetimepicker.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/global.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.pagination.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.table.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.dialog.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.form.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.panel.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.alerts.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.accordion.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.breadcrumb.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.validate.js" charset="UTF-8"
type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.form.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/layer/layer.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/bootstrap-plugin/bootstrap.select.js" charset="UTF-8" type="text/javascript"></script>
<script src="<%=basePath %>js/jstree/jstree.min.js"></script>
<script src="<%=basePath %>js/jquery.toaster.js"></script>
<script type="text/javascript" src="<%=basePath %>js/echarts.simple.min.js"></script>
<script type="text/javascript" src="<%=basePath %>js/echarts.min.js"></script>
<script>
var contextPath = '<%=basePath %>';
</script>
<title>YOHO!运维</title>
</head>
<body>
<!-- 头部 -->
<div id="head">
</div>
<!-- 右侧具体内容 -->
<div id="content">
<div id="breadcrumb">
<a href="#" title="Go to Home" class="tip-bottom"><i
class="icon-home"></i> Home</a> <a
href="#" class="current">在线IP配置对比</a>
</div>
<div class="container-fluid">
<div class="widget-box">
<div class="widget-title">
<h5>在线IP配置对比</h5>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="col-md-6" style="width: 90%">
<div class="form-group">
<label class="col-sm-1 control-label">服务选择</label>
<div class="col-sm-8">
<select id="serviceSelect"
style="display: list-item; width: 100px; height: 30px">
<option value="1">nginx</option>
<option value="2">gateway</option>
<option value="3">bigdata</option>
<option value="4">message</option>
<option value="5">order</option>
<option value="6">product</option>
<option value="7">promotion</option>
<option value="8">resources</option>
<option value="9">sns</option>
<option value="10">users</option>
<option value="11">push</option>
<option value="12">uic</option>
<option value="13">platform</option>
</select>
</div>
</div>
</div>
<div class="col-md-6" style="width: 90%; margin-top: 20px">
<div class="form-group">
<label class="col-sm-1 control-label">范围选择</label>
<div class="col-sm-8">
<div class="rdio rdio-default">
<input type="radio" name="operate-1" value="qcloud_val" id="qcloud"
onclick="choseNet('qcloud')"/>
<label for="qcloud">腾讯云</label>
</div>
<div class="rdio rdio-default">
<input type="radio" name="operate-1" value="aws_val" id="aws"
onclick="choseNet('aws')"/>
<label for="aws">AWS</label>
</div>
</div>
</div>
</div>
<div class="col-md-6" style="width: 90%">
<div class="form-group">
<div class="col-sm-8" style="margin-bottom: 10px;margin-top: 10px">
<button id="exe_btn" class="btn btn-success btn-rounded"
onclick="btn_click()">对比
</button>
</div>
</div>
<div class="form-group" style="margin-top: 40px">
<div id="showIps" class="col-sm-8"></div>
</div>
</div><!-- col-md-6 -->
</div>
</div>
</div>
</div>
</div>
</body>
<script src="<%=basePath %>script/common/genarate_left_panel.js"></script>
<script>
$("#li_config").addClass("active open");
$("#li_ips_compare").addClass("active");
</script>
<script type="text/javascript">
var service;
var net;
function selectService() {
var obj = document.getElementById("serviceSelect"); //定位id
var index = obj.selectedIndex; // 选中索引
var text = obj.options[index].text; // 选中文本
service = text;
}
function choseNet(netName) {
net = netName;
}
function btn_click() {
selectService();
$.ajax({
url: getUrlBasePath() + "/compareIps/compare",
type: "post",
dataType: "json",
data: {
service: service,
net: net
},
success: function (response) {
showIps(response.data.ips);
if (1 == response.data.status) {
localAlert("告警","存在IP配置不一致,请仔细查看比对结果!");
}
},
error: function (e) {
localAlert("错误","查询比对失败,请稍后重试!");
}
});
}
function showIps(data) {
var showIpsArea = document.getElementById("showIps");
document.getElementById('showIps').innerHTML = '';
for (var i = 0; i < data.length; i++) {
var texrArea = $("<textarea rows='30' cols='120' style='width: 20%; height: 20%;margin-left: 10%; resize: none;' readonly='readonly'>");
texrArea.text(data[i]);
texrArea.appendTo(showIpsArea);
}
}
</script>
</html>
... ...
... ... @@ -11,7 +11,7 @@ innerHTML += "<div id='sidebar'><ul>";
innerHTML += "<li id='li_dashboard'><a id='li_dashboard_a' href=''><i class='icon icon-th'></i> <span>Dashboard</span></a></li>";
/*监控*/
innerHTML += "<li class='submenu' id='li_monitor'><a id='li_monitor_a' href='#'><i class='icon icon-th-list'></i> <span>监控</span><span class='label'>6</span></a><ul>";
innerHTML += "<li class='submenu' id='li_monitor'><a id='li_monitor_a' href='#'><i class='icon icon-th-list'></i> <span>监控</span><span class='label'>7</span></a><ul>";
innerHTML += "<li id='li_javaApi'><a id='li_javaApi_a' href=''><i class='icon icon-th'></i> <span>JAVA服务信息</span></a></li>";
innerHTML += "<li id='li_zkInfo'><a id='li_zkInfo_a' href=''><i class='icon icon-th'></i> <span>ZK监控</span></a></li>";
innerHTML += "<li id='li_rabbitview'><a id='li_rabbitview_a' href=''><i class='icon icon-th'></i> <span>Rabbitmq监控</span></a></li>";
... ... @@ -44,15 +44,16 @@ innerHTML += "<li id='li_works'><a id='li_works_a' href=''><i class='icon icon-t
innerHTML += "</ul></li>";
/*配置管理*/
innerHTML += "<li class='submenu' id='li_config'><a id='li_config_a' href='#'><i class='icon icon-th-list'></i> <span>配置管理</span><span class='label'>4</span></a><ul>";
innerHTML += "<li class='submenu' id='li_config'><a id='li_config_a' href='#'><i class='icon icon-th-list'></i> <span>配置管理</span><span class='label'>5</span></a><ul>";
innerHTML += "<li id='li_zkMonitor'><a id='li_zkMonitor_a' href=''><i class='icon icon-th'></i> <span>ZK配置管理</span></a></li>";
innerHTML += "<li id='li_nginxSync'><a id='li_nginxSync_a' href=''><i class='icon icon-th'></i> <span>Nginx配置同步</span></a></li>";
innerHTML += "<li id='li_degrade_info'><a id='li_degrade_info_a' href=''><i class='icon icon-th'></i> <span>降级服务配置</span></a></li>";
innerHTML += "<li id='li_aws_ebs'><a id='li_aws_ebs_a' href=''><i class='icon icon-th'></i> <span>AWS_EBS镜像任务</span></a></li>";
innerHTML += "<li id='li_ips_compare'><a id='li_ips_compare_a' href=''><i class='icon icon-th'></i> <span>在线服务Ip配置对比</span></a></li>";
innerHTML += "</ul></li>";
/*project*/
innerHTML += "<li class='submenu' id='li_project'><a id='li_project_a' href='#'><i class='icon icon-th-list'></i> <span>项目发布</span><span class='label'>4</span></a><ul>";
innerHTML += "<li class='submenu' id='li_project'><a id='li_project_a' href='#'><i class='icon icon-th-list'></i> <span>项目发布</span><span class='label'>5</span></a><ul>";
innerHTML += "<li id='li_projectRelease'><a id='li_projectRelease_a' href=''><i class='icon icon-th'></i> <span>项目发布</span></a></li>";
innerHTML += "<li id='li_om'><a id='li_om_a' href=''><i class='icon icon-th'></i> <span>OM发布</span></a></li>";
innerHTML += "<li id='li_om_new'><a id='li_om_new_a' href=''><i class='icon icon-th'></i> <span>OM_New发布</span></a></li>";
... ... @@ -119,6 +120,7 @@ document.getElementById("li_om_new_a").setAttribute("href", path + "/project/toN
document.getElementById("li_newRedisMonitor_a").setAttribute("href", path + "/redisMonitor/toNewRedis");
document.getElementById("li_memcachedMonitor_a").setAttribute("href", path + "/memcachedMonitor/toMemcached");
document.getElementById("li_javarestart_a").setAttribute("href", path + "/javaRestart/toJavaRestart");
document.getElementById("li_ips_compare_a").setAttribute("href", path + "/compareIps/toCompareIps");
function getUrlBasePath() {
var location = ( window.location + '').split('/');
... ...