]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[v9_9] stats improvements (newstats only)
authorEvan Hunt <each@isc.org>
Fri, 10 Jan 2014 02:06:10 +0000 (18:06 -0800)
committerEvan Hunt <each@isc.org>
Fri, 10 Jan 2014 02:41:21 +0000 (18:41 -0800)
3699.  [bug]           Improvements to statistics channel XSL stylesheet:
                       the stylesheet can now be cached by the browser;
                       section headers are omitted from the stats display
                       when there is no data in those sections to be
                       displayed; counters are now right-justified for
                       easier readability. [RT #35117]

CHANGES
bin/named/bind9.ver3.xsl
bin/named/bind9.ver3.xsl.h
bin/named/statschannel.c
lib/isc/httpd.c
lib/isc/include/isc/httpd.h
lib/isc/include/isc/types.h
lib/isc/unix/include/isc/time.h
lib/isc/unix/time.c

diff --git a/CHANGES b/CHANGES
index b4b9e859b10d130015a253565904dcf619ea83f5..11abd46a7c44706b75940b24ce29c2b22b69d047 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,11 @@
+3699.  [bug]           Improvements to statistics channel XSL stylesheet:
+                       the stylesheet can now be cached by the browser;
+                       section headers are omitted from the stats display
+                       when there is no data in those sections to be
+                       displayed; counters are now right-justified for
+                       easier readability. (Only available with 
+                        configure --enable-newstats.) [RT #35117]
+
 3698.  [cleanup]       Replaced all uses of memcpy() with memmove().
                        [RT #35120]
 
index 22e5c45fbef4c6d665099a558ff145ad7b80b474..9da8b6195a446af555e18222d3b4265f07a5fe7a 100644 (file)
 <!-- %Id: bind9.xsl,v 1.21 2009/01/27 23:47:54 tbox Exp % -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
   <xsl:output method="html" indent="yes" version="4.0"/>
-  <xsl:template match="statistics[@version=&quot;3.0&quot;]">
+  <xsl:template match="statistics[@version=&quot;3.3&quot;]">
     <html>
       <head>
         <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
           <!-- Non Mozilla specific markup -->
           <script type="text/javascript" src="https://www.google.com/jsapi"/>
           <script type="text/javascript">
-        
+
         google.load("visualization", "1", {packages:["corechart"]});
         google.setOnLoadCallback(loadGraphs);
 
         var graphs=[];
-        
-        function drawChart(chart_title,target,data) {
+
+        function drawChart(chart_title,target,style,data) {
           var data = google.visualization.arrayToDataTable(data);
 
           var options = {
             title: chart_title
           };
-          
-          var chart = new google.visualization.BarChart(document.getElementById(target));
-          chart.draw(data, options);
+
+          var chart;
+          if (style == "barchart") {
+            chart = new google.visualization.BarChart(document.getElementById(target));
+            chart.draw(data, options);
+          } else if (style == "piechart") {
+            chart = new google.visualization.PieChart(document.getElementById(target));
+            chart.draw(data, options);
+          }
         }
-        
+
         function loadGraphs(){
-          //alert("here we are!");
           var g;
-            
-          // Server Incoming query Types
+
           while(g = graphs.shift()){
             // alert("going for: " + g.target);
             if(g.data.length > 1){
-              drawChart(g.title,g.target,g.data);
+              drawChart(g.title,g.target,g.style,g.data);
             }
           }
         }
-        
-            // Server Incoming Queries Types         
-           graphs.push({
-                        'title' : "Server Incoming Query Types",
-                        'target': 'chart_incoming_qtypes',
-                        'data': [['Type','Counter'],<xsl:for-each select="server/counters[@type=&quot;qtype&quot;]/counter">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]
-                        });
-
-
-           // Server Incoming Requests         
-           graphs.push({
-                        'title' : "Server Incoming Requests",
-                        'target': 'chart_incoming_requests',
-                        'data': [['Requests','Counter'],<xsl:for-each select="server/counters[@type=&quot;opcode&quot;]/counter">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]});
-        
-        
-        
-        
+
+        // Server Incoming Query Types         
+        graphs.push({
+                     'title' : "Server Incoming Query Types",
+                     'target': 'chart_incoming_qtypes',
+                     'style': 'barchart',
+                     'data': [['Type','Counter'],<xsl:for-each select="server/counters[@type=&quot;qtype&quot;]/counter">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]
+                     });
+
+        // Server Incoming Requests by opcode
+        graphs.push({
+                     'title' : "Server Incoming Requests by DNS Opcode",
+                     'target': 'chart_incoming_opcodes',
+                     'style': 'barchart',
+                     'data': [['Opcode','Counter'],<xsl:for-each select="server/counters[@type=&quot;opcode&quot;]/counter[. &gt; 0 or substring(@name,1,3) != 'RES']">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]});
       </script>
         </xsl:if>
         <style type="text/css">
       color: #000000;
       font-size: 10pt;
      }
-     
+
      .odd{
       background-color: #f0f0f0;
      }
-     
+
      .even{
       background-color: #ffffff;
      }
-     
+
      p.footer{
       font-style:italic;
       color: grey;
       border: 1px solid grey;
       width: 500px;
      }
-     
      table.counters th {
+      text-align: right;
+      border: 1px solid grey;
+      width: 150px;
+     }
+     table.counters td {
+      text-align: right;
+      font-family: monospace;
+     }
+     table.counters tr:hover{
+      background-color: #99ddff;
+     }
+
+     table.info {
+      border: 1px solid grey;
+      width: 500px;
+     }
+     table.info th {
       text-align: center;
       border: 1px solid grey;
-      width: 120px;
-     }
-    table.counters td{
-      text-align:center;
-      
-    }
-    
-    table.counters tr:hover{
+      width: 150px;
+     }
+     table.info td {
+      text-align: center;
+     }
+     table.info tr:hover{
       background-color: #99ddff;
-    }
+     }
+
+     table.tasks {
+      border: 1px solid grey;
+      width: 500px;
+     }
+     table.tasks th {
+      text-align: center;
+      border: 1px solid grey;
+      width: 150px;
+     }
+     table.tasks td {
+      text-align: right;
+      font-family: monospace;
+     }
+     table.tasks td:nth-child(2) {
+      text-align: center;
+     }
+     table.tasks td:nth-child(4) {
+      text-align: center;
+     }
+     table.tasks tr:hover{
+      background-color: #99ddff;
+     }
+
+     table.netstat {
+      border: 1px solid grey;
+      width: 500px;
+     }
+     table.netstat th {
+      text-align: center;
+      border: 1px solid grey;
+      width: 150px;
+     }
+     table.netstat td {
+      text-align: center;
+     }
+     table.netstat td:nth-child(4) {
+      text-align: right;
+      font-family: monospace;
+     }
+     table.netstat td:nth-child(7) {
+      text-align: left;
+     }
+     table.netstat tr:hover{
+      background-color: #99ddff;
+     }
+
+     table.mctx  {
+      border: 1px solid grey;
+      width: 500px;
+     }
+     table.mctx th {
+      text-align: center;
+      border: 1px solid grey;
+     }
+     table.mctx td {
+      text-align: right;
+      font-family: monospace;
+     }
+     table.mctx td:nth-child(-n+2) {
+      text-align: left;
+      width: 100px;
+     }
+     table.mctx tr:hover{
+      background-color: #99ddff;
+     }
+
      .totals {
       background-color: rgb(1,169,206);
       color: #ffffff;
        width:500px;
        text-align:center;
      }
-     
+
      h3 {
        color: #444444;
        font-size: 12pt;
        width:500px;
        text-align:center;
-       
      }
      h4 {
         color:  rgb(1,169,206);
         font-size: 10pt;
        width:500px;
        text-align:center;
-        
      }
 
      .pie {
         </div>
         <hr/>
         <h2>Server Times</h2>
-        <table class="counters">
+        <table class="info">
           <tr>
             <th>Boot time:</th>
             <td>
             </td>
           </tr>
           <tr>
-            <th>Sample time:</th>
+            <th>Current time:</th>
             <td>
               <xsl:value-of select="server/current-time"/>
             </td>
           </tr>
         </table>
         <br/>
-        <h2>Incoming Requests</h2>
-        <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
-          <!-- Non Mozilla specific markup -->
-          <div class="pie" id="chart_incoming_requests">[no incoming requests]</div>
-        </xsl:if>
-        <table class="counters">
-          <xsl:for-each select="server/counters[@type=&quot;opcode&quot;]/counter">
-            <xsl:sort select="." data-type="number" order="descending"/>
+        <xsl:if test="server/counters[@type=&quot;opcode&quot;]/counter[. &gt; 0]">
+          <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
+            <h2>Incoming Requests by DNS Opcode</h2>
+            <!-- Non Mozilla specific markup -->
+            <div class="pie" id="chart_incoming_opcodes">
+              [cannot display chart]
+            </div>
+          </xsl:if>
+          <table class="counters">
+            <xsl:for-each select="server/counters[@type=&quot;opcode&quot;]/counter[. &gt; 0 or substring(@name,1,3) != 'RES']">
+              <xsl:sort select="." data-type="number" order="descending"/>
+              <tr>
+                <th>
+                  <xsl:value-of select="@name"/>
+                </th>
+                <td>
+                  <xsl:value-of select="."/>
+                </td>
+              </tr>
+            </xsl:for-each>
             <tr>
-              <th>
-                <xsl:value-of select="@name"/>
-              </th>
-              <td>
-                <xsl:value-of select="."/>
+              <th class="totals">Total:</th>
+              <td class="totals">
+                <xsl:value-of select="sum(server/counters[@type=&quot;opcode&quot;]/counter)"/>
               </td>
             </tr>
-          </xsl:for-each>
-          <tr>
-            <th class="totals">Total:</th>
-            <td class="totals">
-              <xsl:value-of select="sum(server/counters[@type=&quot;opcode&quot;]/counter)"/>
-            </td>
-          </tr>
-        </table>
-        <br/>
-        <h3>Incoming Queries by Type</h3>
-        <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
-          <!-- Non Mozilla specific markup -->
-          <div class="pie" id="chart_incoming_qtypes">[no incoming queries]</div>
+          </table>
+          <br/>
         </xsl:if>
-        <table class="counters">
-          <xsl:for-each select="server/counters[@type=&quot;qtype&quot;]/counter">
-            <xsl:sort select="." data-type="number" order="descending"/>
-            <xsl:variable name="css-class">
-              <xsl:choose>
-                <xsl:when test="position() mod 2 = 0">even</xsl:when>
-                <xsl:otherwise>odd</xsl:otherwise>
-              </xsl:choose>
-            </xsl:variable>
-            <tr class="{$css-class}">
-              <th>
-                <xsl:value-of select="@name"/>
-              </th>
-              <td>
-                <xsl:value-of select="."/>
+        <xsl:if test="server/counters[@type=&quot;qtype&quot;]/counter">
+          <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
+            <!-- Non Mozilla specific markup -->
+            <h3>Incoming Queries by Query Type</h3>
+            <div class="pie" id="chart_incoming_qtypes">
+              [cannot display chart]
+            </div>
+          </xsl:if>
+          <table class="counters">
+            <xsl:for-each select="server/counters[@type=&quot;qtype&quot;]/counter">
+              <xsl:sort select="." data-type="number" order="descending"/>
+              <xsl:variable name="css-class">
+                <xsl:choose>
+                  <xsl:when test="position() mod 2 = 0">even</xsl:when>
+                  <xsl:otherwise>odd</xsl:otherwise>
+                </xsl:choose>
+              </xsl:variable>
+              <tr class="{$css-class}">
+                <th>
+                  <xsl:value-of select="@name"/>
+                </th>
+                <td>
+                  <xsl:value-of select="."/>
+                </td>
+              </tr>
+            </xsl:for-each>
+            <tr>
+              <th class="totals">Total:</th>
+              <td class="totals">
+                <xsl:value-of select="sum(server/counters[@type=&quot;qtype&quot;]/counter)"/>
               </td>
             </tr>
+          </table>
+          <br/>
+        </xsl:if>
+        <xsl:if test="views/view[count(counters[@type=&quot;resqtype&quot;]/counter) &gt; 0]">
+          <h2>Outgoing Queries per view</h2>
+          <xsl:for-each select="views/view[count(counters[@type=&quot;resqtype&quot;]/counter) &gt; 0]">
+            <h3>View <xsl:value-of select="@name"/></h3>
+            <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
+              <!-- Non Mozilla specific markup -->
+            <script type="text/javascript">
+                  graphs.push({
+                                'title': "Outgoing Queries for view: <xsl:value-of select="@name"/>",
+                                'target': 'chart_outgoing_queries_view_<xsl:value-of select="@name"/>',
+                                'style': 'barchart',
+                                'data': [['Type','Counter'],<xsl:for-each select="counters[@type=&quot;resqtype&quot;]/counter">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]
+                                });
+              </script>
+            <xsl:variable name="target">
+              <xsl:value-of select="@name"/>
+            </xsl:variable>
+              <div class="pie" id="chart_outgoing_queries_view_{$target}">[no data to display]</div>
+            </xsl:if>
+            <table class="counters">
+              <xsl:for-each select="counters[@type=&quot;resqtype&quot;]/counter">
+                <xsl:sort select="." data-type="number" order="descending"/>
+                <xsl:variable name="css-class1">
+                  <xsl:choose>
+                    <xsl:when test="position() mod 2 = 0">even</xsl:when>
+                    <xsl:otherwise>odd</xsl:otherwise>
+                  </xsl:choose>
+                </xsl:variable>
+                <tr class="{$css-class1}">
+                  <th>
+                    <xsl:value-of select="@name"/>
+                  </th>
+                  <td>
+                    <xsl:value-of select="."/>
+                  </td>
+                </tr>
+              </xsl:for-each>
+            </table>
+            <br/>
           </xsl:for-each>
-          <tr>
-            <th class="totals">Total:</th>
-            <td class="totals">
-              <xsl:value-of select="sum(server/counters[@type=&quot;qtype&quot;]/counter)"/>
-            </td>
-          </tr>
-        </table>
-        <br/>
-        <h2>Outgoing Queries per view</h2>
-        <xsl:for-each select="views/view[count(counters[@type=&quot;resqtype&quot;]/counter) &gt; 0]">
-          <h3>View <xsl:value-of select="@name"/></h3>
+        </xsl:if>
+        <xsl:if test="server/counters[@type=&quot;nsstat&quot;]/counter[.&gt;0]">
+          <h2>Server Statistics</h2>
           <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
             <!-- Non Mozilla specific markup -->
           <script type="text/javascript">
-                graphs.push({
-                              'title': "Outgoing queries for view: <xsl:value-of select="@name"/>",
-                              'target': 'chart_outgoing_queries_view_<xsl:value-of select="@name"/>',
-                              'data': [['Type','Counter'],<xsl:for-each select="counters[@type=&quot;resqtype&quot;]/counter">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]
-                              });
-                              
-            </script>
-          <xsl:variable name="target">
-            <xsl:value-of select="@name"/>
-          </xsl:variable>
-            <div class="pie" id="chart_outgoing_queries_view_{$target}"/>
+                  graphs.push({
+                                'title' : "Server Counters",
+                                'target': 'chart_server_nsstat_restype',
+                                'style': 'barchart',
+                                'data': [['Type','Counter'],<xsl:for-each select="server/counters[@type=&quot;nsstat&quot;]/counter[.&gt;0]">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]
+                                });
+              </script>
+            <div class="pie" id="chart_server_nsstat_restype">[no data to display]</div>
           </xsl:if>
           <table class="counters">
-            <xsl:for-each select="counters[@type=&quot;resqtype&quot;]/counter">
+            <xsl:for-each select="server/counters[@type=&quot;nsstat&quot;]/counter[.&gt;0]">
               <xsl:sort select="." data-type="number" order="descending"/>
-              <xsl:variable name="css-class1">
+              <xsl:variable name="css-class2">
                 <xsl:choose>
                   <xsl:when test="position() mod 2 = 0">even</xsl:when>
                   <xsl:otherwise>odd</xsl:otherwise>
                 </xsl:choose>
               </xsl:variable>
-              <tr class="{$css-class1}">
+              <tr class="{$css-class2}">
                 <th>
                   <xsl:value-of select="@name"/>
                 </th>
             </xsl:for-each>
           </table>
           <br/>
-        </xsl:for-each>
-        <h2>Server Statistics</h2>
-        <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
-          <!-- Non Mozilla specific markup -->
-        <script type="text/javascript">
-                graphs.push({
-                              'title' : "Server Counters",
-                              'target': 'chart_server_nsstat_restype',
-                              'data': [['Type','Counter'],<xsl:for-each select="server/counters[@type=&quot;nsstat&quot;]/counter[.&gt;0]">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]
-                              });
-                              
-            </script>
-          <div class="pie" id="chart_server_nsstat_restype"/>
         </xsl:if>
-        <table class="counters">
-          <xsl:for-each select="server/counters[@type=&quot;nsstat&quot;]/counter[.&gt;0]">
-            <xsl:sort select="." data-type="number" order="descending"/>
-            <xsl:variable name="css-class2">
-              <xsl:choose>
-                <xsl:when test="position() mod 2 = 0">even</xsl:when>
-                <xsl:otherwise>odd</xsl:otherwise>
-              </xsl:choose>
-            </xsl:variable>
-            <tr class="{$css-class2}">
-              <th>
-                <xsl:value-of select="@name"/>
-              </th>
-              <td>
-                <xsl:value-of select="."/>
-              </td>
-            </tr>
-          </xsl:for-each>
-        </table>
-        <br/>
-        <h2>Zone Maintenance Statistics</h2>
-        <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
-        <script type="text/javascript">
-                      graphs.push({
-                                    'title' : "Zone Maintenance Stats",
-                                    'target': 'chart_server_zone_maint',
-                                    'data': [['Type','Counter'],<xsl:for-each select="server/counters[@type=&quot;zonestat&quot;]/counter">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]
-                                    });
-
-                  </script>
-          <!-- Non Mozilla specific markup -->
-          <div class="pie" id="chart_server_zone_maint"/>
+        <xsl:if test="server/counters[@type=&quot;zonestat&quot;]/counter[.&gt;0]">
+          <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
+            <h2>Zone Maintenance Statistics</h2>
+            <script type="text/javascript">
+                  graphs.push({
+                                'title' : "Zone Maintenance Stats",
+                                'target': 'chart_server_zone_maint',
+                                'style': 'barchart',
+                                'data': [['Type','Counter'],<xsl:for-each select="server/counters[@type=&quot;zonestat&quot;]/counter[.&gt;0]">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]
+                                });
+            </script>
+            <!-- Non Mozilla specific markup -->
+            <div class="pie" id="chart_server_zone_maint">[no data to display]</div>
+          </xsl:if>
+          <table class="counters">
+            <xsl:for-each select="server/counters[@type=&quot;zonestat&quot;]/counter">
+              <xsl:sort select="." data-type="number" order="descending"/>
+              <xsl:variable name="css-class3">
+                <xsl:choose>
+                  <xsl:when test="position() mod 2 = 0">even</xsl:when>
+                  <xsl:otherwise>odd</xsl:otherwise>
+                </xsl:choose>
+              </xsl:variable>
+              <tr class="{$css-class3}">
+                <th>
+                  <xsl:value-of select="@name"/>
+                </th>
+                <td>
+                  <xsl:value-of select="."/>
+                </td>
+              </tr>
+            </xsl:for-each>
+          </table>
         </xsl:if>
-        <table class="counters">
-          <xsl:for-each select="server/counters[@type=&quot;zonestat&quot;]/counter">
-            <xsl:sort select="." data-type="number" order="descending"/>
-            <xsl:variable name="css-class3">
-              <xsl:choose>
-                <xsl:when test="position() mod 2 = 0">even</xsl:when>
-                <xsl:otherwise>odd</xsl:otherwise>
-              </xsl:choose>
-            </xsl:variable>
-            <tr class="{$css-class3}">
-              <th>
-                <xsl:value-of select="@name"/>
-              </th>
-              <td>
-                <xsl:value-of select="."/>
-              </td>
-            </tr>
-          </xsl:for-each>
-        </table>
-        <h2>Resolver Statistics (Common)</h2>
-        <table class="counters">
-          <xsl:for-each select="server/counters[@type=&quot;restat&quot;]/counter">
-            <xsl:sort select="." data-type="number" order="descending"/>
-            <xsl:variable name="css-class4">
-              <xsl:choose>
-                <xsl:when test="position() mod 2 = 0">even</xsl:when>
-                <xsl:otherwise>odd</xsl:otherwise>
-              </xsl:choose>
-            </xsl:variable>
-            <tr class="{$css-class4}">
-              <th>
-                <xsl:value-of select="@name"/>
-              </th>
-              <td>
-                <xsl:value-of select="."/>
-              </td>
-            </tr>
-          </xsl:for-each>
-        </table>
-        <xsl:for-each select="views/view">
-          <h3>Resolver Statistics for View <xsl:value-of select="@name"/></h3>
+        <xsl:if test="server/counters[@type=&quot;resstat&quot;]/counter[.&gt;0]">
+          <h2>Resolver Statistics (Common)</h2>
           <table class="counters">
-            <xsl:for-each select="counters[@type=&quot;resstats&quot;]/counter[.&gt;0]">
+            <xsl:for-each select="server/counters[@type=&quot;resstat&quot;]/counter">
               <xsl:sort select="." data-type="number" order="descending"/>
-              <xsl:variable name="css-class5">
+              <xsl:variable name="css-class4">
                 <xsl:choose>
                   <xsl:when test="position() mod 2 = 0">even</xsl:when>
                   <xsl:otherwise>odd</xsl:otherwise>
                 </xsl:choose>
               </xsl:variable>
-              <tr class="{$css-class5}">
+              <tr class="{$css-class4}">
                 <th>
                   <xsl:value-of select="@name"/>
                 </th>
               </tr>
             </xsl:for-each>
           </table>
+        </xsl:if>
+        <xsl:for-each select="views/view">
+          <xsl:if test="counters[@type=&quot;resstats&quot;]/counter[.&gt;0]">
+            <h3>Resolver Statistics for View <xsl:value-of select="@name"/></h3>
+            <table class="counters">
+              <xsl:for-each select="counters[@type=&quot;resstats&quot;]/counter[.&gt;0]">
+                <xsl:sort select="." data-type="number" order="descending"/>
+                <xsl:variable name="css-class5">
+                  <xsl:choose>
+                    <xsl:when test="position() mod 2 = 0">even</xsl:when>
+                    <xsl:otherwise>odd</xsl:otherwise>
+                  </xsl:choose>
+                </xsl:variable>
+                <tr class="{$css-class5}">
+                  <th>
+                    <xsl:value-of select="@name"/>
+                  </th>
+                  <td>
+                    <xsl:value-of select="."/>
+                  </td>
+                </tr>
+              </xsl:for-each>
+            </table>
+          </xsl:if>
         </xsl:for-each>
-        <h3>Cache DB RRsets for View <xsl:value-of select="@name"/></h3>
+
         <xsl:for-each select="views/view">
+          <xsl:if test="cache/rrset">
+            <h3>Cache DB RRsets for View <xsl:value-of select="@name"/></h3>
+            <table class="counters">
+              <xsl:for-each select="cache/rrset">
+                <xsl:variable name="css-class6">
+                  <xsl:choose>
+                    <xsl:when test="position() mod 2 = 0">even</xsl:when>
+                    <xsl:otherwise>odd</xsl:otherwise>
+                  </xsl:choose>
+                </xsl:variable>
+                <tr class="{$css-class6}">
+                  <th>
+                    <xsl:value-of select="name"/>
+                  </th>
+                  <td>
+                    <xsl:value-of select="counter"/>
+                  </td>
+                </tr>
+              </xsl:for-each>
+            </table>
+            <br/>
+          </xsl:if>
+        </xsl:for-each>
+
+        <xsl:if test="server/counters[@type=&quot;sockstat&quot;]/counter[.&gt;0]">
+          <h2>Socket I/O Statistics</h2>
           <table class="counters">
-            <xsl:for-each select="cache/rrset">
-              <xsl:variable name="css-class6">
+            <xsl:for-each select="server/counters[@type=&quot;sockstat&quot;]/counter[.&gt;0]">
+              <xsl:variable name="css-class7">
                 <xsl:choose>
                   <xsl:when test="position() mod 2 = 0">even</xsl:when>
                   <xsl:otherwise>odd</xsl:otherwise>
                 </xsl:choose>
               </xsl:variable>
-              <tr class="{$css-class6}">
+              <tr class="{$css-class7}">
                 <th>
-                  <xsl:value-of select="name"/>
+                  <xsl:value-of select="@name"/>
                 </th>
                 <td>
-                  <xsl:value-of select="counter"/>
+                  <xsl:value-of select="."/>
                 </td>
               </tr>
             </xsl:for-each>
           </table>
           <br/>
-        </xsl:for-each>
-        <h2>Socket I/O Statistics</h2>
-        <table class="counters">
-          <xsl:for-each select="server/counters[@type=&quot;sockstat&quot;]/counter[.&gt;0]">
-            <xsl:variable name="css-class7">
-              <xsl:choose>
-                <xsl:when test="position() mod 2 = 0">even</xsl:when>
-                <xsl:otherwise>odd</xsl:otherwise>
-              </xsl:choose>
+        </xsl:if>
+        <xsl:if test="views/view[zones/zone/counters[@type=&quot;rcode&quot;]/counter &gt;0]">
+          <h2>Response Codes per view/zone</h2>
+          <xsl:for-each select="views/view[zones/zone/counters[@type=&quot;rcode&quot;]/counter &gt;0]">
+            <h3>View <xsl:value-of select="@name"/></h3>
+            <xsl:variable name="thisview">
+              <xsl:value-of select="@name"/>
             </xsl:variable>
-            <tr class="{$css-class7}">
-              <th>
-                <xsl:value-of select="@name"/>
-              </th>
-              <td>
-                <xsl:value-of select="."/>
-              </td>
-            </tr>
-          </xsl:for-each>
-        </table>
-        <br/>
-        <br/>
-        <h2>Response Codes per view/zone</h2>
-        <xsl:for-each select="views/view[zones/zone/counters[@type=&quot;rcode&quot;]/counter &gt;0]">
-          <h3>View <xsl:value-of select="@name"/></h3>
-          <xsl:variable name="thisview">
-            <xsl:value-of select="@name"/>
-          </xsl:variable>
-          <xsl:for-each select="zones/zone">
-            <xsl:if test="counters[@type=&quot;rcode&quot;]/counter[. &gt; 0]">
-              <h4>Zone <xsl:value-of select="@name"/></h4>
-              <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
-                <!-- Non Mozilla specific markup -->
-              <script type="text/javascript">
-                      graphs.push({
-                                    'title': "Response Codes for zone <xsl:value-of select="@name"/>",
-                                    'target': 'chart_rescode_<xsl:value-of select="../../@name"/>_<xsl:value-of select="@name"/>',
-                                    'data': [['Type','Counter'],<xsl:for-each select="counters[@type=&quot;rcode&quot;]/counter[.&gt;0 and @name != &quot;QryAuthAns&quot;]">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]
-                                    });
-
-                  </script>
-              <xsl:variable name="target">
-                <xsl:value-of select="@name"/>
-              </xsl:variable>
-                <div class="pie" id="chart_rescode_{$thisview}_{$target}"/>
+            <xsl:for-each select="zones/zone">
+              <xsl:if test="counters[@type=&quot;rcode&quot;]/counter[. &gt; 0]">
+                <h4>Zone <xsl:value-of select="@name"/></h4>
+                <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
+                  <!-- Non Mozilla specific markup -->
+                <script type="text/javascript">
+                        graphs.push({
+                                      'title': "Response Codes for zone <xsl:value-of select="@name"/>",
+                                      'target': 'chart_rescode_<xsl:value-of select="../../@name"/>_<xsl:value-of select="@name"/>',
+                                      'style': 'barchart',
+                                      'data': [['Type','Counter'],<xsl:for-each select="counters[@type=&quot;rcode&quot;]/counter[.&gt;0 and @name != &quot;QryAuthAns&quot;]">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]
+                                      });
+
+                    </script>
+                <xsl:variable name="target">
+                  <xsl:value-of select="@name"/>
+                </xsl:variable>
+                  <div class="pie" id="chart_rescode_{$thisview}_{$target}">[no data to display]</div>
+                </xsl:if>
+                <table class="counters">
+                  <xsl:for-each select="counters[@type=&quot;rcode&quot;]/counter[.&gt;0 and @name != &quot;QryAuthAns&quot;]">
+                    <xsl:sort select="."/>
+                    <xsl:variable name="css-class10">
+                      <xsl:choose>
+                        <xsl:when test="position() mod 2 = 0">even</xsl:when>
+                        <xsl:otherwise>odd</xsl:otherwise>
+                      </xsl:choose>
+                    </xsl:variable>
+                    <tr class="{$css-class10}">
+                      <th>
+                        <xsl:value-of select="@name"/>
+                      </th>
+                      <td>
+                        <xsl:value-of select="."/>
+                      </td>
+                    </tr>
+                  </xsl:for-each>
+                </table>
               </xsl:if>
-              <table class="counters">
-                <xsl:for-each select="counters[@type=&quot;rcode&quot;]/counter[.&gt;0 and @name != &quot;QryAuthAns&quot;]">
-                  <xsl:sort select="."/>
-                  <xsl:variable name="css-class10">
-                    <xsl:choose>
-                      <xsl:when test="position() mod 2 = 0">even</xsl:when>
-                      <xsl:otherwise>odd</xsl:otherwise>
-                    </xsl:choose>
-                  </xsl:variable>
-                  <tr class="{$css-class10}">
-                    <th>
-                      <xsl:value-of select="@name"/>
-                    </th>
-                    <td>
-                      <xsl:value-of select="."/>
-                    </td>
-                  </tr>
-                </xsl:for-each>
-              </table>
-            </xsl:if>
+            </xsl:for-each>
           </xsl:for-each>
-        </xsl:for-each>
-        <h2>Received QTYPES per view/zone</h2>
-        <xsl:for-each select="views/view[zones/zone/counters[@type=&quot;qtype&quot;]/counter &gt;0]">
-          <h3>View <xsl:value-of select="@name"/></h3>
-          <xsl:variable name="thisview2">
-            <xsl:value-of select="@name"/>
-          </xsl:variable>
-          <xsl:for-each select="zones/zone">
-            <xsl:if test="counters[@type=&quot;qtype&quot;]/counter[count(.) &gt; 0]">
-              <h4>Zone <xsl:value-of select="@name"/></h4>
-              <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
-                <!-- Non Mozilla specific markup -->
-              <script type="text/javascript">
-                      graphs.push({
-                                    'title': "Query Types for zone <xsl:value-of select="@name"/>",
-                                    'target': 'chart_qtype_<xsl:value-of select="../../@name"/>_<xsl:value-of select="@name"/>',
-                                    'data': [['Type','Counter'],<xsl:for-each select="counters[@type=&quot;qtype&quot;]/counter[.&gt;0 and @name != &quot;QryAuthAns&quot;]">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]
-                                    });
-
-                  </script>
-              <xsl:variable name="target">
-                <xsl:value-of select="@name"/>
-              </xsl:variable>
-                <div class="pie" id="chart_qtype_{$thisview2}_{$target}"/>
+        </xsl:if>
+        <xsl:if test="views/view[zones/zone/counters[@type=&quot;qtype&quot;]/counter &gt;0]">
+          <h2>Received QTYPES per view/zone</h2>
+          <xsl:for-each select="views/view[zones/zone/counters[@type=&quot;qtype&quot;]/counter &gt;0]">
+            <h3>View <xsl:value-of select="@name"/></h3>
+            <xsl:variable name="thisview2">
+              <xsl:value-of select="@name"/>
+            </xsl:variable>
+            <xsl:for-each select="zones/zone">
+              <xsl:if test="counters[@type=&quot;qtype&quot;]/counter[count(.) &gt; 0]">
+                <h4>Zone <xsl:value-of select="@name"/></h4>
+                <xsl:if test="system-property('xsl:vendor')!='Transformiix'">
+                  <!-- Non Mozilla specific markup -->
+                <script type="text/javascript">
+                        graphs.push({
+                                      'title': "Query Types for zone <xsl:value-of select="@name"/>",
+                                      'target': 'chart_qtype_<xsl:value-of select="../../@name"/>_<xsl:value-of select="@name"/>',
+                                      'style': 'barchart',
+                                      'data': [['Type','Counter'],<xsl:for-each select="counters[@type=&quot;qtype&quot;]/counter[.&gt;0 and @name != &quot;QryAuthAns&quot;]">['<xsl:value-of select="@name"/>',<xsl:value-of select="."/>],</xsl:for-each>]
+                                      });
+
+                    </script>
+                <xsl:variable name="target">
+                  <xsl:value-of select="@name"/>
+                </xsl:variable>
+                  <div class="pie" id="chart_qtype_{$thisview2}_{$target}">[no data to display]</div>
+                </xsl:if>
+                <table class="counters">
+                  <xsl:for-each select="counters[@type=&quot;qtype&quot;]/counter">
+                    <xsl:sort select="."/>
+                    <xsl:variable name="css-class11">
+                      <xsl:choose>
+                        <xsl:when test="position() mod 2 = 0">even</xsl:when>
+                        <xsl:otherwise>odd</xsl:otherwise>
+                      </xsl:choose>
+                    </xsl:variable>
+                    <tr class="{$css-class11}">
+                      <th>
+                        <xsl:value-of select="@name"/>
+                      </th>
+                      <td>
+                        <xsl:value-of select="."/>
+                      </td>
+                    </tr>
+                  </xsl:for-each>
+                </table>
               </xsl:if>
-              <table class="counters">
-                <xsl:for-each select="counters[@type=&quot;qtype&quot;]/counter">
-                  <xsl:sort select="."/>
-                  <xsl:variable name="css-class11">
-                    <xsl:choose>
-                      <xsl:when test="position() mod 2 = 0">even</xsl:when>
-                      <xsl:otherwise>odd</xsl:otherwise>
-                    </xsl:choose>
-                  </xsl:variable>
-                  <tr class="{$css-class11}">
-                    <th>
-                      <xsl:value-of select="@name"/>
-                    </th>
-                    <td>
-                      <xsl:value-of select="."/>
-                    </td>
-                  </tr>
-                </xsl:for-each>
-              </table>
-            </xsl:if>
+            </xsl:for-each>
           </xsl:for-each>
-        </xsl:for-each>
-        <h2>Network Status</h2>
-        <table class="counters">
-          <tr>
-            <th>ID</th>
-            <th>Name</th>
-            <th>Type</th>
-            <th>References</th>
-            <th>LocalAddress</th>
-            <th>PeerAddress</th>
-            <th>State</th>
-          </tr>
-          <xsl:for-each select="socketmgr/sockets/socket">
-            <xsl:sort select="id"/>
-            <xsl:variable name="css-class12">
-              <xsl:choose>
-                <xsl:when test="position() mod 2 = 0">even</xsl:when>
-                <xsl:otherwise>odd</xsl:otherwise>
-              </xsl:choose>
-            </xsl:variable>
-            <tr class="{$css-class12}">
-              <td>
-                <xsl:value-of select="id"/>
-              </td>
-              <td>
-                <xsl:value-of select="name"/>
-              </td>
-              <td>
-                <xsl:value-of select="type"/>
-              </td>
-              <td>
-                <xsl:value-of select="references"/>
-              </td>
-              <td>
-                <xsl:value-of select="local-address"/>
-              </td>
-              <td>
-                <xsl:value-of select="peer-address"/>
-              </td>
-              <td>
-                <xsl:for-each select="states">
-                  <xsl:value-of select="."/>
-                </xsl:for-each>
-              </td>
+        </xsl:if>
+        <xsl:if test="socketmgr/sockets/socket">
+          <h2>Network Status</h2>
+          <table class="netstat">
+            <tr>
+              <th>ID</th>
+              <th>Name</th>
+              <th>Type</th>
+              <th>References</th>
+              <th>LocalAddress</th>
+              <th>PeerAddress</th>
+              <th>State</th>
             </tr>
-          </xsl:for-each>
-        </table>
-        <br/>
-        <h2>Task Manager Configuration</h2>
-        <table class="counters">
-          <tr>
-            <th class="even">Thread-Model</th>
-            <td>
-              <xsl:value-of select="taskmgr/thread-model/type"/>
-            </td>
-          </tr>
-          <tr class="odd">
-            <th>Worker Threads</th>
-            <td>
-              <xsl:value-of select="taskmgr/thread-model/worker-threads"/>
-            </td>
-          </tr>
-          <tr class="even">
-            <th>Default Quantum</th>
-            <td>
-              <xsl:value-of select="taskmgr/thread-model/default-quantum"/>
-            </td>
-          </tr>
-          <tr class="odd">
-            <th>Tasks Running</th>
-            <td>
-              <xsl:value-of select="taskmgr/thread-model/tasks-running"/>
-            </td>
-          </tr>
-        </table>
-        <br/>
-        <h2>Tasks</h2>
-        <table class="counters">
-          <tr>
-            <th>ID</th>
-            <th>Name</th>
-            <th>References</th>
-            <th>State</th>
-            <th>Quantum</th>
-          </tr>
-          <xsl:for-each select="taskmgr/tasks/task">
-            <xsl:sort select="name"/>
-            <xsl:variable name="css-class14">
-              <xsl:choose>
-                <xsl:when test="position() mod 2 = 0">even</xsl:when>
-                <xsl:otherwise>odd</xsl:otherwise>
-              </xsl:choose>
-            </xsl:variable>
-            <tr class="{$css-class14}">
-              <td>
-                <xsl:value-of select="id"/>
-              </td>
-              <td>
-                <xsl:value-of select="name"/>
-              </td>
-              <td>
-                <xsl:value-of select="references"/>
-              </td>
-              <td>
-                <xsl:value-of select="state"/>
-              </td>
+            <xsl:for-each select="socketmgr/sockets/socket">
+              <xsl:sort select="id"/>
+              <xsl:variable name="css-class12">
+                <xsl:choose>
+                  <xsl:when test="position() mod 2 = 0">even</xsl:when>
+                  <xsl:otherwise>odd</xsl:otherwise>
+                </xsl:choose>
+              </xsl:variable>
+              <tr class="{$css-class12}">
+                <td>
+                  <xsl:value-of select="id"/>
+                </td>
+                <td>
+                  <xsl:value-of select="name"/>
+                </td>
+                <td>
+                  <xsl:value-of select="type"/>
+                </td>
+                <td>
+                  <xsl:value-of select="references"/>
+                </td>
+                <td>
+                  <xsl:value-of select="local-address"/>
+                </td>
+                <td>
+                  <xsl:value-of select="peer-address"/>
+                </td>
+                <td>
+                  <xsl:for-each select="states">
+                    <xsl:value-of select="."/>
+                  </xsl:for-each>
+                </td>
+              </tr>
+            </xsl:for-each>
+          </table>
+          <br/>
+        </xsl:if>
+        <xsl:if test="taskmgr/thread-model/type">
+          <h2>Task Manager Configuration</h2>
+          <table class="counters">
+            <tr>
+              <th class="even">Thread-Model</th>
               <td>
-                <xsl:value-of select="quantum"/>
+                <xsl:value-of select="taskmgr/thread-model/type"/>
               </td>
             </tr>
-          </xsl:for-each>
-        </table>
-        <br/>
-        <h2>Memory Usage Summary</h2>
-        <table class="counters">
-          <xsl:for-each select="memory/summary/*">
-            <xsl:variable name="css-class13">
-              <xsl:choose>
-                <xsl:when test="position() mod 2 = 0">even</xsl:when>
-                <xsl:otherwise>odd</xsl:otherwise>
-              </xsl:choose>
-            </xsl:variable>
-            <tr class="{$css-class13}">
-              <th>
-                <xsl:value-of select="name()"/>
-              </th>
+            <tr class="odd">
+              <th>Worker Threads</th>
               <td>
-                <xsl:value-of select="."/>
+                <xsl:value-of select="taskmgr/thread-model/worker-threads"/>
               </td>
             </tr>
-          </xsl:for-each>
-        </table>
-        <br/>
-        <h2>Memory Contexts</h2>
-        <table class="counters">
-          <tr>
-            <th>ID</th>
-            <th>Name</th>
-            <th>References</th>
-            <th>TotalUse</th>
-            <th>InUse</th>
-            <th>MaxUse</th>
-            <th>BlockSize</th>
-            <th>Pools</th>
-            <th>HiWater</th>
-            <th>LoWater</th>
-          </tr>
-          <xsl:for-each select="memory/contexts/context">
-            <xsl:sort select="total" data-type="number" order="descending"/>
-            <xsl:variable name="css-class14">
-              <xsl:choose>
-                <xsl:when test="position() mod 2 = 0">even</xsl:when>
-                <xsl:otherwise>odd</xsl:otherwise>
-              </xsl:choose>
-            </xsl:variable>
-            <tr class="{$css-class14}">
-              <td>
-                <xsl:value-of select="id"/>
-              </td>
-              <td>
-                <xsl:value-of select="name"/>
-              </td>
-              <td>
-                <xsl:value-of select="references"/>
-              </td>
-              <td>
-                <xsl:value-of select="total"/>
-              </td>
-              <td>
-                <xsl:value-of select="inuse"/>
-              </td>
-              <td>
-                <xsl:value-of select="maxinuse"/>
-              </td>
-              <td>
-                <xsl:value-of select="blocksize"/>
-              </td>
-              <td>
-                <xsl:value-of select="pools"/>
-              </td>
+            <tr class="even">
+              <th>Default Quantum</th>
               <td>
-                <xsl:value-of select="hiwater"/>
+                <xsl:value-of select="taskmgr/thread-model/default-quantum"/>
               </td>
+            </tr>
+            <tr class="odd">
+              <th>Tasks Running</th>
               <td>
-                <xsl:value-of select="lowater"/>
+                <xsl:value-of select="taskmgr/thread-model/tasks-running"/>
               </td>
             </tr>
-          </xsl:for-each>
-        </table>
+          </table>
+          <br/>
+        </xsl:if>
+        <xsl:if test="taskmgr/tasks/task">
+          <h2>Tasks</h2>
+          <table class="tasks">
+            <tr>
+              <th>ID</th>
+              <th>Name</th>
+              <th>References</th>
+              <th>State</th>
+              <th>Quantum</th>
+            </tr>
+            <xsl:for-each select="taskmgr/tasks/task">
+              <xsl:sort select="name"/>
+              <xsl:variable name="css-class14">
+                <xsl:choose>
+                  <xsl:when test="position() mod 2 = 0">even</xsl:when>
+                  <xsl:otherwise>odd</xsl:otherwise>
+                </xsl:choose>
+              </xsl:variable>
+              <tr class="{$css-class14}">
+                <td>
+                  <xsl:value-of select="id"/>
+                </td>
+                <td>
+                  <xsl:value-of select="name"/>
+                </td>
+                <td>
+                  <xsl:value-of select="references"/>
+                </td>
+                <td>
+                  <xsl:value-of select="state"/>
+                </td>
+                <td>
+                  <xsl:value-of select="quantum"/>
+                </td>
+              </tr>
+            </xsl:for-each>
+          </table>
+          <br/>
+        </xsl:if>
+        <xsl:if test="memory/summary">
+          <h2>Memory Usage Summary</h2>
+          <table class="counters">
+            <xsl:for-each select="memory/summary/*">
+              <xsl:variable name="css-class13">
+                <xsl:choose>
+                  <xsl:when test="position() mod 2 = 0">even</xsl:when>
+                  <xsl:otherwise>odd</xsl:otherwise>
+                </xsl:choose>
+              </xsl:variable>
+              <tr class="{$css-class13}">
+                <th>
+                  <xsl:value-of select="name()"/>
+                </th>
+                <td>
+                  <xsl:value-of select="."/>
+                </td>
+              </tr>
+            </xsl:for-each>
+          </table>
+          <br/>
+        </xsl:if>
+        <xsl:if test="memory/contexts/context">
+          <h2>Memory Contexts</h2>
+          <table class="mctx">
+            <tr>
+              <th>ID</th>
+              <th>Name</th>
+              <th>References</th>
+              <th>TotalUse</th>
+              <th>InUse</th>
+              <th>MaxUse</th>
+              <th>BlockSize</th>
+              <th>Pools</th>
+              <th>HiWater</th>
+              <th>LoWater</th>
+            </tr>
+            <xsl:for-each select="memory/contexts/context">
+              <xsl:sort select="total" data-type="number" order="descending"/>
+              <xsl:variable name="css-class14">
+                <xsl:choose>
+                  <xsl:when test="position() mod 2 = 0">even</xsl:when>
+                  <xsl:otherwise>odd</xsl:otherwise>
+                </xsl:choose>
+              </xsl:variable>
+              <tr class="{$css-class14}">
+                <td>
+                  <xsl:value-of select="id"/>
+                </td>
+                <td>
+                  <xsl:value-of select="name"/>
+                </td>
+                <td>
+                  <xsl:value-of select="references"/>
+                </td>
+                <td>
+                  <xsl:value-of select="total"/>
+                </td>
+                <td>
+                  <xsl:value-of select="inuse"/>
+                </td>
+                <td>
+                  <xsl:value-of select="maxinuse"/>
+                </td>
+                <td>
+                  <xsl:value-of select="blocksize"/>
+                </td>
+                <td>
+                  <xsl:value-of select="pools"/>
+                </td>
+                <td>
+                  <xsl:value-of select="hiwater"/>
+                </td>
+                <td>
+                  <xsl:value-of select="lowater"/>
+                </td>
+              </tr>
+            </xsl:for-each>
+          </table>
+        </xsl:if>
         <hr/>
         <p class="footer">Internet Systems Consortium Inc.<br/><a href="http://www.isc.org">http://www.isc.org</a></p>
       </body>
index c55714a6fb7b0f7e9c7cbb5a3b4cf44c04ff0b19..c8a7373485645d8f1748f4bdbb254f39b7f7f199 100644 (file)
@@ -5,7 +5,7 @@
 static char xslmsg[] =
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
        "<!--\n"
-       " - Copyright (C) 2006-2009 Internet Systems Consortium, Inc. (\"ISC\")\n"
+       " - Copyright (C) 2012, 2013 Internet Systems Consortium, Inc. (\"ISC\")\n"
        " -\n"
        " - Permission to use, copy, modify, and/or distribute this software for any\n"
        " - purpose with or without fee is hereby granted, provided that the above\n"
@@ -19,63 +19,67 @@ static char xslmsg[] =
        " - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n"
        " - PERFORMANCE OF THIS SOFTWARE.\n"
        "-->\n"
+       "\n"
+       "<!-- $Id$ -->\n"
+       "\n"
        "<!-- \045Id: bind9.xsl,v 1.21 2009/01/27 23:47:54 tbox Exp \045 -->\n"
        "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns=\"http://www.w3.org/1999/xhtml\" version=\"1.0\">\n"
        " <xsl:output method=\"html\" indent=\"yes\" version=\"4.0\"/>\n"
-       " <xsl:template match=\"statistics[@version=&quot;3.0&quot;]\">\n"
+       " <xsl:template match=\"statistics[@version=&quot;3.3&quot;]\">\n"
        " <html>\n"
        " <head>\n"
        " <xsl:if test=\"system-property('xsl:vendor')!='Transformiix'\">\n"
        " <!-- Non Mozilla specific markup -->\n"
        " <script type=\"text/javascript\" src=\"https://www.google.com/jsapi\"/>\n"
        " <script type=\"text/javascript\">\n"
-       " \n"
+       "\n"
        " google.load(\"visualization\", \"1\", {packages:[\"corechart\"]});\n"
        " google.setOnLoadCallback(loadGraphs);\n"
        "\n"
        " var graphs=[];\n"
-       " \n"
-       " function drawChart(chart_title,target,data) {\n"
+       "\n"
+       " function drawChart(chart_title,target,style,data) {\n"
        " var data = google.visualization.arrayToDataTable(data);\n"
        "\n"
        " var options = {\n"
        " title: chart_title\n"
        " };\n"
-       " \n"
-       " var chart = new google.visualization.BarChart(document.getElementById(target));\n"
+       "\n"
+       " var chart;\n"
+       " if (style == \"barchart\") {\n"
+       " chart = new google.visualization.BarChart(document.getElementById(target));\n"
+       " chart.draw(data, options);\n"
+       " } else if (style == \"piechart\") {\n"
+       " chart = new google.visualization.PieChart(document.getElementById(target));\n"
        " chart.draw(data, options);\n"
        " }\n"
-       " \n"
+       " }\n"
+       "\n"
        " function loadGraphs(){\n"
-       " //alert(\"here we are!\");\n"
        " var g;\n"
-       " \n"
-       " // Server Incoming query Types\n"
+       "\n"
        " while(g = graphs.shift()){\n"
        " // alert(\"going for: \" + g.target);\n"
        " if(g.data.length > 1){\n"
-       " drawChart(g.title,g.target,g.data);\n"
+       " drawChart(g.title,g.target,g.style,g.data);\n"
        " }\n"
        " }\n"
        " }\n"
-       " \n"
-       " // Server Incoming Queries Types \n"
+       "\n"
+       " // Server Incoming Query Types \n"
        " graphs.push({\n"
        " 'title' : \"Server Incoming Query Types\",\n"
        " 'target': 'chart_incoming_qtypes',\n"
+       " 'style': 'barchart',\n"
        " 'data': [['Type','Counter'],<xsl:for-each select=\"server/counters[@type=&quot;qtype&quot;]/counter\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
        " });\n"
        "\n"
-       "\n"
-       " // Server Incoming Requests \n"
+       " // Server Incoming Requests by opcode\n"
        " graphs.push({\n"
-       " 'title' : \"Server Incoming Requests\",\n"
-       " 'target': 'chart_incoming_requests',\n"
-       " 'data': [['Requests','Counter'],<xsl:for-each select=\"server/counters[@type=&quot;opcode&quot;]/counter\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]});\n"
-       " \n"
-       " \n"
-       " \n"
-       " \n"
+       " 'title' : \"Server Incoming Requests by DNS Opcode\",\n"
+       " 'target': 'chart_incoming_opcodes',\n"
+       " 'style': 'barchart',\n"
+       " 'data': [['Opcode','Counter'],<xsl:for-each select=\"server/counters[@type=&quot;opcode&quot;]/counter[. &gt; 0 or substring(@name,1,3) != 'RES']\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]});\n"
        " </script>\n"
        " </xsl:if>\n"
        " <style type=\"text/css\">\n"
@@ -85,15 +89,15 @@ static char xslmsg[] =
        " color: #000000;\n"
        " font-size: 10pt;\n"
        " }\n"
-       " \n"
+       "\n"
        " .odd{\n"
        " background-color: #f0f0f0;\n"
        " }\n"
-       " \n"
+       "\n"
        " .even{\n"
        " background-color: #ffffff;\n"
        " }\n"
-       " \n"
+       "\n"
        " p.footer{\n"
        " font-style:italic;\n"
        " color: grey;\n"
@@ -108,21 +112,101 @@ static char xslmsg[] =
        " border: 1px solid grey;\n"
        " width: 500px;\n"
        " }\n"
-       " \n"
        " table.counters th {\n"
-       " text-align: center;\n"
+       " text-align: right;\n"
        " border: 1px solid grey;\n"
-       " width: 120px;\n"
+       " width: 150px;\n"
        " }\n"
-       " table.counters td{\n"
-       " text-align:center;\n"
-       " \n"
+       " table.counters td {\n"
+       " text-align: right;\n"
+       " font-family: monospace;\n"
        " }\n"
-       " \n"
        " table.counters tr:hover{\n"
        " background-color: #99ddff;\n"
        " }\n"
-       " \n"
+       "\n"
+       " table.info {\n"
+       " border: 1px solid grey;\n"
+       " width: 500px;\n"
+       " }\n"
+       " table.info th {\n"
+       " text-align: center;\n"
+       " border: 1px solid grey;\n"
+       " width: 150px;\n"
+       " }\n"
+       " table.info td {\n"
+       " text-align: center;\n"
+       " }\n"
+       " table.info tr:hover{\n"
+       " background-color: #99ddff;\n"
+       " }\n"
+       "\n"
+       " table.tasks {\n"
+       " border: 1px solid grey;\n"
+       " width: 500px;\n"
+       " }\n"
+       " table.tasks th {\n"
+       " text-align: center;\n"
+       " border: 1px solid grey;\n"
+       " width: 150px;\n"
+       " }\n"
+       " table.tasks td {\n"
+       " text-align: right;\n"
+       " font-family: monospace;\n"
+       " }\n"
+       " table.tasks td:nth-child(2) {\n"
+       " text-align: center;\n"
+       " }\n"
+       " table.tasks td:nth-child(4) {\n"
+       " text-align: center;\n"
+       " }\n"
+       " table.tasks tr:hover{\n"
+       " background-color: #99ddff;\n"
+       " }\n"
+       "\n"
+       " table.netstat {\n"
+       " border: 1px solid grey;\n"
+       " width: 500px;\n"
+       " }\n"
+       " table.netstat th {\n"
+       " text-align: center;\n"
+       " border: 1px solid grey;\n"
+       " width: 150px;\n"
+       " }\n"
+       " table.netstat td {\n"
+       " text-align: center;\n"
+       " }\n"
+       " table.netstat td:nth-child(4) {\n"
+       " text-align: right;\n"
+       " font-family: monospace;\n"
+       " }\n"
+       " table.netstat td:nth-child(7) {\n"
+       " text-align: left;\n"
+       " }\n"
+       " table.netstat tr:hover{\n"
+       " background-color: #99ddff;\n"
+       " }\n"
+       "\n"
+       " table.mctx {\n"
+       " border: 1px solid grey;\n"
+       " width: 500px;\n"
+       " }\n"
+       " table.mctx th {\n"
+       " text-align: center;\n"
+       " border: 1px solid grey;\n"
+       " }\n"
+       " table.mctx td {\n"
+       " text-align: right;\n"
+       " font-family: monospace;\n"
+       " }\n"
+       " table.mctx td:nth-child(-n+2) {\n"
+       " text-align: left;\n"
+       " width: 100px;\n"
+       " }\n"
+       " table.mctx tr:hover{\n"
+       " background-color: #99ddff;\n"
+       " }\n"
+       "\n"
        " .totals {\n"
        " background-color: rgb(1,169,206);\n"
        " color: #ffffff;\n"
@@ -162,20 +246,18 @@ static char xslmsg[] =
        " width:500px;\n"
        " text-align:center;\n"
        " }\n"
-       " \n"
+       "\n"
        " h3 {\n"
        " color: #444444;\n"
        " font-size: 12pt;\n"
        " width:500px;\n"
        " text-align:center;\n"
-       " \n"
        " }\n"
        " h4 {\n"
        " color: rgb(1,169,206);\n"
        " font-size: 10pt;\n"
        " width:500px;\n"
        " text-align:center;\n"
-       " \n"
        " }\n"
        "\n"
        " .pie {\n"
@@ -192,7 +274,7 @@ static char xslmsg[] =
        " </div>\n"
        " <hr/>\n"
        " <h2>Server Times</h2>\n"
-       " <table class=\"counters\">\n"
+       " <table class=\"info\">\n"
        " <tr>\n"
        " <th>Boot time:</th>\n"
        " <td>\n"
@@ -200,20 +282,23 @@ static char xslmsg[] =
        " </td>\n"
        " </tr>\n"
        " <tr>\n"
-       " <th>Sample time:</th>\n"
+       " <th>Current time:</th>\n"
        " <td>\n"
        " <xsl:value-of select=\"server/current-time\"/>\n"
        " </td>\n"
        " </tr>\n"
        " </table>\n"
        " <br/>\n"
-       " <h2>Incoming Requests</h2>\n"
+       " <xsl:if test=\"server/counters[@type=&quot;opcode&quot;]/counter[. &gt; 0]\">\n"
        " <xsl:if test=\"system-property('xsl:vendor')!='Transformiix'\">\n"
+       " <h2>Incoming Requests by DNS Opcode</h2>\n"
        " <!-- Non Mozilla specific markup -->\n"
-       " <div class=\"pie\" id=\"chart_incoming_requests\">[graph incoming requests]</div>\n"
+       " <div class=\"pie\" id=\"chart_incoming_opcodes\">\n"
+       " [cannot display chart]\n"
+       " </div>\n"
        " </xsl:if>\n"
        " <table class=\"counters\">\n"
-       " <xsl:for-each select=\"server/counters[@type=&quot;opcode&quot;]/counter\">\n"
+       " <xsl:for-each select=\"server/counters[@type=&quot;opcode&quot;]/counter[. &gt; 0 or substring(@name,1,3) != 'RES']\">\n"
        " <xsl:sort select=\".\" data-type=\"number\" order=\"descending\"/>\n"
        " <tr>\n"
        " <th>\n"
@@ -232,10 +317,14 @@ static char xslmsg[] =
        " </tr>\n"
        " </table>\n"
        " <br/>\n"
-       " <h3>Incoming Queries by Type</h3>\n"
+       " </xsl:if>\n"
+       " <xsl:if test=\"server/counters[@type=&quot;qtype&quot;]/counter\">\n"
        " <xsl:if test=\"system-property('xsl:vendor')!='Transformiix'\">\n"
        " <!-- Non Mozilla specific markup -->\n"
-       " <div class=\"pie\" id=\"chart_incoming_qtypes\">[graph incoming qtypes]</div>\n"
+       " <h3>Incoming Queries by Query Type</h3>\n"
+       " <div class=\"pie\" id=\"chart_incoming_qtypes\">\n"
+       " [cannot display chart]\n"
+       " </div>\n"
        " </xsl:if>\n"
        " <table class=\"counters\">\n"
        " <xsl:for-each select=\"server/counters[@type=&quot;qtype&quot;]/counter\">\n"
@@ -263,6 +352,8 @@ static char xslmsg[] =
        " </tr>\n"
        " </table>\n"
        " <br/>\n"
+       " </xsl:if>\n"
+       " <xsl:if test=\"views/view[count(counters[@type=&quot;resqtype&quot;]/counter) &gt; 0]\">\n"
        " <h2>Outgoing Queries per view</h2>\n"
        " <xsl:for-each select=\"views/view[count(counters[@type=&quot;resqtype&quot;]/counter) &gt; 0]\">\n"
        " <h3>View <xsl:value-of select=\"@name\"/></h3>\n"
@@ -270,16 +361,16 @@ static char xslmsg[] =
        " <!-- Non Mozilla specific markup -->\n"
        " <script type=\"text/javascript\">\n"
        " graphs.push({\n"
-       " 'title': \"Outgoing queries for view: <xsl:value-of select=\"@name\"/>\",\n"
+       " 'title': \"Outgoing Queries for view: <xsl:value-of select=\"@name\"/>\",\n"
        " 'target': 'chart_outgoing_queries_view_<xsl:value-of select=\"@name\"/>',\n"
+       " 'style': 'barchart',\n"
        " 'data': [['Type','Counter'],<xsl:for-each select=\"counters[@type=&quot;resqtype&quot;]/counter\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
        " });\n"
-       " \n"
        " </script>\n"
        " <xsl:variable name=\"target\">\n"
        " <xsl:value-of select=\"@name\"/>\n"
        " </xsl:variable>\n"
-       " <div class=\"pie\" id=\"chart_outgoing_queries_view_{$target}\"/>\n"
+       " <div class=\"pie\" id=\"chart_outgoing_queries_view_{$target}\">[no data to display]</div>\n"
        " </xsl:if>\n"
        " <table class=\"counters\">\n"
        " <xsl:for-each select=\"counters[@type=&quot;resqtype&quot;]/counter\">\n"
@@ -302,18 +393,20 @@ static char xslmsg[] =
        " </table>\n"
        " <br/>\n"
        " </xsl:for-each>\n"
+       " </xsl:if>\n"
+       " <xsl:if test=\"server/counters[@type=&quot;nsstat&quot;]/counter[.&gt;0]\">\n"
        " <h2>Server Statistics</h2>\n"
        " <xsl:if test=\"system-property('xsl:vendor')!='Transformiix'\">\n"
        " <!-- Non Mozilla specific markup -->\n"
        " <script type=\"text/javascript\">\n"
        " graphs.push({\n"
-       " 'title' : \"Server Response Types\",\n"
+       " 'title' : \"Server Counters\",\n"
        " 'target': 'chart_server_nsstat_restype',\n"
+       " 'style': 'barchart',\n"
        " 'data': [['Type','Counter'],<xsl:for-each select=\"server/counters[@type=&quot;nsstat&quot;]/counter[.&gt;0]\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
        " });\n"
-       " \n"
        " </script>\n"
-       " <div class=\"pie\" id=\"chart_server_nsstat_restype\"/>\n"
+       " <div class=\"pie\" id=\"chart_server_nsstat_restype\">[no data to display]</div>\n"
        " </xsl:if>\n"
        " <table class=\"counters\">\n"
        " <xsl:for-each select=\"server/counters[@type=&quot;nsstat&quot;]/counter[.&gt;0]\">\n"
@@ -335,18 +428,20 @@ static char xslmsg[] =
        " </xsl:for-each>\n"
        " </table>\n"
        " <br/>\n"
-       " <h2>Zone Maintenance Statistics</h2>\n"
+       " </xsl:if>\n"
+       " <xsl:if test=\"server/counters[@type=&quot;zonestat&quot;]/counter[.&gt;0]\">\n"
        " <xsl:if test=\"system-property('xsl:vendor')!='Transformiix'\">\n"
+       " <h2>Zone Maintenance Statistics</h2>\n"
        " <script type=\"text/javascript\">\n"
        " graphs.push({\n"
        " 'title' : \"Zone Maintenance Stats\",\n"
        " 'target': 'chart_server_zone_maint',\n"
-       " 'data': [['Type','Counter'],<xsl:for-each select=\"server/counters[@type=&quot;zonestat&quot;]/counter\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
+       " 'style': 'barchart',\n"
+       " 'data': [['Type','Counter'],<xsl:for-each select=\"server/counters[@type=&quot;zonestat&quot;]/counter[.&gt;0]\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
        " });\n"
-       "\n"
        " </script>\n"
        " <!-- Non Mozilla specific markup -->\n"
-       " <div class=\"pie\" id=\"chart_server_zone_maint\"/>\n"
+       " <div class=\"pie\" id=\"chart_server_zone_maint\">[no data to display]</div>\n"
        " </xsl:if>\n"
        " <table class=\"counters\">\n"
        " <xsl:for-each select=\"server/counters[@type=&quot;zonestat&quot;]/counter\">\n"
@@ -367,9 +462,11 @@ static char xslmsg[] =
        " </tr>\n"
        " </xsl:for-each>\n"
        " </table>\n"
+       " </xsl:if>\n"
+       " <xsl:if test=\"server/counters[@type=&quot;resstat&quot;]/counter[.&gt;0]\">\n"
        " <h2>Resolver Statistics (Common)</h2>\n"
        " <table class=\"counters\">\n"
-       " <xsl:for-each select=\"server/counters[@type=&quot;restat&quot;]/counter\">\n"
+       " <xsl:for-each select=\"server/counters[@type=&quot;resstat&quot;]/counter\">\n"
        " <xsl:sort select=\".\" data-type=\"number\" order=\"descending\"/>\n"
        " <xsl:variable name=\"css-class4\">\n"
        " <xsl:choose>\n"
@@ -387,7 +484,9 @@ static char xslmsg[] =
        " </tr>\n"
        " </xsl:for-each>\n"
        " </table>\n"
+       " </xsl:if>\n"
        " <xsl:for-each select=\"views/view\">\n"
+       " <xsl:if test=\"counters[@type=&quot;resstats&quot;]/counter[.&gt;0]\">\n"
        " <h3>Resolver Statistics for View <xsl:value-of select=\"@name\"/></h3>\n"
        " <table class=\"counters\">\n"
        " <xsl:for-each select=\"counters[@type=&quot;resstats&quot;]/counter[.&gt;0]\">\n"
@@ -408,9 +507,12 @@ static char xslmsg[] =
        " </tr>\n"
        " </xsl:for-each>\n"
        " </table>\n"
+       " </xsl:if>\n"
        " </xsl:for-each>\n"
-       " <h3>Cache DB RRsets for View <xsl:value-of select=\"@name\"/></h3>\n"
+       "\n"
        " <xsl:for-each select=\"views/view\">\n"
+       " <xsl:if test=\"cache/rrset\">\n"
+       " <h3>Cache DB RRsets for View <xsl:value-of select=\"@name\"/></h3>\n"
        " <table class=\"counters\">\n"
        " <xsl:for-each select=\"cache/rrset\">\n"
        " <xsl:variable name=\"css-class6\">\n"
@@ -430,7 +532,10 @@ static char xslmsg[] =
        " </xsl:for-each>\n"
        " </table>\n"
        " <br/>\n"
+       " </xsl:if>\n"
        " </xsl:for-each>\n"
+       "\n"
+       " <xsl:if test=\"server/counters[@type=&quot;sockstat&quot;]/counter[.&gt;0]\">\n"
        " <h2>Socket I/O Statistics</h2>\n"
        " <table class=\"counters\">\n"
        " <xsl:for-each select=\"server/counters[@type=&quot;sockstat&quot;]/counter[.&gt;0]\">\n"
@@ -451,7 +556,8 @@ static char xslmsg[] =
        " </xsl:for-each>\n"
        " </table>\n"
        " <br/>\n"
-       " <br/>\n"
+       " </xsl:if>\n"
+       " <xsl:if test=\"views/view[zones/zone/counters[@type=&quot;rcode&quot;]/counter &gt;0]\">\n"
        " <h2>Response Codes per view/zone</h2>\n"
        " <xsl:for-each select=\"views/view[zones/zone/counters[@type=&quot;rcode&quot;]/counter &gt;0]\">\n"
        " <h3>View <xsl:value-of select=\"@name\"/></h3>\n"
@@ -467,6 +573,7 @@ static char xslmsg[] =
        " graphs.push({\n"
        " 'title': \"Response Codes for zone <xsl:value-of select=\"@name\"/>\",\n"
        " 'target': 'chart_rescode_<xsl:value-of select=\"../../@name\"/>_<xsl:value-of select=\"@name\"/>',\n"
+       " 'style': 'barchart',\n"
        " 'data': [['Type','Counter'],<xsl:for-each select=\"counters[@type=&quot;rcode&quot;]/counter[.&gt;0 and @name != &quot;QryAuthAns&quot;]\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
        " });\n"
        "\n"
@@ -474,7 +581,7 @@ static char xslmsg[] =
        " <xsl:variable name=\"target\">\n"
        " <xsl:value-of select=\"@name\"/>\n"
        " </xsl:variable>\n"
-       " <div class=\"pie\" id=\"chart_rescode_{$thisview}_{$target}\"/>\n"
+       " <div class=\"pie\" id=\"chart_rescode_{$thisview}_{$target}\">[no data to display]</div>\n"
        " </xsl:if>\n"
        " <table class=\"counters\">\n"
        " <xsl:for-each select=\"counters[@type=&quot;rcode&quot;]/counter[.&gt;0 and @name != &quot;QryAuthAns&quot;]\">\n"
@@ -498,6 +605,8 @@ static char xslmsg[] =
        " </xsl:if>\n"
        " </xsl:for-each>\n"
        " </xsl:for-each>\n"
+       " </xsl:if>\n"
+       " <xsl:if test=\"views/view[zones/zone/counters[@type=&quot;qtype&quot;]/counter &gt;0]\">\n"
        " <h2>Received QTYPES per view/zone</h2>\n"
        " <xsl:for-each select=\"views/view[zones/zone/counters[@type=&quot;qtype&quot;]/counter &gt;0]\">\n"
        " <h3>View <xsl:value-of select=\"@name\"/></h3>\n"
@@ -513,6 +622,7 @@ static char xslmsg[] =
        " graphs.push({\n"
        " 'title': \"Query Types for zone <xsl:value-of select=\"@name\"/>\",\n"
        " 'target': 'chart_qtype_<xsl:value-of select=\"../../@name\"/>_<xsl:value-of select=\"@name\"/>',\n"
+       " 'style': 'barchart',\n"
        " 'data': [['Type','Counter'],<xsl:for-each select=\"counters[@type=&quot;qtype&quot;]/counter[.&gt;0 and @name != &quot;QryAuthAns&quot;]\">['<xsl:value-of select=\"@name\"/>',<xsl:value-of select=\".\"/>],</xsl:for-each>]\n"
        " });\n"
        "\n"
@@ -520,7 +630,7 @@ static char xslmsg[] =
        " <xsl:variable name=\"target\">\n"
        " <xsl:value-of select=\"@name\"/>\n"
        " </xsl:variable>\n"
-       " <div class=\"pie\" id=\"chart_qtype_{$thisview2}_{$target}\"/>\n"
+       " <div class=\"pie\" id=\"chart_qtype_{$thisview2}_{$target}\">[no data to display]</div>\n"
        " </xsl:if>\n"
        " <table class=\"counters\">\n"
        " <xsl:for-each select=\"counters[@type=&quot;qtype&quot;]/counter\">\n"
@@ -544,8 +654,10 @@ static char xslmsg[] =
        " </xsl:if>\n"
        " </xsl:for-each>\n"
        " </xsl:for-each>\n"
+       " </xsl:if>\n"
+       " <xsl:if test=\"socketmgr/sockets/socket\">\n"
        " <h2>Network Status</h2>\n"
-       " <table class=\"counters\">\n"
+       " <table class=\"netstat\">\n"
        " <tr>\n"
        " <th>ID</th>\n"
        " <th>Name</th>\n"
@@ -591,6 +703,8 @@ static char xslmsg[] =
        " </xsl:for-each>\n"
        " </table>\n"
        " <br/>\n"
+       " </xsl:if>\n"
+       " <xsl:if test=\"taskmgr/thread-model/type\">\n"
        " <h2>Task Manager Configuration</h2>\n"
        " <table class=\"counters\">\n"
        " <tr>\n"
@@ -619,8 +733,10 @@ static char xslmsg[] =
        " </tr>\n"
        " </table>\n"
        " <br/>\n"
+       " </xsl:if>\n"
+       " <xsl:if test=\"taskmgr/tasks/task\">\n"
        " <h2>Tasks</h2>\n"
-       " <table class=\"counters\">\n"
+       " <table class=\"tasks\">\n"
        " <tr>\n"
        " <th>ID</th>\n"
        " <th>Name</th>\n"
@@ -656,6 +772,8 @@ static char xslmsg[] =
        " </xsl:for-each>\n"
        " </table>\n"
        " <br/>\n"
+       " </xsl:if>\n"
+       " <xsl:if test=\"memory/summary\">\n"
        " <h2>Memory Usage Summary</h2>\n"
        " <table class=\"counters\">\n"
        " <xsl:for-each select=\"memory/summary/*\">\n"
@@ -676,8 +794,10 @@ static char xslmsg[] =
        " </xsl:for-each>\n"
        " </table>\n"
        " <br/>\n"
+       " </xsl:if>\n"
+       " <xsl:if test=\"memory/contexts/context\">\n"
        " <h2>Memory Contexts</h2>\n"
-       " <table class=\"counters\">\n"
+       " <table class=\"mctx\">\n"
        " <tr>\n"
        " <th>ID</th>\n"
        " <th>Name</th>\n"
@@ -732,6 +852,7 @@ static char xslmsg[] =
        " </tr>\n"
        " </xsl:for-each>\n"
        " </table>\n"
+       " </xsl:if>\n"
        " <hr/>\n"
        " <p class=\"footer\">Internet Systems Consortium Inc.<br/><a href=\"http://www.isc.org\">http://www.isc.org</a></p>\n"
        " </body>\n"
index 37e98a8e5a94352ab616cbb5a3bfb7597249c93f..b2ac232fdcf4f86e849c903f1a1d9dc3bade6fb1 100644 (file)
@@ -1057,7 +1057,7 @@ generatexml(ns_server_t *server, int *buflen, xmlChar **buf) {
                        ISC_XMLCHAR "type=\"text/xsl\" href=\"/bind9.ver3.xsl\""));
        TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "statistics"));
        TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "version",
