Halfway through the week I realised that I might have overreached myself just a little by promising to deliver the future and then most of the fun I had this week was still to come.

So, I'll postphone the future to next week and give you a short troubleshooting tip this week. For sometimes things go wrong. Networks can flap, disks can fail, processors can overheat. And then there's the OS, the JVM, ... Sometimes it is just amazing that anything works at all.

There is of course the Status tab in the HTTPBackend Fulcrum that has live graphs to study, but there is also the Requests and Threads page in the Developer tab.

Now this is a static page and I needed the information on just one specific thread at a more frequent interval. So I wrote a new tool :

        <group name="threadname">
          <regex type="anything"/>
        <argument name="operand">netkernel:/k</argument>
        <argument name="operator">res:/resources/stylesheets/kerneldetail.xsl</argument>
        <argument name="threadname" method="as-string">arg:threadname</argument>

Did I say write ? No code (after no sql it is now time for the new paradigm, no code) of course. The netkernel:/k resource provides the raw data and I filter that with xslt :
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  <xsl:output method="xml" 
  <xsl:param name="threadname" nk:class="java.lang.String" />

  <xsl:template match="/k">
    <xsl:copy-of select="threads/thread[name=$threadname]"/>

And that's it. Put in a small script ... for example like this :
while true
 curl http://localhost:1060/tools/kerneldetail/ConcurrentCacheCullThread >> /var/tmp/culler.out
 sleep 10
And collect all the data you want with minimum system impact.

So, next week I will deliver the future as promised.