|
|
|
@ -40,7 +40,7 @@
|
|
|
|
|
<h5>实时在线用户</h5>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ibox-content">
|
|
|
|
|
<h1 class="no-margins"><a href="/jlog/log_list/online/"> <span id="online_users"></span></a></h1>
|
|
|
|
|
<h1 class="no-margins"><a href="/jlog/log_list/online/"> <span id="online_users">10</span></a></h1>
|
|
|
|
|
<div class="stat-percent font-bold text-navy">{{ percent_online_user }} <i class="fa fa-level-up"></i></div>
|
|
|
|
|
<small>Online user</small>
|
|
|
|
|
</div>
|
|
|
|
@ -54,7 +54,7 @@
|
|
|
|
|
<h5>已连接服务器</h5>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ibox-content">
|
|
|
|
|
<h1 class="no-margins"><a href="/jlog/log_list/online/"> <span id="online_hosts"></span></a></h1>
|
|
|
|
|
<h1 class="no-margins"><a href="/jlog/log_list/online/"> <span id="online_hosts">10</span></a></h1>
|
|
|
|
|
<div class="stat-percent font-bold text-danger">{{ percent_online_host }} <i class="fa fa-level-down"></i></div>
|
|
|
|
|
<small>Connected host</small>
|
|
|
|
|
</div>
|
|
|
|
@ -62,7 +62,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-lg-3 border-bottom white-bg dashboard-header" style="margin-left:15px;height: 346px">
|
|
|
|
|
<div class="col-sm-2 border-bottom white-bg dashboard-header" style="margin-left:15px;height: 346px">
|
|
|
|
|
<h2>活跃用户TOP5</h2>
|
|
|
|
|
<small>过去一周共有<span class="text-info">{{ week_users }}</span>位用户登录<span class="text-success">{{ week_hosts }}</span>次服务器.</small>
|
|
|
|
|
<ul class="list-group clear-list m-t">
|
|
|
|
@ -76,7 +76,32 @@
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-lg-9" id="top10" style="margin-left: -15px;height: 345px"></div>
|
|
|
|
|
<div class="col-sm-7" id="top10" style="margin-left: -15px;height: 346px;padding: 15px 0 15px 0;"></div>
|
|
|
|
|
<div class="col-lg-3 white-bg" id="top1" style="margin-left: -15px;height: 346px">
|
|
|
|
|
<div class="statistic-box">
|
|
|
|
|
<h4>
|
|
|
|
|
活跃用户资产占比
|
|
|
|
|
</h4>
|
|
|
|
|
<p>
|
|
|
|
|
以下图形分别描述一个月活跃用户和资产占所有用户主机的百分比
|
|
|
|
|
</p>
|
|
|
|
|
<div class="row text-center">
|
|
|
|
|
<div class="col-lg-6">
|
|
|
|
|
<div id="activeUser" style="width: 140px; height: 140px;">
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<h5>用户</h5>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-lg-6">
|
|
|
|
|
<div id="activeAsset" style="width: 140px; height: 140px;"></div>
|
|
|
|
|
<h5>主机</h5>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="m-t">
|
|
|
|
|
<small></small>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
@ -248,161 +273,176 @@
|
|
|
|
|
<!--</div>-->
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script src="/static/js/echarts/echarts.js"></script>
|
|
|
|
|
<script>
|
|
|
|
|
$(document).ready(function(){
|
|
|
|
|
$('#show').click(function(){
|
|
|
|
|
$('#show').css('display', 'none');
|
|
|
|
|
$('#more').css('display', 'block');
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
var cate = {{ li_str|safe }};
|
|
|
|
|
$(function () {
|
|
|
|
|
$('#top10').highcharts({
|
|
|
|
|
// chart: {
|
|
|
|
|
// type: 'column'
|
|
|
|
|
// },
|
|
|
|
|
title: {
|
|
|
|
|
text: '一周数据总览',
|
|
|
|
|
x: -20 //center
|
|
|
|
|
},
|
|
|
|
|
subtitle: {
|
|
|
|
|
text: 'Source: JumpServer',
|
|
|
|
|
x: -20
|
|
|
|
|
},
|
|
|
|
|
rangeSelector: {
|
|
|
|
|
allButtonsEnabled: true,
|
|
|
|
|
selected: 2
|
|
|
|
|
},
|
|
|
|
|
xAxis: {
|
|
|
|
|
type: 'datetime',
|
|
|
|
|
categories: cate
|
|
|
|
|
},
|
|
|
|
|
yAxis:{
|
|
|
|
|
min: 0,
|
|
|
|
|
title: {
|
|
|
|
|
text: ''
|
|
|
|
|
},
|
|
|
|
|
plotLines: [{
|
|
|
|
|
value: 0,
|
|
|
|
|
width: 1,
|
|
|
|
|
color: '#808080'
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
valueSuffix: '次'
|
|
|
|
|
},
|
|
|
|
|
navigation: {
|
|
|
|
|
buttonOptions: {
|
|
|
|
|
align: 'right'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{% for k,v in top_dic.items %}
|
|
|
|
|
{
|
|
|
|
|
name: '{{ k }}',
|
|
|
|
|
data: {{ v }}
|
|
|
|
|
},
|
|
|
|
|
{% endfor %}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#usertop10').highcharts({
|
|
|
|
|
title: {
|
|
|
|
|
text: '一周用户登录TOP10',
|
|
|
|
|
x: -20 //center
|
|
|
|
|
},
|
|
|
|
|
subtitle: {
|
|
|
|
|
text: 'Source: JumpServer',
|
|
|
|
|
x: -20
|
|
|
|
|
},
|
|
|
|
|
xAxis: {
|
|
|
|
|
type: 'datetime',
|
|
|
|
|
categories: cate
|
|
|
|
|
},
|
|
|
|
|
yAxis:{
|
|
|
|
|
min: 0,
|
|
|
|
|
title: {
|
|
|
|
|
text: '登录次数'
|
|
|
|
|
},
|
|
|
|
|
plotLines: [{
|
|
|
|
|
value: 0,
|
|
|
|
|
width: 1,
|
|
|
|
|
color: '#808080'
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
valueSuffix: '次'
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{% for k,v in user_dic.items %}
|
|
|
|
|
{
|
|
|
|
|
name: '{{ k }}',
|
|
|
|
|
data: {{ v }}
|
|
|
|
|
},
|
|
|
|
|
{% endfor %}
|
|
|
|
|
]
|
|
|
|
|
require.config({
|
|
|
|
|
paths: {
|
|
|
|
|
'echarts': '/static/js/echarts/chart',
|
|
|
|
|
'echarts/chart/line': '/static/js/echarts/chart/line',
|
|
|
|
|
'echarts/chart/pie': '/static/js/echarts/chart/pie'
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#hosttop10').highcharts({
|
|
|
|
|
title: {
|
|
|
|
|
text: '一周主机登录TOP10',
|
|
|
|
|
x: -20 //center
|
|
|
|
|
},
|
|
|
|
|
subtitle: {
|
|
|
|
|
text: 'Source: JumpServer',
|
|
|
|
|
x: -20
|
|
|
|
|
},
|
|
|
|
|
xAxis: {
|
|
|
|
|
type: 'datetime',
|
|
|
|
|
categories: cate
|
|
|
|
|
},
|
|
|
|
|
yAxis:{
|
|
|
|
|
min: 0,
|
|
|
|
|
title: {
|
|
|
|
|
text: '登录次数'
|
|
|
|
|
},
|
|
|
|
|
plotLines: [{
|
|
|
|
|
value: 0,
|
|
|
|
|
width: 1,
|
|
|
|
|
color: '#808080'
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
tooltip: {
|
|
|
|
|
valueSuffix: '次'
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{% for k,v in host_dic.items %}
|
|
|
|
|
{
|
|
|
|
|
name: '{{ k }}',
|
|
|
|
|
data: {{ v }}
|
|
|
|
|
require(
|
|
|
|
|
[
|
|
|
|
|
'echarts',
|
|
|
|
|
'echarts/chart/line'
|
|
|
|
|
],
|
|
|
|
|
function (ec) {
|
|
|
|
|
var top10Chart = ec.init(document.getElementById('top10'));
|
|
|
|
|
var option = {
|
|
|
|
|
title : {
|
|
|
|
|
text: '月数据总览',
|
|
|
|
|
subtext: '一个月内历史汇总',
|
|
|
|
|
x: 'center'
|
|
|
|
|
},
|
|
|
|
|
{% endfor %}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
tooltip : {
|
|
|
|
|
trigger: 'axis'
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: '#fff',
|
|
|
|
|
legend: {
|
|
|
|
|
data:['登陆次数', '活跃用户','活跃资产'],
|
|
|
|
|
y: 'bottom'
|
|
|
|
|
},
|
|
|
|
|
toolbox: {
|
|
|
|
|
show : false,
|
|
|
|
|
feature : {
|
|
|
|
|
{# mark : {show: true},#}
|
|
|
|
|
{# dataView : {show: true, readOnly: false},#}
|
|
|
|
|
magicType : {show: true, type: ['line', 'bar']}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
calculable : true,
|
|
|
|
|
xAxis : [
|
|
|
|
|
{
|
|
|
|
|
type : 'category',
|
|
|
|
|
boundaryGap : false,
|
|
|
|
|
data : {{ date_month | safe}}
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
yAxis : [
|
|
|
|
|
{
|
|
|
|
|
type : 'value'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
series : [
|
|
|
|
|
{
|
|
|
|
|
name:'登陆次数',
|
|
|
|
|
type:'line',
|
|
|
|
|
smooth:true,
|
|
|
|
|
itemStyle: {normal: {areaStyle: {type: 'default'}}},
|
|
|
|
|
data: {{ active_login_month | safe }}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name:'活跃用户',
|
|
|
|
|
type:'line',
|
|
|
|
|
smooth:true,
|
|
|
|
|
itemStyle: {normal: {areaStyle: {type: 'default'}}},
|
|
|
|
|
data: {{ active_user_month | safe }}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name:'活跃资产',
|
|
|
|
|
type:'line',
|
|
|
|
|
smooth:true,
|
|
|
|
|
itemStyle: {normal: {areaStyle: {type: 'default'}}},
|
|
|
|
|
data: {{ active_asset_month | safe }}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
function magic_number(value, id) {
|
|
|
|
|
var num = $("#"+id);
|
|
|
|
|
num.animate({count: value}, {
|
|
|
|
|
duration: 500,
|
|
|
|
|
step: function() {
|
|
|
|
|
num.text(String(parseInt(this.count)));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function update() {
|
|
|
|
|
$.getJSON('api/user/', function(data) {
|
|
|
|
|
var users = data.users;
|
|
|
|
|
var hosts = data.hosts;
|
|
|
|
|
magic_number(users, 'online_users');
|
|
|
|
|
magic_number(hosts, 'online_hosts')
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
top10Chart.setOption(option);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
setInterval(update, 5000); //5秒钟执行一次
|
|
|
|
|
update();
|
|
|
|
|
require(
|
|
|
|
|
[
|
|
|
|
|
'echarts',
|
|
|
|
|
'echarts/chart/pie'
|
|
|
|
|
],
|
|
|
|
|
function (ec) {
|
|
|
|
|
var auChart = ec.init(document.getElementById('activeUser'));
|
|
|
|
|
var aaChart = ec.init(document.getElementById('activeAsset'));
|
|
|
|
|
var option = {
|
|
|
|
|
tooltip : {
|
|
|
|
|
trigger: 'item',
|
|
|
|
|
formatter: "{b} <br> {c} ({d}%)"
|
|
|
|
|
},
|
|
|
|
|
legend: {
|
|
|
|
|
show: false,
|
|
|
|
|
orient : 'vertical',
|
|
|
|
|
x : 'left',
|
|
|
|
|
data:['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
|
|
|
|
|
},
|
|
|
|
|
toolbox: {
|
|
|
|
|
show : false,
|
|
|
|
|
feature : {
|
|
|
|
|
mark : {show: true},
|
|
|
|
|
dataView : {show: true, readOnly: false},
|
|
|
|
|
magicType : {
|
|
|
|
|
show: true,
|
|
|
|
|
type: ['pie', 'funnel'],
|
|
|
|
|
option: {
|
|
|
|
|
funnel: {
|
|
|
|
|
x: '25%',
|
|
|
|
|
width: '50%',
|
|
|
|
|
funnelAlign: 'center',
|
|
|
|
|
max: 1548
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
restore : {show: true},
|
|
|
|
|
saveAsImage : {show: true}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
calculable : true,
|
|
|
|
|
series : [
|
|
|
|
|
{
|
|
|
|
|
name:'访问来源',
|
|
|
|
|
type:'pie',
|
|
|
|
|
radius : ['50%', '70%'],
|
|
|
|
|
itemStyle : {
|
|
|
|
|
normal : {
|
|
|
|
|
label : {
|
|
|
|
|
show : false
|
|
|
|
|
},
|
|
|
|
|
labelLine : {
|
|
|
|
|
show : false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
emphasis : {
|
|
|
|
|
label : {
|
|
|
|
|
show : true,
|
|
|
|
|
position : 'center',
|
|
|
|
|
textStyle : {
|
|
|
|
|
fontSize : '5',
|
|
|
|
|
fontWeight : 'bold'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data:[
|
|
|
|
|
{value:335, name:'直接访问'},
|
|
|
|
|
{value:310, name:'邮件营销'},
|
|
|
|
|
{value:234, name:'联盟广告'},
|
|
|
|
|
{value:135, name:'视频广告'},
|
|
|
|
|
{value:1548, name:'搜索引擎'}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
auChart.setOption(option);
|
|
|
|
|
aaChart.setOption(option);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
{% endblock %}
|