Author: buildbot Date: Wed Aug 12 14:15:21 2015 New Revision: 961625 Log: Staging update by buildbot for sling
Modified: websites/staging/sling/trunk/content/ (props changed) 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 Wed Aug 12 14:15:21 2015 @@ -1 +1 @@ -1695337 +1695530 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 Wed Aug 12 14:15:21 2015 @@ -39,7 +39,18 @@ </div> <div class="menu"> - <p><strong><a href="/documentation.html">Documentation</a></strong> <br /> + <style type="text/css"> +/* The following code is added by mdx_elementid.py + It was originally lifted from http://subversion.apache.org/style/site.css */ +/* + * Hide class="elementid-permalink", except when an enclosing heading + * has the :hover property. + */ +.headerlink, .elementid-permalink { + visibility: hidden; +} +h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style> +<p><strong><a href="/documentation.html">Documentation</a></strong> <br /> <a href="/documentation/getting-started.html">Getting Started</a> <br /> <a href="/documentation/the-sling-engine.html">The Sling Engine</a> <br /> <a href="/documentation/development.html">Development</a> <br /> @@ -90,7 +101,18 @@ <h1>Sling Health Check Tools</h1> - <p>Based on simple <code>HealthCheck</code> OSGi services, the Sling Health Check Tools ("hc" in short form) are used to + <style type="text/css"> +/* The following code is added by mdx_elementid.py + It was originally lifted from http://subversion.apache.org/style/site.css */ +/* + * Hide class="elementid-permalink", except when an enclosing heading + * has the :hover property. + */ +.headerlink, .elementid-permalink { + visibility: hidden; +} +h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style> +<p>Based on simple <code>HealthCheck</code> OSGi services, the Sling Health Check Tools ("hc" in short form) are used to check the health of live Sling systems, based on inputs like JMX MBean attribute values, OSGi framework information, Sling requests status, etc.</p> <p>Health checks are easily extensible either by configuring the supplied default <code>HealthCheck</code> services, by @@ -100,7 +122,7 @@ supplying MBeans that expose the require <li>Source code at <a href="http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck">http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/healthcheck</a></li> <li>adaptTo 2013 slides about Health Checks at <a href="http://www.slideshare.net/bdelacretaz/slinghc-bdelacretazadaptto2013">http://www.slideshare.net/bdelacretaz/slinghc-bdelacretazadaptto2013</a></li> </ul> -<h2 id="use-cases">Use cases</h2> +<h2 id="use-cases">Use cases<a class="headerlink" href="#use-cases" title="Permanent link">¶</a></h2> <p>Health checks can be used for various purposes, for example:</p> <ul> <li>Verify that performance counters are in range.</li> @@ -114,7 +136,7 @@ supplying MBeans that expose the require checks once they are configured with the corresponding tags.</p> <p>The out of the box health check services also allow for using them as JMX aggregators and processors, which take JMX attribute values as input and make the results accessible via JMX MBeans.</p> -<h2 id="whats-a-healthcheck">What's a <code>HealthCheck</code> ?</h2> +<h2 id="whats-a-healthcheck">What's a <code>HealthCheck</code> ?<a class="headerlink" href="#whats-a-healthcheck" title="Permanent link">¶</a></h2> <p>A <code>HealthCheck</code> is just an OSGi service that returns a <code>Result</code>.</p> <div class="codehilite"><pre><span class="n">public</span> <span class="n">interface</span> <span class="n">HealthCheck</span> <span class="p">{</span> @@ -154,7 +176,7 @@ can provide more info about what, if any 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 programmatically, Health checks can be executed via a webconsole plugin or via JMX, as described below.</p> -<h3 id="slinghealthcheck-annotation">SlingHealthCheck annotation</h3> +<h3 id="slinghealthcheck-annotation">SlingHealthCheck annotation<a class="headerlink" href="#slinghealthcheck-annotation" title="Permanent link">¶</a></h3> <p>The <code>SlingHealthCheck</code> annotation makes it easier to specify the required <code>HealthCheck</code> service properties.</p> <p>Here's an example from the <code>samples</code> module - see the <code>annotations</code> module for more details.</p> <div class="codehilite"><pre><span class="p">@</span><span class="n">SlingHealthCheck</span><span class="p">(</span> @@ -173,7 +195,7 @@ as described below.</p> </pre></div> -<h2 id="health-check-bundles">Health Check bundles</h2> +<h2 id="health-check-bundles">Health Check bundles<a class="headerlink" href="#health-check-bundles" title="Permanent link">¶</a></h2> <p>The Health Check subsystem consists of the following bundles:</p> <ul> <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> @@ -184,7 +206,7 @@ as described below.</p> <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> <li><code>org.apache.sling.hc.junit.bridge</code> makes selected Health Checks available as server-side JUnit tests. See below for more info. </li> </ul> -<h2 id="out-of-the-box-healthcheck-services">Out-of-the-box <code>HealthCheck</code> services</h2> +<h2 id="out-of-the-box-healthcheck-services">Out-of-the-box <code>HealthCheck</code> services<a class="headerlink" href="#out-of-the-box-healthcheck-services" title="Permanent link">¶</a></h2> <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> @@ -201,7 +223,7 @@ as described below.</p> the <code>org.apache.sling.junit.healthcheck</code> bundle.</p> <p>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> +<h2 id="configuring-health-checks">Configuring health checks<a class="headerlink" href="#configuring-health-checks" title="Permanent link">¶</a></h2> <p><code>HealthCheck</code> services are created via OSGi configurations, the details of which are defined by each service implementation.</p> <p>As an example, here's a <code>ScriptableHealthCheck</code> configuration provided by the <code>org.apache.sling.hc.samples</code> bundle:</p> @@ -218,7 +240,7 @@ service implementation.</p> is optional, if not provided no MBean is created for that <code>HealthCheck</code>.</p> <p>The optional <code>hc.async.cronExpression</code> service property is used to schedule the execution of a <code>HealthCheck</code> at regular intervals, using a cron expression as specified by the <a href="/documentation/bundles/scheduler-service-commons-scheduler.html">Sling Scheduler</a> module.</p> -<h2 id="webconsole-plugin">Webconsole plugin</h2> +<h2 id="webconsole-plugin">Webconsole plugin<a class="headerlink" href="#webconsole-plugin" title="Permanent link">¶</a></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 based on their tags (positive and negative selection, see the <code>HealthCheckFilter</code> mention above).</p> @@ -226,14 +248,24 @@ based on their tags (positive and negati checks that have a non-OK status.</p> <p>The screenshot below shows an example, as of svn revision 1513462.</p> <p><img alt="Health Check Webconsole Plugin" src="sling-hc-plugin.jpg" /></p> -<h2 id="jmx-access-to-health-checks">JMX access to health checks</h2> +<h2 id="jmx-access-to-health-checks">JMX access to health checks<a class="headerlink" href="#jmx-access-to-health-checks" title="Permanent link">¶</a></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 <code>hc.mbean.name</code> service property set. All health check MBeans are registered in the domain <code>org.apache.sling.healthcheck</code> with a type of <code>HealthCheck</code>.</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 alt="JConsole showing Sling Health Check MBeans" src="jconsole-hc.jpg" /></p> -<h2 id="health-checks-as-server-side-junit-tests">Health Checks as server-side JUnit tests</h2> +<h2 id="health-checks-servlet">Health Checks Servlet<a class="headerlink" href="#health-checks-servlet" title="Permanent link">¶</a></h2> +<p>Starting with version 1.2.4 of the <code>org.apache.sling.hc.core</code> bundle, a flexible Health Checks execution servlet is available. It provides +similar features to the Web Console plugin described above, with output in HTML, JSON, JSONP and TXT formats.</p> +<p>The Health Checks Servlet is disabled by default, to enable it create an OSGi configuration like</p> +<p>PID = org.apache.sling.hc.core.impl.servlet.HealthCheckExecutorServlet + servletPath = /system/health</p> +<p>which specifies the servlet's base path. That URL then returns an HTML page, by default with the results of all active health checks and +with instructions at the end of the page about which URL parameters can be used to select specific Health Checks and control their execution +and output format.</p> +<p>Note that <em>the Health Checks Servlet doesn't do any access control by itself</em>, so make sure the configured path is secure before enabling it.</p> +<h2 id="health-checks-as-server-side-junit-tests">Health Checks as server-side JUnit tests<a class="headerlink" href="#health-checks-as-server-side-junit-tests" title="Permanent link">¶</a></h2> <p>The <code>org.apache.sling.hc.junit.bridge</code> bundle makes selected Health Checks available as server-side JUnit tests. </p> <p>It requires the <code>org.apache.sling.junit.core bundle</code> which provides the server-side JUnit tests infrastructure.</p> <p>The idea is to implement the smoke tests of your system, for example, as health checks. You can then run them @@ -245,7 +277,7 @@ to run the corresponding Health Checks.< <p>To run the Health Check tests at build time, see the <a href="http://svn.apache.org/repos/asf/sling/trunk/testing/samples/integration-tests">testing/samples/integration-tests</a> sample module.</p> <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;"> - Rev. 1614841 by bdelacretaz on Thu, 31 Jul 2014 09:40:21 +0000 + Rev. 1695530 by bdelacretaz on Wed, 12 Aug 2015 14:15:07 +0000 </div> <div class="trademarkFooter"> Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project