-                                        ISC_XMLCHAR "3.0"));
+                                        ISC_XMLCHAR "3.3"));
 
        /* Set common fields for statistics dump */
        dumparg.type = statsformat_xml;
@@ -1093,9 +1093,9 @@ generatexml(ns_server_t *server, int *buflen, xmlChar **buf) {
                        if (dumparg.result != ISC_R_SUCCESS)
                                goto error;
                }
+else fprintf(stderr, "WTF WHERE'S RESQUERYRSTATS\n");
                TRY0(xmlTextWriterEndElement(writer));
 
-               /* <resstats> */
                TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "counters"));
                TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
                                                 ISC_XMLCHAR "resstats"));
@@ -1109,7 +1109,7 @@ generatexml(ns_server_t *server, int *buflen, xmlChar **buf) {
                        if (result != ISC_R_SUCCESS)
                                goto error;
                }
-               TRY0(xmlTextWriterEndElement(writer)); /* </resstats> */
+               TRY0(xmlTextWriterEndElement(writer));
 
                cacherrstats = dns_db_getrrsetstats(view->cachedb);
                if (cacherrstats != NULL) {
@@ -1155,8 +1155,8 @@ generatexml(ns_server_t *server, int *buflen, xmlChar **buf) {
        TRY0(xmlTextWriterWriteAttribute(writer, ISC_XMLCHAR "type",
                                         ISC_XMLCHAR "opcode"));
 
-       dns_opcodestats_dump(server->opcodestats, opcodestat_dump, &dumparg,
-                            0);
+       dns_opcodestats_dump(server->opcodestats, opcodestat_dump, &dumparg, 
+                            ISC_STATSDUMP_VERBOSE);
        if (dumparg.result != ISC_R_SUCCESS)
                goto error;
 
@@ -1370,10 +1370,10 @@ generatexml(ns_server_t *server, int *buflen, xmlChar **buf) {
        TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "server"));
        TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "boot-time"));
        TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR boottime));
