Skip to content

Commit

Permalink
upgrade to 1.3.8beta
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoBao committed Jan 25, 2024
1 parent 22c3ad4 commit 7e3f75b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- OSCHINA - http://www.oschina.net/p/nginx-balancer

## 更新(2024-01-23)
* 新增 Dashboard 页面 5 秒自动刷新所有数据
* 新增 [nginx-module-vts](https://github.com/vozlt/nginx-module-vts) 模块,实现更完善的流量监测能力
* 新增 Dashboard 页面 Nginx 启动时间显示
> API 中同步增加字段,单位为 ms,可以自行转换
Expand Down
6 changes: 3 additions & 3 deletions dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@

@login_required(login_url="/login/")
def view(request):
sysinfo = get_sys_info()
user = {
'name':request.user,
'date':time.time()
}
return render_to_response('dashboard/view.html',{'sysinfo' : sysinfo, 'user' : user})
return render_to_response('dashboard/view.html',{'user' : user})

@is_auth
def get_status_info(request):
Expand All @@ -23,7 +22,8 @@ def get_status_info(request):
'flag':"Success",
'context':{
"sysstatus" : get_sys_status(),
"reqstatus" : req_status
"reqstatus" : get_req_status(),
"sysinfo": get_sys_info()
}
}
return HttpResponse(json.dumps(context))
Expand Down
30 changes: 19 additions & 11 deletions templates/dashboard/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,23 @@ <h3 class="box-title">系统状态</h3>
<tbody>
<tr>
<td class="pull-right"><strong>Nginx 版本</strong></td>
<td>{{ sysinfo.nginx }} <span id="sp_nginx_status"></span> <span id="sp_nginx_config_status"></span><span id="sp_uptime"></span></td>
<td><span id="sp_info_nginx"></span> <span id="sp_nginx_status"></span> <span id="sp_nginx_config_status"></span><span id="sp_uptime"></span></td>
</tr>
<tr>
<td class="pull-right"><strong>主机名</strong></td>
<td>{{ sysinfo.platform.node }}</td>
<td><span id="sp_info_node"></span></td>
</tr>
<tr>
<td class="pull-right"><strong>操作系统</strong></td>
<td>{{ sysinfo.platform.system }} {{ sysinfo.platform.release }}</td>
<td><span id="sp_info_system"></span> <span id="sp_info_release"></span></td>
</tr>
<tr>
<td class="pull-right"><strong>系统架构</strong></td>
<td>{{ sysinfo.platform.processor }} </td>
<td><spam id="sp_info_processor"></span></td>
</tr>
<tr>
<td class="pull-right"><strong>网络信息</strong></td>
<td>
{% for nic in sysinfo.nic %}
<small>{{ nic.nic }}</small> {{ nic.address }} {% endfor %}
<td id="td_info_nic">
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -292,8 +290,8 @@ <h3 class="box-title">请求统计</h3>
}
}

function get_uptime() {
var uptime_ms = {{ sysinfo.platform.uptime }};
function get_uptime(uptime_ms) {
var uptime_ms = uptime_ms;
if (uptime_ms != 0 ) {
var seconds = Math.floor(uptime_ms/ 1000);
var minutes = Math.floor(seconds / 60);
Expand Down Expand Up @@ -342,6 +340,17 @@ <h3 class="box-title">请求统计</h3>
$('#sp_nginx_status').text('已停止')
}

get_uptime(p.context.sysinfo.platform.uptime)

$('#sp_info_nginx').text(p.context.sysinfo.nginx)
$('#sp_info_node').text(p.context.sysinfo.platform.node)
$('#sp_info_system').text(p.context.sysinfo.platform.system)
$('#sp_info_release').text(p.context.sysinfo.platform.release)
$('#sp_info_processor').text(p.context.sysinfo.platform.processor)
$('#td_info_nic').empty()
for (var f in p.context.sysinfo.nic) {
$('#td_info_nic').append("<small>" + p.context.sysinfo.nic[f].nic + "</small> " + p.context.sysinfo.nic[f].address + " ")
}

if (!p.context.sysstatus.nginx_config_status) {
$('#sp_nginx_config_status').removeClass()
Expand Down Expand Up @@ -394,7 +403,6 @@ <h3 class="box-title">请求统计</h3>
add_data(true, 0, 0, 0);
}
get_status_info()
get_uptime()
window.setInterval(get_status_info, 10000);
window.setInterval(get_status_info, 5000);
</script>
{% endblock %}

0 comments on commit 7e3f75b

Please sign in to comment.