Author: buildbot Date: Tue Sep 17 14:26:04 2013 New Revision: 878821 Log: Staging update by buildbot for sling
Modified: websites/staging/sling/trunk/content/ (props changed) websites/staging/sling/trunk/content/documentation/bundles/jconsole-hc.jpg websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html Propchange: websites/staging/sling/trunk/content/ ------------------------------------------------------------------------------ --- cms:source-revision (original) +++ cms:source-revision Tue Sep 17 14:26:04 2013 @@ -1 +1 @@ -1524044 +1524060 Modified: websites/staging/sling/trunk/content/documentation/bundles/jconsole-hc.jpg ============================================================================== Binary files - no diff available. Modified: websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html ============================================================================== --- websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html (original) +++ websites/staging/sling/trunk/content/documentation/bundles/sling-health-check-tool.html Tue Sep 17 14:26:04 2013 @@ -104,49 +104,72 @@ supplying MBeans that expose the require </pre></div> -<p>The Result provides a <em>Status</em> (OK, WARN, CRITICAL etc.) and a human-readable log which provides additional info, including optional DEBUG messages -that help troubleshooting. The Result log is not stricly tied to a logging model, so <code>HealthCheck</code>s are free to invent their own types of logging messages -if needed. See the <code>org.apache.sling.hc.api.Result</code> class and its tests for more details. </p> +<p>Where <code>Result</code> is a simple immutable class that provides a <code>Status</code> (OK, WARN, CRITICAL etc.) and one or more log-like messages that +can provide more info about what, if anything, went wrong.</p> +<div class="codehilite"><pre><span class="n">public</span> <span class="n">class</span> <span class="n">Result</span> <span class="n">implements</span> <span class="n">Iterable</span> <span class="o"><</span><span class="n">ResultLog</span><span class="p">.</span><span class="n">Entry</span><span class="o">></span> <span class="p">{</span> + + <span class="n">public</span> <span class="n">boolean</span> <span class="n">isOk</span><span class="p">()</span> <span class="p">{</span> + <span class="k">return</span> <span class="n">getStatus</span><span class="p">().</span><span class="n">equals</span><span class="p">(</span><span class="n">Status</span><span class="p">.</span><span class="n">OK</span><span class="p">);</span> + <span class="p">}</span> + + <span class="n">public</span> <span class="n">Status</span> <span class="n">getStatus</span><span class="p">()</span> <span class="p">{</span> + <span class="k">return</span> <span class="n">resultLog</span><span class="p">.</span><span class="n">getAggregateStatus</span><span class="p">();</span> + <span class="p">}</span> + + <span class="p">@</span><span class="n">Override</span> + <span class="n">public</span> <span class="n">Iterator</span><span class="o"><</span><span class="n">ResultLog</span><span class="p">.</span><span class="n">Entry</span><span class="o">></span> <span class="n">iterator</span><span class="p">()</span> <span class="p">{</span> + <span class="k">return</span> <span class="n">resultLog</span><span class="p">.</span><span class="n">iterator</span><span class="p">();</span> + <span class="p">}</span> + + <span class="p">...</span> <span class="n">details</span> <span class="n">omitted</span> +<span class="p">}</span> +</pre></div> + + <p><code>HealthCheck</code> services can be selected for execution based on their <code>hc.tags</code> multi-value service property. </p> <p>The <code>HealthCheckFilter</code> utility accepts positive and negative tag parameters, so that <code>-security,sling</code> selects all <code>HealthCheck</code> having the <code>sling</code> tag but not the <code>security</code> tag, for example.</p> -<p>Besides executing them programatically, Health checks can be executed via a webconsole plugin or via JMX, +<p>Besides executing them programmatically, Health checks can be executed via a webconsole plugin or via JMX, as described below.</p> <h2 id="health-check-bundles">Health Check bundles</h2> -<p>The Health Check subsystem consists of the following bundles, which are described below in more detail:</p> +<p>The Health Check subsystem consists of the following bundles:</p> <ul> -<li>The only required bundle is <code>org.apache.sling.hc.api</code> which provides the API and some utility classes.</li> -<li><code>org.apache.sling.hc.healthchecks</code> provides default <code>HealthCheck</code> services.</li> -<li><code>org.apache.sling.hc.webconsole</code> provides the Webconsole plugin.</li> -<li><code>org.apache.sling.hc.jmx</code> provides JMX MBeans to execute <code>HealthCheck</code>s.</li> -<li><code>org.apache.sling.hc.samples</code> provides sample OSGi configurations that demonstrate the default <code>HealthCheck</code>s. These configurations are provided as Sling content, so the Sling Installer is required to activate them.</li> +<li>The only required bundle is <code>org.apache.sling.hc.core</code> which provides the API, some utility classes and some generally useful <code>HealthCheck</code> services. </li> +<li><code>org.apache.sling.hc.support</code> provides more Sling-specific <code>HealthCheck</code> services.</li> +<li><code>org.apache.sling.hc.webconsole</code> provides the Webconsole plugin described below.</li> +<li><code>org.apache.sling.hc.jmx</code> provides JMX MBeans that execute <code>HealthCheck</code>s.</li> +<li><code>org.apache.sling.hc.samples</code> provides sample OSGi configurations and <code>HealthCheck</code> services. The sample configurations are provided as Sling content, so the Sling Installer is required to activate them.</li> </ul> <h2 id="out-of-the-box-healthcheck-services">Out-of-the-box <code>HealthCheck</code> services</h2> -<p>A useful set of default <code>HealthCheck</code>s is provided by the <code>org.apache.sling.hc.healthchecks</code> bundle. </p> +<p>The following default <code>HealthCheck</code> services are provided by the <code>org.apache.sling.hc.core</code> bundle: </p> <p>The <code>org.apache.sling.hc.samples</code> bundle provides OSGi configurations that demonstrate them.</p> <ul> <li><code>JmxAttributeHealthCheck</code> checks the value of a single JMX attribute and supports ranges like <em>between 12 and 42</em>. </li> -<li><code>SlingRequestStatusHealthCheck</code> checks the HTTP status of Sling requests. </li> <li><code>ScriptableHealthCheck</code> evaluates an expression written in any scripting language that Sling supports, and provides bindings to access JMX attributes and OSGi bundles states. </li> -<li><code>DefaultLoginsHealthCheck</code> can be used to verify that the default Sling logins fail. </li> <li><code>CompositeHealthCheck</code> executes a set of <code>HealthCheck</code> selected by tags, useful for creating higher-level checks.</li> </ul> +<p>And a few more Sling-specific ones are provided by the <code>org.apache.sling.hc.support</code> bundle:</p> +<ul> +<li><code>SlingRequestStatusHealthCheck</code> checks the HTTP status of Sling requests. </li> +<li><code>DefaultLoginsHealthCheck</code> can be used to verify that the default Sling logins fail. </li> +</ul> +<p>Finally, the <code>org.apache.sling.hc.samples</code> bundle provides an example <code>OsgiScriptBindingsProvider</code> for the default <code>ScriptableHealthCheck</code>, +which provides OSGi-related information to health check script expressions.</p> <h2 id="configuring-health-checks">Configuring health checks</h2> <p><code>HealthCheck</code> services are created via OSGi configurations, the details of which are defined by each service implementation.</p> -<p>Here's a <code>ScriptableHealthCheck</code> example configuration provided by the <code>org.apache.sling.hc.samples</code> bundle:</p> +<p>As an example, here's a <code>ScriptableHealthCheck</code> configuration provided by the <code>org.apache.sling.hc.samples</code> bundle:</p> <div class="codehilite"><pre><span class="n">Factory</span> <span class="n">PID</span> <span class="p">=</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">sling</span><span class="p">.</span><span class="n">hc</span><span class="p">.</span><span class="n">ScriptableHealthCheck</span> -<span class="n">PID</span> <span class="p">=</span> <span class="n">org</span><span class="p">.</span><span class="n">apache</span><span class="p">.</span><span class="n">sling</span><span class="p">.</span><span class="n">hc</span><span class="p">.</span><span class="n">ScriptableHealthCheck</span><span class="p">.</span>1523<span class="n">a6db</span><span class="o">-</span>12324 -<span class="n">hc</span><span class="p">.</span><span class="n">mbean</span><span class="p">.</span><span class="n">name</span> <span class="p">=</span> <span class="n">InactiveBundlesCheck</span> -<span class="n">hc</span><span class="p">.</span><span class="n">name</span> <span class="p">=</span> <span class="n">No</span> <span class="n">inactive</span> <span class="n">bundles</span> -<span class="n">hc</span><span class="p">.</span><span class="n">tags</span> <span class="p">=</span> <span class="p">[</span><span class="n">bundles</span><span class="p">,</span> <span class="n">script</span><span class="p">]</span> -<span class="n">expression</span> <span class="p">=</span> <span class="n">osgi</span><span class="p">.</span><span class="n">inactiveBundlesCount</span><span class="p">()</span> <span class="o">==</span> 0 -<span class="n">language</span><span class="p">.</span><span class="n">extension</span> <span class="p">=</span> <span class="n">ecma</span> +"<span class="n">hc</span><span class="p">.</span><span class="n">name</span>" <span class="p">:</span> "<span class="n">LoadedClassCount</span> <span class="n">and</span> <span class="n">ManagementSpecVersion</span> <span class="n">are</span> <span class="n">in</span> <span class="n">range</span>" +"<span class="n">hc</span><span class="p">.</span><span class="n">mbean</span><span class="p">.</span><span class="n">name</span>" <span class="p">:</span> "<span class="n">LoadedClassCount</span> <span class="n">and</span> <span class="n">ManagementSpecVersion</span>" +"<span class="n">hc</span><span class="p">.</span><span class="n">tags</span>" <span class="p">:</span> <span class="p">[</span><span class="n">jvm</span><span class="p">,</span> <span class="n">script</span><span class="p">]</span> +"<span class="n">expression</span>" <span class="p">:</span> "<span class="n">jmx</span><span class="p">.</span><span class="n">attribute</span><span class="p">(</span><span class="s">'java.lang:type=ClassLoading'</span><span class="p">,</span> <span class="s">'LoadedClassCount'</span><span class="p">)</span> <span class="o">></span> 10 <span class="o">&&</span> <span class="n">jmx</span><span class="p">.</span><span class="n">attribute</span><span class="p">(</span><span class="s">'java.lang:type=Runtime'</span><span class="p">,</span> <span class="s">'ManagementSpecVersion'</span><span class="p">)</span> <span class="o">></span> 1" +"<span class="n">language</span><span class="p">.</span><span class="n">extension</span>" <span class="p">:</span> "<span class="n">ecma</span>" </pre></div> -<p>The service properties starting with the <code>hc.</code> prefix in this example should be provided by all -<code>HealthCheck</code> services.</p> +<p>The service properties starting with the <code>hc.</code> prefix in this example should be provided by all <code>HealthCheck</code> services. The <code>hc.mbean.name</code> +is optional, if not provided no MBean is created for that <code>HealthCheck</code>.</p> <h2 id="webconsole-plugin">Webconsole plugin</h2> <p>If the <code>org.apache.sling.hc.webconsole</code> bundle is active, a webconsole plugin at <code>/system/console/healthcheck</code> allows for executing health checks, optionally selected @@ -156,12 +179,14 @@ checks that have a non-OK status.</p> <p>The screenshot below shows an example, as of svn revision 1513462.</p> <p><img src="sling-hc-plugin.jpg" style="max-width:700px" alt="Health Check Webconsole Plugin"/></p> <h2 id="jmx-access-to-health-checks">JMX access to health checks</h2> -<p>If the <code>org.apache.sling.hc.jmx</code> bundle is active, a JMX MBean is created for each <code>HealthCheck</code> which has the service property 'hc.mbean.name' service property set. All health check MBeans are registered in the domain 'org.apache.sling.healthcheck' with a type of 'HealthCheck'</p> +<p>If the <code>org.apache.sling.hc.jmx</code> bundle is active, a JMX MBean is created for each <code>HealthCheck</code> which has the +service property 'hc.mbean.name' service property set. All health check MBeans are registered in the +domain 'org.apache.sling.healthcheck' with a type of 'HealthCheck'</p> <p>The MBean gives access to the <code>Result</code> and the log, as shown on the screenshot below. </p> <p>See the example configurations of the <code>org.apache.sling.hc.samples</code> for more details.</p> <p><img src="jconsole-hc.jpg" style="max-width:700px" alt="JConsole showing Sling Health Check MBeans"/></p> <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;"> - Rev. 1524044 by bdelacretaz on Tue, 17 Sep 2013 13:52:45 +0000 + Rev. 1524059 by bdelacretaz on Tue, 17 Sep 2013 14:16:51 +0000 </div> <div class="trademarkFooter"> Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project