-       TRY0(xmlTextWriterEndElement(writer));
+       TRY0(xmlTextWriterEndElement(writer)); /* boot-time */
        TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "current-time"));
        TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR nowstr));
-       TRY0(xmlTextWriterEndElement(writer));
+       TRY0(xmlTextWriterEndElement(writer)); /* current-time */
 
        TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "requests"));
        dumparg.result = ISC_R_SUCCESS;
@@ -1461,7 +1461,8 @@ wrap_xmlfree(isc_buffer_t *buffer, void *arg) {
 }
 
 static isc_result_t
-render_index(const char *url, const char *querystring, void *arg,
+render_index(const char *url, isc_httpdurl_t *urlinfo,
+            const char *querystring, const char *headers, void *arg,
             unsigned int *retcode, const char **retmsg, const char **mimetype,
             isc_buffer_t *b, isc_httpdfree_t **freecb,
             void **freecb_args)
@@ -1472,7 +1473,9 @@ render_index(const char *url, const char *querystring, void *arg,
        isc_result_t result;
 
        UNUSED(url);
+       UNUSED(urlinfo);
        UNUSED(querystring);
+       UNUSED(headers);
 
        result = generatexml(server, &msglen, &msg);
 
@@ -1495,22 +1498,56 @@ render_index(const char *url, const char *querystring, void *arg,
 #endif /* HAVE_LIBXML2 */
 
 static isc_result_t
-render_xsl(const char *url, const char *querystring, void *args,
-          unsigned int *retcode, const char **retmsg, const char **mimetype,
-          isc_buffer_t *b, isc_httpdfree_t **freecb,
-          void **freecb_args)
+render_xsl(const char *url, isc_httpdurl_t *urlinfo,
+          const char *querystring, const char *headers,
+          void *args, unsigned int *retcode, const char **retmsg,
+          const char **mimetype, isc_buffer_t *b,
+          isc_httpdfree_t **freecb, void **freecb_args)
 {
+       isc_result_t result;
+
        UNUSED(url);
        UNUSED(querystring);
        UNUSED(args);
 
+       *freecb = NULL;
+       *freecb_args = NULL;
+       *mimetype = "text/xslt+xml";
+
+       if (urlinfo->isstatic) {
+               isc_time_t when;
+               char *p = strcasestr(headers, "If-Modified-Since: ");
+
+               if (p != NULL) {
+                       time_t t1, t2;
+                       p += strlen("If-Modified-Since: ");
+                       result = isc_time_parsehttptimestamp(p, &when);
+                       if (result != ISC_R_SUCCESS)
+                               goto send;
+
+                       result = isc_time_secondsastimet(&when, &t1);
+                       if (result != ISC_R_SUCCESS)
+                               goto send;
+
+                       result = isc_time_secondsastimet(&urlinfo->loadtime,
+                                                        &t2);
+                       if (result != ISC_R_SUCCESS)
+                               goto send;
+
+                       if (t1 < t2)
+                               goto send;
+
+                       *retcode = 304;
+                       *retmsg = "Not modified";
+                       return (ISC_R_SUCCESS);
+               }
+       }
+
+ send:
        *retcode = 200;
        *retmsg = "OK";
-       *mimetype = "text/xslt+xml";
        isc_buffer_reinit(b, xslmsg, strlen(xslmsg));
        isc_buffer_add(b, strlen(xslmsg));
-       *freecb = NULL;
-       *freecb_args = NULL;
 
        return (ISC_R_SUCCESS);
 }
index 16a8c9fe142bc7764449047dfee70458ecc5b61d..8b82a7b1a3ac3e0af8eabf9609df573de50d0e98 100644 (file)
@@ -26,6 +26,7 @@
 #include <isc/socket.h>
 #include <isc/string.h>
 #include <isc/task.h>
+#include <isc/time.h>
 #include <isc/util.h>
 
 #include <string.h>
 #define HTTP_SENDGROW                  1024
 #define HTTP_SEND_MAXLEN               10240
 
-/*%
- * HTTP urls.  These are the URLs we manage, and the function to call to
- * provide the data for it.  We pass in the base url (so the same function
- * can handle multiple requests), and a structure to fill in to return a
- * result to the client.  We also pass in a pointer to be filled in for
- * the data cleanup function.
- */
-struct isc_httpdurl {
-       char                           *url;
-       isc_httpdaction_t              *action;
-       void                           *action_arg;
-       ISC_LINK(isc_httpdurl_t)        link;
-};
-
 #define HTTPD_CLOSE            0x0001 /* Got a Connection: close header */
 #define HTTPD_FOUNDHOST                0x0002 /* Got a Host: header */
 
@@ -87,6 +74,7 @@ struct isc_httpd {
         */
        char                    recvbuf[HTTP_RECVLEN]; /*%< receive buffer */
        isc_uint32_t            recvlen;        /*%< length recv'd */
+       char                   *headers;        /*%< set in process_request() */
        unsigned int            method;
        char                   *url;
        char                   *querystring;
@@ -217,20 +205,12 @@ static isc_result_t process_request(isc_httpd_t *, int);
 static void httpdmgr_destroy(isc_httpdmgr_t *);
 static isc_result_t grow_headerspace(isc_httpd_t *);
 static void reset_client(isc_httpd_t *httpd);
-static isc_result_t render_404(const char *, const char *,
-                              void *,
-                              unsigned int *, const char **,
-                              const char **, isc_buffer_t *,
-                              isc_httpdfree_t **, void **);
-static isc_result_t render_500(const char *, const char *,
-                              void *,
-                              unsigned int *, const char **,
-                              const char **, isc_buffer_t *,
-                              isc_httpdfree_t **, void **);
+
+static isc_httpdaction_t render_404;
+static isc_httpdaction_t render_500;
 
 static void
-destroy_client(isc_httpd_t **httpdp)
-{
+destroy_client(isc_httpd_t **httpdp) {
        isc_httpd_t *httpd = *httpdp;
        isc_httpdmgr_t *httpdmgr = httpd->mgr;
 
@@ -321,8 +301,7 @@ isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task,
 }
 
 static void
-httpdmgr_destroy(isc_httpdmgr_t *httpdmgr)
-{
+httpdmgr_destroy(isc_httpdmgr_t *httpdmgr) {
        isc_mem_t *mctx;
        isc_httpdurl_t *url;
 
@@ -379,8 +358,7 @@ httpdmgr_destroy(isc_httpdmgr_t *httpdmgr)
 #define BUFLENOK(s) (httpd->recvbuf - (s) < HTTP_RECVLEN)
 
 static isc_result_t
-process_request(isc_httpd_t *httpd, int length)
-{
+process_request(isc_httpd_t *httpd, int length) {
        char *s;
        char *p;
        int delim;
@@ -390,6 +368,7 @@ process_request(isc_httpd_t *httpd, int length)
        httpd->recvlen += length;
 
        httpd->recvbuf[httpd->recvlen] = 0;
+       httpd->headers = NULL;
 
        /*
         * If we don't find a blank line in our buffer, return that we need
@@ -494,6 +473,8 @@ process_request(isc_httpd_t *httpd, int length)
        p = s + 1;
        s = p;
 
+       httpd->headers = s;
+
        if (strstr(s, "Connection: close") != NULL)
                httpd->flags |= HTTPD_CLOSE;
 
@@ -513,8 +494,7 @@ process_request(isc_httpd_t *httpd, int length)
 }
 
 static void
-isc_httpd_accept(isc_task_t *task, isc_event_t *ev)
-{
+isc_httpd_accept(isc_task_t *task, isc_event_t *ev) {
        isc_result_t result;
        isc_httpdmgr_t *httpdmgr = ev->ev_arg;
        isc_httpd_t *httpd;
@@ -609,8 +589,8 @@ isc_httpd_accept(isc_task_t *task, isc_event_t *ev)
 }
 
 static isc_result_t
-render_404(const char *url, const char *querystring,
-          void *arg,
+render_404(const char *url, isc_httpdurl_t *urlinfo,
+          const char *querystring, const char *headers, void *arg,
           unsigned int *retcode, const char **retmsg,
           const char **mimetype, isc_buffer_t *b,
           isc_httpdfree_t **freecb, void **freecb_args)
@@ -618,7 +598,9 @@ render_404(const char *url, const char *querystring,
        static char msg[] = "No such URL.";
 
        UNUSED(url);
+       UNUSED(urlinfo);
        UNUSED(querystring);
+       UNUSED(headers);
        UNUSED(arg);
 
        *retcode = 404;
@@ -633,8 +615,8 @@ render_404(const char *url, const char *querystring,
 }
 
 static isc_result_t
-render_500(const char *url, const char *querystring,
-          void *arg,
+render_500(const char *url, isc_httpdurl_t *urlinfo,
+          const char *querystring, const char *headers, void *arg,
           unsigned int *retcode, const char **retmsg,
           const char **mimetype, isc_buffer_t *b,
           isc_httpdfree_t **freecb, void **freecb_args)
@@ -642,7 +624,9 @@ render_500(const char *url, const char *querystring,
        static char msg[] = "Internal server failure.";
 
        UNUSED(url);
+       UNUSED(urlinfo);
        UNUSED(querystring);
+       UNUSED(headers);
        UNUSED(arg);
 
        *retcode = 500;
@@ -657,8 +641,7 @@ render_500(const char *url, const char *querystring,
 }
 
 static void
-isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev)
-{
+isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev) {
        isc_region_t r;
        isc_result_t result;
        isc_httpd_t *httpd = ev->ev_arg;
@@ -710,8 +693,9 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev)
                url = ISC_LIST_NEXT(url, link);
        }
        if (url == NULL)
-               result = httpd->mgr->render_404(httpd->url, httpd->querystring,
-                                               NULL,
+               result = httpd->mgr->render_404(httpd->url, NULL,
+                                               httpd->querystring,
+                                               NULL, NULL,
                                                &httpd->retcode,
                                                &httpd->retmsg,
                                                &httpd->mimetype,
@@ -719,14 +703,18 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev)
                                                &httpd->freecb,
                                                &httpd->freecb_arg);
        else
-               result = url->action(httpd->url, httpd->querystring,
+               result = url->action(httpd->url, url,
+                                    httpd->querystring,
+                                    httpd->headers,
                                     url->action_arg,
                                     &httpd->retcode, &httpd->retmsg,
                                     &httpd->mimetype, &httpd->bodybuffer,
                                     &httpd->freecb, &httpd->freecb_arg);
        if (result != ISC_R_SUCCESS) {
-               result = httpd->mgr->render_500(httpd->url, httpd->querystring,
-                                               NULL, &httpd->retcode,
+               result = httpd->mgr->render_500(httpd->url, url,
+                                               httpd->querystring,
+                                               NULL, NULL,
+                                               &httpd->retcode,
                                                &httpd->retmsg,
                                                &httpd->mimetype,
                                                &httpd->bodybuffer,
@@ -739,9 +727,19 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev)
        isc_httpd_addheader(httpd, "Content-Type", httpd->mimetype);
        isc_httpd_addheader(httpd, "Date", datebuf);
        isc_httpd_addheader(httpd, "Expires", datebuf);
-       isc_httpd_addheader(httpd, "Last-Modified", datebuf);
-       isc_httpd_addheader(httpd, "Pragma: no-cache", NULL);
-       isc_httpd_addheader(httpd, "Cache-Control: no-cache", NULL);
+
+       if (url != NULL && url->isstatic) {
+               char loadbuf[32];
+               isc_time_formathttptimestamp(&url->loadtime,
+                                            loadbuf, sizeof(loadbuf));
+               isc_httpd_addheader(httpd, "Last-Modified", loadbuf);
+               isc_httpd_addheader(httpd, "Cache-Control: public", NULL);
+       } else {
+               isc_httpd_addheader(httpd, "Last-Modified", datebuf);
+               isc_httpd_addheader(httpd, "Pragma: no-cache", NULL);
+               isc_httpd_addheader(httpd, "Cache-Control: no-cache", NULL);
+       }
+
        isc_httpd_addheader(httpd, "Server: libisc", NULL);
        isc_httpd_addheaderuint(httpd, "Content-Length",
                                isc_buffer_usedlength(&httpd->bodybuffer));
@@ -766,8 +764,7 @@ isc_httpd_recvdone(isc_task_t *task, isc_event_t *ev)
 }
 
 void
-isc_httpdmgr_shutdown(isc_httpdmgr_t **httpdmgrp)
-{
+isc_httpdmgr_shutdown(isc_httpdmgr_t **httpdmgrp) {
        isc_httpdmgr_t *httpdmgr;
        isc_httpd_t *httpd;
        httpdmgr = *httpdmgrp;
@@ -794,8 +791,7 @@ isc_httpdmgr_shutdown(isc_httpdmgr_t **httpdmgrp)
 }
 
 static isc_result_t
-grow_headerspace(isc_httpd_t *httpd)
-{
+grow_headerspace(isc_httpd_t *httpd) {
        char *newspace;
        unsigned int newlen;
        isc_region_t r;
@@ -816,8 +812,7 @@ grow_headerspace(isc_httpd_t *httpd)
 }
 
 isc_result_t
-isc_httpd_response(isc_httpd_t *httpd)
-{
+isc_httpd_response(isc_httpd_t *httpd) {
        isc_result_t result;
        unsigned int needlen;
 
@@ -869,8 +864,7 @@ isc_httpd_addheader(isc_httpd_t *httpd, const char *name,
 }
 
 isc_result_t
-isc_httpd_endheaders(isc_httpd_t *httpd)
-{
+isc_httpd_endheaders(isc_httpd_t *httpd) {
        isc_result_t result;
 
        while (isc_buffer_availablelength(&httpd->headerbuffer) < 2) {
@@ -912,8 +906,7 @@ isc_httpd_addheaderuint(isc_httpd_t *httpd, const char *name, int val) {
 }
 
 static void
-isc_httpd_senddone(isc_task_t *task, isc_event_t *ev)
-{
+isc_httpd_senddone(isc_task_t *task, isc_event_t *ev) {
        isc_httpd_t *httpd = ev->ev_arg;
        isc_region_t r;
        isc_socketevent_t *sev = (isc_socketevent_t *)ev;
@@ -976,8 +969,7 @@ out:
 }
 
 static void
-reset_client(isc_httpd_t *httpd)
-{
+reset_client(isc_httpd_t *httpd) {
        /*
         * Catch errors here.  We MUST be in RECV mode, and we MUST NOT have
         * any outstanding buffers.  If we have buffers, we have a leak.
@@ -988,6 +980,7 @@ reset_client(isc_httpd_t *httpd)
 
        httpd->recvbuf[0] = 0;
        httpd->recvlen = 0;
+       httpd->headers = NULL;
        httpd->method = ISC_HTTPD_METHODUNKNOWN;
        httpd->url = NULL;
        httpd->querystring = NULL;
@@ -1001,6 +994,14 @@ reset_client(isc_httpd_t *httpd)
 isc_result_t
 isc_httpdmgr_addurl(isc_httpdmgr_t *httpdmgr, const char *url,
                    isc_httpdaction_t *func, void *arg)
+{
+       return (isc_httpdmgr_addurl2(httpdmgr, url, ISC_FALSE, func, arg));
+}
+
+isc_result_t
+isc_httpdmgr_addurl2(isc_httpdmgr_t *httpdmgr, const char *url,
+                    isc_boolean_t isstatic,
+                    isc_httpdaction_t *func, void *arg)
 {
        isc_httpdurl_t *item;
 
@@ -1021,6 +1022,9 @@ isc_httpdmgr_addurl(isc_httpdmgr_t *httpdmgr, const char *url,
 
        item->action = func;
        item->action_arg = arg;
+       item->isstatic = isstatic;
+       isc_time_now(&item->loadtime);
+
        ISC_LINK_INIT(item, link);
        ISC_LIST_APPEND(httpdmgr->urls, item, link);
 
index ba7f900198e464e8cca15512796f4a245191d5bb..d3b58dde2e25be4f084732a92ced117543f5b45f 100644 (file)
 #include <isc/types.h>
 #include <isc/mutex.h>
 #include <isc/task.h>
+#include <isc/time.h>
+
+/*%
+ * HTTP urls.  These are the URLs we manage, and the function to call to
+ * provide the data for it.  We pass in the base url (so the same function
+ * can handle multiple requests), and a structure to fill in to return a
+ * result to the client.  We also pass in a pointer to be filled in for
+ * the data cleanup function.
+ */
+struct isc_httpdurl {
+       char                           *url;
+       isc_httpdaction_t              *action;
+       void                           *action_arg;
+       isc_boolean_t                   isstatic;
+       isc_time_t                      loadtime;
+       ISC_LINK(isc_httpdurl_t)        link;
+};
 
 #define HTTPD_EVENTCLASS               ISC_EVENTCLASS(4300)
 #define HTTPD_SHUTDOWN                 (HTTPD_EVENTCLASS + 0x0001)
@@ -49,6 +66,11 @@ isc_result_t
 isc_httpdmgr_addurl(isc_httpdmgr_t *httpdmgr, const char *url,
                    isc_httpdaction_t *func, void *arg);
 
+isc_result_t
+isc_httpdmgr_addurl2(isc_httpdmgr_t *httpdmgr, const char *url,
+                    isc_boolean_t isstatic,
+                    isc_httpdaction_t *func, void *arg);
+
 isc_result_t
 isc_httpd_response(isc_httpd_t *httpd);
 
index 8dbf67ed109e4e54e5edee3a9a55e6ee0d85b685..4e1de84483289af6730882a614feb903834ee72d 100644 (file)
@@ -103,7 +103,9 @@ typedef int (*isc_sockfdwatch_t)(isc_task_t *, isc_socket_t *, void *, int);
 
 /* The following cannot be listed alphabetically due to forward reference */
 typedef isc_result_t (isc_httpdaction_t)(const char *url,
+                                        isc_httpdurl_t *urlinfo,
                                         const char *querystring,
+                                        const char *headers,
                                         void *arg,
                                         unsigned int *retcode,
                                         const char **retmsg,
index d81d854a24e291a13a4c8aa6e4ba0fa77b49bb40..179ab52866460b399d39c784ea30f19d7a64f259 100644 (file)
@@ -315,6 +315,16 @@ isc_time_formathttptimestamp(const isc_time_t *t, char *buf, unsigned int len);
  *
  */
 
+isc_result_t
+isc_time_parsehttptimestamp(char *input, isc_time_t *t);
+/*%<
+ * Parse the time in 'input' into the isc_time_t pointed to by 't',
+ * expecting a format like "Mon, 30 Aug 2000 04:06:47 GMT"
+ *
+ *  Requires:
+ *\li      'buf' and 't' are not NULL.
+ */
+
 void
 isc_time_formatISO8601(const isc_time_t *t, char *buf, unsigned int len);
 /*%<
index e820afb1eaa079df2014475d2164e7dc0d366924..941a3188bbbbc54401e2f176b447a0774837e557 100644 (file)
@@ -407,6 +407,24 @@ isc_time_formathttptimestamp(const isc_time_t *t, char *buf, unsigned int len) {
        INSIST(flen < len);
 }
 
+isc_result_t
+isc_time_parsehttptimestamp(char *buf, isc_time_t *t) {
+       struct tm t_tm;
+       time_t when;
+       char *p;
+
+       REQUIRE(buf != NULL);
+       REQUIRE(t != NULL);
+       p = strptime(buf, "%a, %d %b %Y %H:%M:%S %Z", &t_tm);
+       if (p == NULL)
+               return (ISC_R_UNEXPECTED);
+       when = timegm(&t_tm);
+       if (when == -1)
+               return (ISC_R_UNEXPECTED);
+       isc_time_set(t, when, 0);
+       return (ISC_R_SUCCESS);
+}
+
 void
 isc_time_formatISO8601(const isc_time_t *t, char *buf, unsigned int len) {
        time_t now;