2015-02-11 09:53:17 +00:00
|
|
|
{% extends 'base.html' %}
|
|
|
|
{% block content %}
|
|
|
|
{% include 'nav_cat_bar.html' %}
|
|
|
|
|
|
|
|
<div class="wrapper wrapper-content">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-lg-3">
|
|
|
|
<div class="ibox float-e-margins">
|
|
|
|
<div class="ibox-title">
|
|
|
|
<span class="label label-success pull-right">Monthly</span>
|
|
|
|
<h5>用户总数</h5>
|
|
|
|
</div>
|
|
|
|
<div class="ibox-content">
|
2015-02-12 10:54:40 +00:00
|
|
|
<h1 class="no-margins"><a href="/juser/user_list/">{{ users.count}}</a></h1>
|
2015-02-11 09:53:17 +00:00
|
|
|
<div class="stat-percent font-bold text-success">98% <i class="fa fa-bolt"></i></div>
|
|
|
|
<small>All user</small>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-lg-3">
|
|
|
|
<div class="ibox float-e-margins">
|
|
|
|
<div class="ibox-title">
|
|
|
|
<span class="label label-info pull-right">Annual</span>
|
|
|
|
<h5>主机总数</h5>
|
|
|
|
</div>
|
|
|
|
<div class="ibox-content">
|
2015-02-12 10:54:40 +00:00
|
|
|
<h1 class="no-margins"><a href="/jasset/host_list/">{{ hosts.count }}</a></h1>
|
2015-02-11 09:53:17 +00:00
|
|
|
<div class="stat-percent font-bold text-info">20% <i class="fa fa-level-up"></i></div>
|
|
|
|
<small>All host</small>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-lg-3">
|
|
|
|
<div class="ibox float-e-margins">
|
|
|
|
<div class="ibox-title">
|
|
|
|
<span class="label label-primary pull-right">Today</span>
|
|
|
|
<h5>在线用户</h5>
|
|
|
|
</div>
|
|
|
|
<div class="ibox-content">
|
2015-02-12 10:54:40 +00:00
|
|
|
<h1 class="no-margins"><a href="/jlog/log_list/online/">{{ online_user.count }}</a></h1>
|
2015-02-11 09:53:17 +00:00
|
|
|
<div class="stat-percent font-bold text-navy">44% <i class="fa fa-level-up"></i></div>
|
|
|
|
<small>Online user</small>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-lg-3">
|
|
|
|
<div class="ibox float-e-margins">
|
|
|
|
<div class="ibox-title">
|
|
|
|
<span class="label label-danger pull-right">Low value</span>
|
|
|
|
<h5>已连接服务器</h5>
|
|
|
|
</div>
|
|
|
|
<div class="ibox-content">
|
2015-02-12 10:54:40 +00:00
|
|
|
<h1 class="no-margins"><a href="/jlog/log_list/online/">{{ online_host.count }}</a></h1>
|
2015-02-11 09:53:17 +00:00
|
|
|
<div class="stat-percent font-bold text-danger">38% <i class="fa fa-level-down"></i></div>
|
|
|
|
<small>Connect host</small>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-03-04 15:14:07 +00:00
|
|
|
<div id="usertop10" style="width:100%;height:400px;"></div>
|
|
|
|
<div id="hosttop10" style="width:100%;height:400px; margin-top:170px"></div>
|
2015-02-27 15:18:40 +00:00
|
|
|
</br>
|
2015-03-04 15:14:07 +00:00
|
|
|
<div id="dynamic" style="width:100%;height:400px;"></div>
|
2015-02-11 09:53:17 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2015-02-12 10:54:40 +00:00
|
|
|
<script>
|
2015-02-27 15:18:40 +00:00
|
|
|
var cate = {{ li_str|safe }};
|
2015-02-12 10:54:40 +00:00
|
|
|
$(function () {
|
2015-03-04 15:14:07 +00:00
|
|
|
$('#usertop10').highcharts({
|
2015-02-12 10:54:40 +00:00
|
|
|
title: {
|
|
|
|
text: '一周用户登录TOP10',
|
|
|
|
x: -20 //center
|
|
|
|
},
|
|
|
|
subtitle: {
|
|
|
|
text: 'Source: JumpServer',
|
|
|
|
x: -20
|
|
|
|
},
|
|
|
|
xAxis: {
|
2015-02-27 10:48:24 +00:00
|
|
|
type: 'datetime',
|
|
|
|
categories: cate
|
2015-02-12 10:54:40 +00:00
|
|
|
},
|
2015-02-27 15:18:40 +00:00
|
|
|
yAxis:{
|
|
|
|
min: 0,
|
2015-02-12 10:54:40 +00:00
|
|
|
title: {
|
2015-02-26 10:02:39 +00:00
|
|
|
text: '登录次数'
|
2015-02-12 10:54:40 +00:00
|
|
|
},
|
|
|
|
plotLines: [{
|
|
|
|
value: 0,
|
|
|
|
width: 1,
|
|
|
|
color: '#808080'
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
tooltip: {
|
|
|
|
valueSuffix: '次'
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
layout: 'vertical',
|
|
|
|
align: 'right',
|
|
|
|
verticalAlign: 'middle',
|
|
|
|
borderWidth: 0
|
|
|
|
},
|
2015-02-26 10:02:39 +00:00
|
|
|
series: [
|
2015-03-04 15:14:07 +00:00
|
|
|
{% for k,v in user_dic.items %}
|
2015-03-01 04:09:33 +00:00
|
|
|
{
|
|
|
|
name: '{{ k }}',
|
|
|
|
data: {{ v }}
|
|
|
|
},
|
2015-02-26 10:02:39 +00:00
|
|
|
{% endfor %}
|
|
|
|
]
|
2015-02-12 10:54:40 +00:00
|
|
|
});
|
2015-02-27 15:18:40 +00:00
|
|
|
|
2015-03-04 15:14:07 +00:00
|
|
|
$('#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: '次'
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
layout: 'vertical',
|
|
|
|
align: 'right',
|
|
|
|
verticalAlign: 'middle',
|
|
|
|
borderWidth: 0
|
|
|
|
},
|
|
|
|
series: [
|
|
|
|
{% for k,v in host_dic.items %}
|
|
|
|
{
|
|
|
|
name: '{{ k }}',
|
|
|
|
data: {{ v }}
|
|
|
|
},
|
|
|
|
{% endfor %}
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-02-27 15:18:40 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
Highcharts.setOptions({
|
|
|
|
global: {
|
|
|
|
useUTC: false
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var chart;
|
|
|
|
$('#dynamic').highcharts({
|
|
|
|
chart: {
|
|
|
|
type: 'spline',
|
|
|
|
animation: Highcharts.svg, // don't animate in old IE
|
|
|
|
marginRight: 10,
|
|
|
|
events: {
|
2015-03-01 04:09:33 +00:00
|
|
|
load: function () {
|
2015-02-27 15:18:40 +00:00
|
|
|
var series = this.series[0];
|
2015-03-01 04:09:33 +00:00
|
|
|
setInterval(function () {
|
|
|
|
jQuery.getJSON('api/user/', function (data) {
|
|
|
|
var users = data.users;
|
|
|
|
var x = (new Date()).getTime(), // current time
|
|
|
|
y = users;
|
|
|
|
console.log(users)
|
|
|
|
series.addPoint([x, y], true, true);
|
|
|
|
});
|
|
|
|
}, 3000);
|
2015-02-27 15:18:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
title: {
|
2015-03-01 04:09:33 +00:00
|
|
|
text: '实时在线用户统计'
|
2015-02-27 15:18:40 +00:00
|
|
|
},
|
|
|
|
xAxis: {
|
|
|
|
type: 'datetime',
|
|
|
|
tickPixelInterval: 150
|
|
|
|
},
|
|
|
|
yAxis: {
|
2015-03-01 04:09:33 +00:00
|
|
|
min: 0,
|
2015-02-27 15:18:40 +00:00
|
|
|
title: {
|
2015-03-01 04:09:33 +00:00
|
|
|
text: '用户数量'
|
2015-02-27 15:18:40 +00:00
|
|
|
},
|
|
|
|
plotLines: [{
|
|
|
|
value: 0,
|
|
|
|
width: 1,
|
|
|
|
color: '#808080'
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
tooltip: {
|
|
|
|
formatter: function() {
|
|
|
|
return '<b>'+ this.series.name +'</b><br/>'+
|
|
|
|
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+
|
2015-03-01 04:09:33 +00:00
|
|
|
Highcharts.numberFormat(this.y);
|
2015-02-27 15:18:40 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
enabled: false
|
|
|
|
},
|
|
|
|
exporting: {
|
|
|
|
enabled: false
|
|
|
|
},
|
|
|
|
series: [{
|
2015-03-01 04:09:33 +00:00
|
|
|
name: '实时在线用户数量',
|
2015-02-27 15:18:40 +00:00
|
|
|
data: (function() {
|
|
|
|
// generate an array of random data
|
|
|
|
var data = [],
|
|
|
|
time = (new Date()).getTime(),
|
|
|
|
i;
|
|
|
|
|
|
|
|
for (i = -19; i <= 0; i++) {
|
|
|
|
data.push({
|
|
|
|
x: time + i * 1000,
|
2015-03-01 04:09:33 +00:00
|
|
|
y: 0
|
2015-02-27 15:18:40 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
return data;
|
|
|
|
})()
|
|
|
|
}]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2015-02-12 10:54:40 +00:00
|
|
|
});
|
|
|
|
</script>
|
2015-02-11 09:53:17 +00:00
|
|
|
|
|
|
|
{% endblock %}
|