|
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
|
|
<%@ 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>
|
|
|
<link rel="stylesheet" href="<%=basePath %>css/nginxview.css"/>
|
|
|
<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">nodeMonitor</a>
|
|
|
</div>
|
|
|
|
|
|
<div class="container-fluid">
|
|
|
<div class="widget-box">
|
|
|
<div class="widget-title">
|
|
|
<h5>node发布查询</h5>
|
|
|
</div>
|
|
|
<div class="widget-content nopadding">
|
|
|
<div class="widget-title" style="height: 53px;">
|
|
|
<div class="form-inline" role="form" id="inBoxQueryDiv"
|
|
|
style=" margin-top: 12px;margin-left: 25px;float: left;">
|
|
|
<div class="input-group" style="float: left;">
|
|
|
<span class="input-group-addon">项目:</span>
|
|
|
<select id="projectSelect" name="projectSelect" class="form-control"
|
|
|
onclick="changeProject()">
|
|
|
<c:forEach items="${projectList}" var="project">
|
|
|
<option value="${project.name}">${project.name}</option>
|
|
|
</c:forEach>
|
|
|
</select>
|
|
|
</div>
|
|
|
<div class="input-group" style="float: left;">
|
|
|
<span class="input-group-addon">云:</span>
|
|
|
<select id="cloudSelect" name="cloudSelect" class="form-control">
|
|
|
|
|
|
</select>
|
|
|
</div>
|
|
|
<button id="searchBtn" class="btn btn-primary" style="margin-left: 18px;"
|
|
|
onclick="search()">查询
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="container-fluid">
|
|
|
<div class="row-fluid" style="border:solid 1px #CDC9C9; padding: 10px">
|
|
|
<div class="span12">
|
|
|
<div class="section section-visible">
|
|
|
<div class="hider updatable" style="display:block;">
|
|
|
<div class="row row-stat" id="show_row">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</body>
|
|
|
<script src="<%=basePath %>script/common/genarate_left_panel.js"></script>
|
|
|
<script>
|
|
|
$("#li_monitor").addClass("active open");
|
|
|
$("#li_nodeMonitor").addClass("active");
|
|
|
</script>
|
|
|
<script>
|
|
|
|
|
|
$(function () {
|
|
|
changeProject();
|
|
|
});
|
|
|
|
|
|
|
|
|
function changeProject() {
|
|
|
var project = $("#projectSelect option:selected").val();
|
|
|
$.ajax({
|
|
|
url: contextPath + '/nodeMonitor/getProject?project=' + project,
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
success: function (data) {
|
|
|
$("#cloudSelect").empty();
|
|
|
var list = data.envs;
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
var env = list[i];
|
|
|
$("#cloudSelect").append("<option value='" + env.name + "'>" + env.name + "</option>");
|
|
|
}
|
|
|
},
|
|
|
error: function (e) {
|
|
|
alert("从后台获取数据出错");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function search() {
|
|
|
var project = $("#projectSelect option:selected").val();
|
|
|
var environment = $("#cloudSelect option:selected").val();
|
|
|
$.ajax({
|
|
|
url: contextPath + '/nodeMonitor/getIPS?project=' + project + "&environment=" + environment,
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
success: function (data) {
|
|
|
var list = data.host_ips;
|
|
|
var show_row = $("#show_row");
|
|
|
show_row.empty();
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
getInfo(show_row,list[i]);
|
|
|
}
|
|
|
},
|
|
|
error: function (e) {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
function getInfo(show_row,ip){
|
|
|
var project = $("#projectSelect option:selected").val();
|
|
|
$.ajax({
|
|
|
url: contextPath + '/nodeMonitor/getInfo?ip=' + ip,
|
|
|
type: 'POST',
|
|
|
dataType: 'json',
|
|
|
success: function (data) {
|
|
|
var resp = eval("(" + data + ")");
|
|
|
var processes = resp.processes;
|
|
|
var cpu_usg;
|
|
|
var free_mem;
|
|
|
var total = 0;
|
|
|
var online = 0;
|
|
|
processes.forEach(function (p) {
|
|
|
if (p.name === 'pm2-server-monit') {
|
|
|
var cpuUsg = p.pm2_env.axm_monitor['CPU usage'].value;
|
|
|
var freeMem = p.pm2_env.axm_monitor['Free memory'].value;
|
|
|
|
|
|
cpu_usg = cpuUsg;
|
|
|
free_mem = freeMem;
|
|
|
}
|
|
|
|
|
|
if (p.name == project) {
|
|
|
total++;
|
|
|
}
|
|
|
|
|
|
if ("online" == p.pm2_env.status) {
|
|
|
online++;
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
var col = $("<div class='col-md-4'\>");
|
|
|
col.appendTo(show_row);
|
|
|
|
|
|
var panel = $("<div >");
|
|
|
panel.addClass("panel panel-node-alt noborder")
|
|
|
col.append(panel);
|
|
|
|
|
|
var panel_head = $("<div class='panel-heading noborder'>")
|
|
|
panel.append(panel_head);
|
|
|
|
|
|
var panel_icon = $("<div class='panel-icon' style='background-image:url(\"" + contextPath + "img/cloud.png\"); width:60px;height:60px;' >");
|
|
|
panel_head.append(panel_icon);
|
|
|
|
|
|
var media_body = $("<div class='media-body'>");
|
|
|
panel_head.append(media_body);
|
|
|
var tile_info = $("<h1 class='mt5'>").html(ip);
|
|
|
media_body.append(tile_info);
|
|
|
|
|
|
var hr = $("<hr>");
|
|
|
panel_head.append(hr);
|
|
|
|
|
|
var server = $("<div>");
|
|
|
var server_key = $("<span>").html("主机状态 ");
|
|
|
server.append(server_key);
|
|
|
var server_value = $("<span class=\"label label-serstatus label-success\">").html("CPU:" + cpu_usg + ";可用内存:" + free_mem);
|
|
|
;
|
|
|
server.append(server_value);
|
|
|
panel_head.append(server);
|
|
|
|
|
|
var run = $("<div>");
|
|
|
var run_key = $("<span>").html("运行状态 ");
|
|
|
run.append(run_key);
|
|
|
var run_value = $("<span class=\"label label-serstatus label-success\">").html("线程数:" + total + ";online:" + online);
|
|
|
;
|
|
|
run.append(run_value);
|
|
|
panel_head.append(run);
|
|
|
|
|
|
},
|
|
|
error: function (e) {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
</script>
|
|
|
|
...
|
...
|
|