'}f+=(a);f+="
";f+=(h.requestCounter+h.overCounts.maxIntegerSize*h.overCounts.requestCounter);f+=" | ";f+=(aPs.getValue(m+".requestCounter",h.requestCounter));f+=" | ";f+=mTh(h.requestMsec);f+=" | ";for(var b in h.responses){f+="";f+=(h.responses[b]+h.overCounts.maxIntegerSize*h.overCounts[b]);f+=" | ";if(b=="5xx"){break}}var j=0;for(var b in h.responses){j+=(h.responses[b]+h.overCounts.maxIntegerSize*h.overCounts[b]);if(b=="5xx"){break}}f+=""+j+" | ";f+="";f+=(bTh(h.outBytes+h.overCounts.maxIntegerSize*h.overCounts.outBytes));f+=" | ";f+=(bTh(h.inBytes+h.overCounts.maxIntegerSize*h.overCounts.inBytes));f+=" | ";f+=(bTh(aPs.getValue(m+".outBytes",h.outBytes)));f+=" | ";f+=(bTh(aPs.getValue(m+".inBytes",h.inBytes)));f+=" | ";if(Object.keys(h.responses).length>5){var g=0;for(var b in h.responses){if(g++<5){continue}f+="";f+=(h.responses[b]+h.overCounts.maxIntegerSize*h.overCounts[b]);f+=" | "}var l=0;g=0;for(var b in h.responses){if(g++<5){continue}l+=(h.responses[b]+h.overCounts.maxIntegerSize*h.overCounts[b])}f+=""+l+" | "}f+=""}return f}function template(c){aPs.refresh(c.nowMsec);var k=0;var p='Server main
Host | Version | Uptime | Connections | Requests |
---|
active | reading | writing | waiting | accepted | handled | Total | Req/s |
';p+=""+c.hostName+" | "+c.nginxVersion+" | "+mTh(c.nowMsec-c.loadMsec)+" | "+c.connections.active+" | "+c.connections.reading+" | "+c.connections.writing+" | "+c.connections.waiting+" | "+c.connections.accepted+" | "+c.connections.handled+" | "+c.connections.requests+" | "+aPs.getValue("serverInfos.connections.requests",c.connections.requests)+" |
";p+="
";var r='Zone | Requests | Responses | Traffic | Cache |
---|
Total | Req/s | Time | 1xx | 2xx | 3xx | 4xx | 5xx | Total | Sent | Rcvd | Sent/s | Rcvd/s | Miss | Bypass | Expired | Stale | Updating | Revalidated | Hit | Scarce | Total |
';var g='Zone | Requests | Responses | Traffic |
---|
Total | Req/s | Time | 1xx | 2xx | 3xx | 4xx | 5xx | Total | Sent | Rcvd | Sent/s | Rcvd/s |
';var j='Server zones
';if(c.serverZones["*"]){if(Object.keys(c.serverZones["*"].responses).length>5){p+=j+r;k=1}else{p+=j+g;k=0}}else{p+=j+r}p+=templateZone(c.serverZones,"server","serverZones");p+="
";if("filterZones" in c){p+='Filters
';for(var d in c.filterZones){p+=""+(d)+"
";p+=k?r:g;var f=c.filterZones[d];p+=templateZone(f,d,"filterZones");p+="
"}p+=""}if("upstreamZones" in c){p+='Upstreams
';for(var e in c.upstreamZones){p+="
"+(e)+"
";p+='
Server | State | Response Time | Weight | MaxFails | FailTimeout | Requests | Responses | Traffic |
---|
Total | Req/s | Time | 1xx | 2xx | 3xx | 4xx | 5xx | Total | Sent | Rcvd | Sent/s | Rcvd/s |
';var a=c.upstreamZones[e];if(a){var h,l=-1,m=a.length-1;while(l";p+=(h.server);p+=" | ";p+=sTh(h.backup,h.down);p+=" | ";p+=mTh(h.responseMsec);p+=" | ";p+=h.weight;p+=" | ";p+=h.maxFails;p+=" | ";p+=h.failTimeout;p+=" | ";p+=(h.requestCounter+h.overCounts.maxIntegerSize*h.overCounts.requestCounter);p+=" | ";p+=(aPs.getValue("upstreamZones."+e+"."+h.server+".requestCounter",h.requestCounter));p+=" | ";p+=mTh(h.requestMsec);p+=" | ";for(var b in h.responses){p+="";p+=(h.responses[b]+h.overCounts.maxIntegerSize*h.overCounts[b]);p+=" | "}var t=0;for(var b in h.responses){t+=(h.responses[b]+h.overCounts.maxIntegerSize*h.overCounts[b])}p+=""+t+" | ";p+="";p+=(bTh(h.outBytes+h.overCounts.maxIntegerSize*h.overCounts.outBytes));p+=" | ";p+=(bTh(h.inBytes+h.overCounts.maxIntegerSize*h.overCounts.inBytes));p+=" | ";p+=(bTh(aPs.getValue("upstreamZones."+e+"."+h.server+".outBytes",h.outBytes)));p+=" | ";p+=(bTh(aPs.getValue("upstreamZones."+e+"."+h.server+".inBytes",h.inBytes)));p+=" | "}}p+="
"}p+="
"}if("cacheZones" in c){p+='Caches
Zone | Size | Traffic | Cache |
---|
Capacity | Used | Sent | Rcvd | Sent/s | Rcvd/s | Miss | Bypass | Expired | Stale | Updating | Revalidated | Hit | Scarce | Total |
';var l=0;for(var u in c.cacheZones){var q=c.cacheZones[u];p+="";p+=(u);p+=" | ";p+=(bTh(q.maxSize));p+=" | ";p+=(bTh(q.usedSize));p+=" | ";p+="";p+=(bTh(q.outBytes+q.overCounts.maxIntegerSize*q.overCounts.outBytes));p+=" | ";p+=(bTh(q.inBytes+q.overCounts.maxIntegerSize*q.overCounts.inBytes));p+=" | ";p+=(bTh(aPs.getValue("cacheZones."+u+".outBytes",q.outBytes)));p+=" | ";p+=(bTh(aPs.getValue("cacheZones."+u+".inBytes",q.inBytes)));p+=" | ";var s=0;var o=0;for(var b in q.responses){p+="";p+=(q.responses[b]+q.overCounts.maxIntegerSize*q.overCounts[b]);p+=" | ";s+=q.responses[b]+q.overCounts.maxIntegerSize*q.overCounts[b]}p+=""+s+" |
"}p+="
"}return p}function vtsGetData(){var a=document.getElementById("monitor");var b=new XMLHttpRequest;b.onload=function(){if(this.status!=200){return}a.innerHTML=template(JSON.parse(this.responseText))};b.open("GET",vtsStatusURI);b.send()}function vtsSetInterval(a){clearInterval(vtsUpdate);vtsUpdate=setInterval(vtsGetData,a)}document.getElementById("jsonUri").href=vtsStatusURI;vtsGetData();vtsSetInterval(vtsUpdateInterval);