From: bert hubert Date: Sat, 27 Feb 2016 19:44:29 +0000 (+0100) Subject: spruce up dnsdist built-in website with cache hitrate percentage (in text & graph) X-Git-Tag: rec-4.0.0-alpha2~47 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6cb334337db0db6e4d81fb03b3699f0cbcc252f4;p=pdns spruce up dnsdist built-in website with cache hitrate percentage (in text & graph) --- diff --git a/pdns/dnsdistdist/html/index.html b/pdns/dnsdistdist/html/index.html index 135808ee0..1417c212a 100644 --- a/pdns/dnsdistdist/html/index.html +++ b/pdns/dnsdistdist/html/index.html @@ -50,7 +50,7 @@

Uptime: , Number of queries: ( qps), ACL drops: , Dynamic drops: , Rule drops: , Blockfilter drops:
- Average response time: ms, CPU Usage: %, Server selection policy:
+ Average response time: ms, CPU Usage: %, Cache hitrate: %, Server selection policy:
Listening on: , ACL:

@@ -64,7 +64,7 @@
- +
CPU %
CACHE HITRATE / CPU %
diff --git a/pdns/dnsdistdist/html/local.js b/pdns/dnsdistdist/html/local.js index 448b4aaf7..4b20cd074 100644 --- a/pdns/dnsdistdist/html/local.js +++ b/pdns/dnsdistdist/html/local.js @@ -30,7 +30,7 @@ $(document).ready(function() { width: 400, height: 200, renderer: 'line', - series: new Rickshaw.Series.FixedDuration([{ name: 'one' }], undefined, { + series: new Rickshaw.Series.FixedDuration([{ name: 'one' }, {name: 'two'}], undefined, { timeInterval: 1000, maxDataPoints: 100, timeBase: new Date().getTime() / 1000 @@ -151,7 +151,7 @@ $(document).ready(function() { $("#rule-drops").text(data["rule-drop"]); $("#blockfilter-drops").text(data["block-filter"]); $("#uptime").text(moment.duration(data["uptime"]*1000.0).humanize()); - $("#latency").text((data["latency-avg100"]/1000.0).toFixed(2)); + $("#latency").text((data["latency-avg10000"]/1000.0).toFixed(2)); if(!gdata["cpu-sys-msec"]) gdata=data; @@ -164,16 +164,19 @@ $(document).ready(function() { var servfailps=1.0*data["servfail-responses"]-1.0*gdata["servfail-responses"]; - var totpcache=1.0*data["packetcache-hits"]-1.0*gdata["packetcache-hits"]+1.0*data["packetcache-misses"]-1.0*gdata["packetcache-misses"]; - if(totpcache > 0) - $("#phitrate").text((100.0*(data["packetcache-hits"]-1.0*gdata["packetcache-hits"])/totpcache).toFixed(2)); + var totpcache=1.0*data["cache-hits"]-1.0*gdata["cache-hits"]+1.0*data["cache-misses"]-1.0*gdata["cache-misses"]; + var hitrate=0; + if(totpcache > 0) { + hitrate=100.0*(data["cache-hits"]-1.0*gdata["cache-hits"])/totpcache; + $("#phitrate").text(hitrate.toFixed(2)); + } else $("#phitrate").text(0); qpsgraph.series.addData({ qps: qps, servfailps: servfailps}); qpsgraph.render(); - cpugraph.series.addData({ one: cpu}); + cpugraph.series.addData({ one: cpu, two: hitrate}); cpugraph.render(); gdata=data;