|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <nginx.h>
|
|
|
|
|
#include "ngx_http_upstream_check_module.h"
|
|
|
|
|
|
|
|
|
@ -2854,28 +2853,154 @@ ngx_http_upstream_check_status_html_format(ngx_buf_t *b,
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b->last = ngx_snprintf(b->last, b->end - b->last,
|
|
|
|
|
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\n"
|
|
|
|
|
"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
|
|
|
|
|
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
|
|
|
|
|
"<head>\n"
|
|
|
|
|
" <title>Nginx http upstream check status</title>\n"
|
|
|
|
|
"</head>\n"
|
|
|
|
|
"<body>\n"
|
|
|
|
|
"<h1>Nginx http upstream check status</h1>\n"
|
|
|
|
|
"<h2>Check upstream server number: %ui, generation: %ui</h2>\n"
|
|
|
|
|
"<table style=\"background-color:white\" cellspacing=\"0\" "
|
|
|
|
|
" cellpadding=\"3\" border=\"1\">\n"
|
|
|
|
|
" <tr bgcolor=\"#C0C0C0\">\n"
|
|
|
|
|
" <th>Index</th>\n"
|
|
|
|
|
" <th>Upstream</th>\n"
|
|
|
|
|
" <th>Name</th>\n"
|
|
|
|
|
" <th>Status</th>\n"
|
|
|
|
|
" <th>Rise counts</th>\n"
|
|
|
|
|
" <th>Fall counts</th>\n"
|
|
|
|
|
" <th>Check type</th>\n"
|
|
|
|
|
" <th>Check port</th>\n"
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
b->last = ngx_snprintf(b->last, b->end - b->last,
|
|
|
|
|
"<!DOCTYPE html>"
|
|
|
|
|
"<html lang=\"en\">"
|
|
|
|
|
"<head>"
|
|
|
|
|
"<meta charset=\"UTF-8\">"
|
|
|
|
|
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">"
|
|
|
|
|
"<title>\"Title\"</title>"
|
|
|
|
|
"</head>"
|
|
|
|
|
"<style>"
|
|
|
|
|
".mainbody{position: absolute;left: 190px;}"
|
|
|
|
|
".wrap{width: 260px;height: 100%;background-color: #dce0e9;position: fixed;}"
|
|
|
|
|
".header{width: 100%;height: 65px;background-color: #adadad;font-size: 24px;color: #fff;text-align: center;line-height: 65px;}"
|
|
|
|
|
".nav{width:250px;margin: 10px 5px 0;}"
|
|
|
|
|
".list{margin-bottom: 5px;}"
|
|
|
|
|
".list h2{position: relative;padding: 15px 0;background-color: #3889d4;text-align: center;font-size: 16px;color: #fff;transition: .5s;}"
|
|
|
|
|
".list h2.on{background-color: #393c4a;}"
|
|
|
|
|
".list i{position: absolute;right: 10px;top: 16px;border: 8px solid transparent;border-left-color: #fff;transform:rotate(0deg);transform-origin: 1px 8px;transition: .5s;}"
|
|
|
|
|
".list i.on{transform:rotate(90deg);}"
|
|
|
|
|
".hide{overflow: hidden;height: 0;transition: .5s;}"
|
|
|
|
|
".hide h5{padding: 10px 0;background-color: #282c3a;text-align: center;color:#fff;border-bottom:#42495d;}"
|
|
|
|
|
"div{display: block;}"
|
|
|
|
|
"a{text-decoration: none;cursor: pointer;}"
|
|
|
|
|
"ul, li, ol, dl, dt, dd {list-style: none;}"
|
|
|
|
|
"div, figure, footer, header, hgroup, html, iframe, img, mark, menu, nav, object, section, span, table, tr, td, th, tbody, tfoot, thead, video {border: 0;margin: 0;padding: 0;}"
|
|
|
|
|
".my_msg_list{position:inherit;top: 0px;width: 2000px;min-height: 400px;margin-bottom: 20px;}"
|
|
|
|
|
".my_msg_list_view{position: relative;margin-left: 100px;background-color: #fff;padding: 24px 16px;-webkit-box-shadow: 0 2px 4px 0 rgba(0,0,0,0.28);box-shadow: 0 2px 4px 0 rgba(0,0,0,0.28);min-height: 520px;box-sizing: border-box;}"
|
|
|
|
|
".my_msg_list_box{border: 0;margin: 0;padding: 0;box-sizing: border-box;}"
|
|
|
|
|
".my_msg_list_con{border: 0;margin: 0;padding: 0;box-sizing: border-box;}"
|
|
|
|
|
".my_msg_list_title{width: 100%;margin: 0;font-size: 14px;color: #3d3d3d;margin-bottom: 8px;display: block;overflow: hidden;zoom: 1;box-sizing: border-box;}"
|
|
|
|
|
".fr{float: right!important;display: inline-block;color: #4a90e2;}"
|
|
|
|
|
".line{display: inline-block;height: 12px;margin: 2px 12px;border-right: 1px solid #979797;}"
|
|
|
|
|
".msg_list{padding: 0 0 0 15px;min-height: 370px;box-sizing: border-box;}"
|
|
|
|
|
".msg_type{display: inline-block;height: 40px;line-height: 40px;padding: 0 5px;color: #4d4d4d;font-size: 25px;text-align: center;background-color: #fff;border: 1px solid #e0e0e0;vertical-align: top;}"
|
|
|
|
|
".msg_info_box{width: 100%;color: #4d4d4d;display: inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;vertical-align: middle;}"
|
|
|
|
|
".msg_title{display: inline-block;width: 85%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;vertical-align: middle;}"
|
|
|
|
|
".options-f{width: 16%;height: 20px;margin: 0;margin-top: -20px;padding: 0;}"
|
|
|
|
|
".msg_delete{width: 10px;height: 10px;float: right;}"
|
|
|
|
|
".msg_content{margin-top: 15px;margin-bottom: -16px;padding: 15px;background-color: #f7f7f7;font-size: 14px;color: #4d4d4d;line-height: 22px;}"
|
|
|
|
|
".page-box{width: 100%;margin: 32px 0 20px;text-align: center;border-top-color: initial;border-right-color: initial;border-bottom-color: initial;border-left-color: initial;}"
|
|
|
|
|
".ule {list-style-type: none;margin: 0;padding: 0;overflow: hidden;}"
|
|
|
|
|
".lie {width: 23%;display: inline-block;font: 13px sans-serif;}"
|
|
|
|
|
".lie a {display: block;color: rgb(39, 124, 184);text-align: center;padding: 14px 70px;text-decoration: none;}"
|
|
|
|
|
".lie a:hover {background-color: #e3e3f5;}"
|
|
|
|
|
".square{width:200px;height:5px;border:1px solid transparent;background: #06b81a;}"
|
|
|
|
|
"</style>"
|
|
|
|
|
"<header class=\"top-navigation\">"
|
|
|
|
|
"<div class=\"container\">"
|
|
|
|
|
"<a class=\"logo\" aria-label=\"MDN homepage\"><svg id=\"mdn-docs-logo\" x=\"0\" y=\"0\" viewBox=\"0 0 694.9 10.4\" style=\"enable-background:new 0 0 694.9 104.4\" role=\"img\"><title>\"MDN Web Docs\"</title>"
|
|
|
|
|
"<button title=\"Open main menu\" type=\"button\" class=\"button action has-icon main-menu-toggle\" aria-haspopup=\"true\" aria-label=\"Open main menu\" aria-expanded=\"true\"><span class=\"button-wrap\"><span class=\"icon icon-menu \"></span><span class=\"visually-hidden\"><a href=\"MainPageUI.html\">\"Open main menu\"</a></span></span></button>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"</header>"
|
|
|
|
|
"<body>"
|
|
|
|
|
"<div class=\"wrap\">"
|
|
|
|
|
"<div class=\"header\">\"消息过滤器\"</div>"
|
|
|
|
|
"<div class=\"nav\">"
|
|
|
|
|
"<ul>"
|
|
|
|
|
"<li class=\"list\">"
|
|
|
|
|
"<h2><i></i>\"服务器\"</h2>"
|
|
|
|
|
"<div class=\"hide\">"
|
|
|
|
|
"<h5>\"北京\"</h5>"
|
|
|
|
|
"<h5>\"长沙\"</h5>"
|
|
|
|
|
"<h5>\"上海\"</h5>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"</li>"
|
|
|
|
|
"<li class=\"list\">"
|
|
|
|
|
"<h2><i></i>\"响应时间\"</h2>"
|
|
|
|
|
"<div class=\"hide\">"
|
|
|
|
|
"<h5>\"<=100ms\"</h5>"
|
|
|
|
|
"<h5>\"<=1500ms\"</h5>"
|
|
|
|
|
"<h5>\">=1500ms\"</h5>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"</li>"
|
|
|
|
|
"<li class=\"list\">"
|
|
|
|
|
"<h2><i></i>\"当前服务器状态\"</h2>"
|
|
|
|
|
"<div class=\"hide\">"
|
|
|
|
|
"<h5>\"正常\"</h5>"
|
|
|
|
|
"<h5>\"受损\"</h5>"
|
|
|
|
|
"<h5>\"繁忙\"</h5>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"</li>"
|
|
|
|
|
"<li class=\"list\">"
|
|
|
|
|
"<h2><i></i>\"返回消息报头\"</h2>"
|
|
|
|
|
"<div class=\"hide\">"
|
|
|
|
|
"<h5>\"TCP\"</h5>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"</li>"
|
|
|
|
|
"</ul>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"<script>"
|
|
|
|
|
"(function () {"
|
|
|
|
|
"var oList = document.querySelectorAll('.list h2'),"
|
|
|
|
|
"oHide = document.querySelectorAll('.hide'),"
|
|
|
|
|
"oIcon = document.querySelectorAll('.list i'),"
|
|
|
|
|
"lastIndex = 0;"
|
|
|
|
|
"for(var i=0;i<oList.length;i++){"
|
|
|
|
|
"oList[i].index = i;"
|
|
|
|
|
"oList[i].isClick = false;"
|
|
|
|
|
"oList[i].initHeight = oHide[i].clientHeight;"
|
|
|
|
|
"oHide[i].style.height = '0';"
|
|
|
|
|
"oList[i].onclick = function () {"
|
|
|
|
|
"if(this.isClick){"
|
|
|
|
|
"oHide[this.index].style.height = '0';"
|
|
|
|
|
"oIcon[this.index].className = '';"
|
|
|
|
|
"oList[this.index].className = '';"
|
|
|
|
|
"oList[this.index].isClick = false;"
|
|
|
|
|
"}"
|
|
|
|
|
"else{"
|
|
|
|
|
"oHide[lastIndex].style.height = '0';"
|
|
|
|
|
"oIcon[lastIndex].className = '';"
|
|
|
|
|
"oList[lastIndex].className = '';"
|
|
|
|
|
"oHide[this.index].style.height = '220px';"
|
|
|
|
|
"oIcon[this.index].className = 'on';"
|
|
|
|
|
"oList[this.index].className = 'on';"
|
|
|
|
|
"oList[lastIndex].isClick = false;"
|
|
|
|
|
"oList[this.index].isClick = true;"
|
|
|
|
|
"lastIndex = this.index;"
|
|
|
|
|
"}"
|
|
|
|
|
"}"
|
|
|
|
|
"}"
|
|
|
|
|
"})();"
|
|
|
|
|
"</script>"
|
|
|
|
|
"<div class=\"mainbody\">"
|
|
|
|
|
"<div class=\"my_msg_list\">"
|
|
|
|
|
"<div class=\"my_msg_list_view\">"
|
|
|
|
|
"<div class=\"my_msg_list_box\">"
|
|
|
|
|
"<div class=\"my_msg_list_con\">"
|
|
|
|
|
"<div class=\"my_msg_list_title\">"
|
|
|
|
|
"<span >\"消息列表:\"</span>"
|
|
|
|
|
"<a class=\"fr\">\"清空所有消息\"</a>"
|
|
|
|
|
"<span class=\"line fr\"></span>"
|
|
|
|
|
"<a class=\"fr\">\"全部标记为已读\"</a>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"<div class=\"ule\">"
|
|
|
|
|
"<div class=\"lie\"><a href=\"#home\">\"节点\"</a></div>"
|
|
|
|
|
"<div class=\"lie\"><a href=\"#news\">\"负载均衡\"</a></div>"
|
|
|
|
|
"<div class=\"lie\"><a href=\"#contact\">\"节点IP\"</a></div>"
|
|
|
|
|
"<div class=\"lie\"><a href=\"#about\">\"状态\"</a></div>"
|
|
|
|
|
"<div class=\"lie\"><a href=\"#about\">\"探测次数\"</a></div>"
|
|
|
|
|
"<div class=\"lie\"><a href=\"#about\">\"满足次数\"</a></div>"
|
|
|
|
|
"<div class=\"lie\"><a href=\"#about\">\"协议类型\"</a></div>"
|
|
|
|
|
"<div class=\"lie\"><a href=\"#about\">\"检查端口\"</a></div>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"<style>"
|
|
|
|
|
".tr{width:1500px}"
|
|
|
|
|
".td{width:auto}"
|
|
|
|
|
"</style>"
|
|
|
|
|
"<table style=\"width:1500px\"}>",
|
|
|
|
|
count, ngx_http_upstream_check_shm_generation);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < peers->peers.nelts; i++) {
|
|
|
|
@ -2894,17 +3019,16 @@ ngx_http_upstream_check_status_html_format(ngx_buf_t *b,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b->last = ngx_snprintf(b->last, b->end - b->last,
|
|
|
|
|
" <tr%s>\n"
|
|
|
|
|
" <td>%ui</td>\n"
|
|
|
|
|
" <td>%V</td>\n"
|
|
|
|
|
" <td>%V</td>\n"
|
|
|
|
|
" <td>%s</td>\n"
|
|
|
|
|
" <td>%ui</td>\n"
|
|
|
|
|
" <td>%ui</td>\n"
|
|
|
|
|
" <td>%V</td>\n"
|
|
|
|
|
" <td>%ui</td>\n"
|
|
|
|
|
" </tr>\n",
|
|
|
|
|
peer[i].shm->down ? " bgcolor=\"#FF0000\"" : "",
|
|
|
|
|
"<tr>\n"
|
|
|
|
|
"<td width=\"250px\" align=\"center\">%ui</td>\n"
|
|
|
|
|
"<td width=\"250px\" align=\"center\">%V</td>\n"
|
|
|
|
|
"<td width=\"250px\" align=\"center\">%V</td>\n"
|
|
|
|
|
"<td width=\"250px\" align=\"left\">%s</td>\n"
|
|
|
|
|
"<td width=\"200px\" align=\"left\">%ui</td>\n"
|
|
|
|
|
"<td width=\"200px\" align=\"left\">%ui</td>\n"
|
|
|
|
|
"<td width=\"200px\" align=\"center\">%V</td>\n"
|
|
|
|
|
"<td width=\"200px\" align=\"right\">%ui</td>\n"
|
|
|
|
|
"</tr>\n",
|
|
|
|
|
i,
|
|
|
|
|
peer[i].upstream_name,
|
|
|
|
|
&peer[i].peer_addr->name,
|
|
|
|
@ -2916,9 +3040,18 @@ ngx_http_upstream_check_status_html_format(ngx_buf_t *b,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b->last = ngx_snprintf(b->last, b->end - b->last,
|
|
|
|
|
"</table>\n"
|
|
|
|
|
"</body>\n"
|
|
|
|
|
"</html>\n");
|
|
|
|
|
|
|
|
|
|
"</table>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"<div class=\"page-box\">"
|
|
|
|
|
"</div>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"</div>"
|
|
|
|
|
"</body>"
|
|
|
|
|
"</html>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -4072,3 +4205,4 @@ ngx_http_upstream_check_init_process(ngx_cycle_t *cycle)
|
|
|
|
|
|
|
|
|
|
return ngx_http_upstream_check_add_timers(cycle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|