Skip to content

Commit

Permalink
monitor 系统监控模块echeats Y轴座标颜色及时间调整
Browse files Browse the repository at this point in the history
  • Loading branch information
guohongze committed Jun 17, 2017
1 parent 3b2de2e commit 5289b29
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
4 changes: 2 additions & 2 deletions monitor/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

urlpatterns = [
url(r'^system/$', views.index, name='monitor'),
url(r'^system/(?P<hostname>\w+)/$', views.host_info, name='host_info'),
url(r'^get/data/(?P<hostname>\w+)/$', views.get_sys_data, name='get_sys_data'),
url(r'^system/(?P<hostname>.+)/$', views.host_info, name='host_info'),
url(r'^get/data/(?P<hostname>.+)/$', views.get_sys_data, name='get_sys_data'),
]
2 changes: 1 addition & 1 deletion monitor/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_sys_data(request, hostname):
unix_time = doc['timestamp']
if unix_time >= now-3600:
times = time.localtime(unix_time)
dt = time.strftime("%m%d-%H:%M:%S", times)
dt = time.strftime("%m%d-%H:%M", times)
# get cpu data
c_percent = doc['cpu']['percent']
cpu_percent.append(c_percent)
Expand Down
23 changes: 16 additions & 7 deletions templates/monitor/host_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<h3 class="box-title">{{ hostname }} 监控信息</h3>
</div>
<div class="box-body">
<div id="cpu" style="width: 850px;height:300px;"></div>
<div id="memory" style="width: 850px;height:300px;"></div>
<div id="cpu" style="width: 900px;height:300px;"></div>
<div id="memory" style="width: 900px;height:300px;"></div>

</div>
<!-- /.row -->
Expand Down Expand Up @@ -70,7 +70,8 @@ <h3 class="box-title">{{ hostname }} 监控信息</h3>
type : 'value',
axisLabel : {
formatter : '{value} %'
}
},
max: 100,
}],
series: [{
boundaryGap: false,
Expand All @@ -83,7 +84,6 @@ <h3 class="box-title">{{ hostname }} 监控信息</h3>
normal: {
}
},
max: 100,
data: data.cpu_percent
}
]
Expand All @@ -103,7 +103,9 @@ <h3 class="box-title">{{ hostname }} 监控信息</h3>
title: {
text: '内存使用率'
},
tooltip: {},
tooltip: {
trigger: 'axis'
},
toolbox: {
feature: {
dataZoom: {
Expand All @@ -124,15 +126,22 @@ <h3 class="box-title">{{ hostname }} 监控信息</h3>
type : 'value',
axisLabel : {
formatter : '{value} %'
}
},
max: 100
}],
series: [{
boundaryGap: [0, '0%'],
name: 'Memory',
smooth:true,
type: 'line',
areaStyle: {
normal: {
color: '#00a65a'
}
},
data: data.memory_percent
}]
}
]
});
});
}, 2000);
Expand Down

0 comments on commit 5289b29

Please sign in to comment.