Author: buildbot Date: Tue Oct 18 11:37:11 2016 New Revision: 999602 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 Tue Oct 18 11:37:11 2016 @@ -1 +1 @@ -1765336 +1765416 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 Oct 18 11:37:11 2016 @@ -187,7 +187,7 @@ as described below.</p> <span class="n">description</span><span class="p">=</span>"<span class="n">Sample</span> <span class="n">Health</span> <span class="n">Check</span> <span class="n">defined</span> <span class="n">by</span> <span class="n">a</span> <span class="n">java</span> <span class="n">annotation</span>"<span class="p">,</span> <span class="n">tags</span><span class="p">={</span>"<span class="n">sample</span>"<span class="p">,</span>"<span class="n">annotation</span>"<span class="p">})</span> -<span class="n">public</span> <span class="n">class</span> <span class="n">AnnotatedHealthCheckSample</span> <span class="n">implements</span> <span class="n">HealthCheck</span><span class="p">{</span> +<span class="n">public</span> <span class="n">class</span> <span class="n">AnnotatedHealthCheckSample</span> <span class="n">implements</span> <span class="n">HealthCheck</span> <span class="p">{</span> <span class="p">@</span><span class="n">Override</span> <span class="n">public</span> <span class="n">Result</span> <span class="n">execute</span><span class="p">()</span> <span class="p">{</span> @@ -203,7 +203,6 @@ as described below.</p> <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.junit.healthcheck</code> provides a <code>HealthCheck</code> service that executes JUnit tests in the server-side OSGi context.</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> <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> @@ -225,9 +224,46 @@ 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<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> +<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. Generic health check service properties are interpreted by the health check executor service. Custom health check service properties can be used by the health check implementation itself to configure its behaviour.</p> +<p>The following generic Health Check properties may be used for all checks:</p> +<table class="table"> +<thead> +<tr> +<th>Property</th> +<th>Type</th> +<th>Description</th> +</tr> +</thead> +<tbody> +<tr> +<td>hc.name</td> +<td>String</td> +<td>The name of the health check as shown in UI</td> +</tr> +<tr> +<td>hc.tags</td> +<td>String[]</td> +<td>List of tags: Both Felix Console Plugin and Health Check servlet support selecting relevant checks by providing a list of tags</td> +</tr> +<tr> +<td>hc.mbean.name</td> +<td>String</td> +<td>Makes the HC result available via given MBean name. If not provided no MBean is created for that <code>HealthCheck</code></td> +</tr> +<tr> +<td>hc.async.cronExpression</td> +<td>String</td> +<td>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.</td> +</tr> +<tr> +<td>hc.resultCacheTtlInMs</td> +<td>Long</td> +<td>Overrides the global default TTL as configured in health check executor for health check responses (since v1.2.6 of core)</td> +</tr> +</tbody> +</table> +<p>All service properties are optional.</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">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>" @@ -238,16 +274,44 @@ service implementation.</p> </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. The <code>hc.mbean.name</code> -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> +<p>The service properties starting with the <code>hc.</code> prefix in this example should be provided by all <code>HealthCheck</code> services. </p> +<h2 id="configuring-the-health-check-executor">Configuring the Health Check Executor<a class="headerlink" href="#configuring-the-health-check-executor" title="Permanent link">¶</a></h2> +<p>The health check executor can <strong>optionally</strong> be configured via service PID <code>org.apache.sling.hc.core.impl.executor.HealthCheckExecutorImpl</code>:</p> +<table class="table"> +<thead> +<tr> +<th>Property</th> +<th>Type</th> +<th>Default</th> +<th>Description</th> +</tr> +</thead> +<tbody> +<tr> +<td>timeoutInMs</td> +<td>Long</td> +<td>2000ms</td> +<td>Timeout in ms until a check is marked as timed out</td> +</tr> +<tr> +<td>longRunningFutureThresholdForCriticalMs</td> +<td>Long</td> +<td>300000ms = 5min</td> +<td>Threshold in ms until a check is marked as 'exceedingly' timed out and will marked CRITICAL instead of WARN only</td> +</tr> +<tr> +<td>resultCacheTtlInMs</td> +<td>Long</td> +<td>2000ms</td> +<td>Result Cache time to live - results will be cached for the given time</td> +</tr> +</tbody> +</table> <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> -<p>The DEBUG logs of health checks can optionally be displayed, and an option allows for showing only health -checks that have a non-OK status.</p> +<p>The DEBUG logs of health checks can optionally be displayed, and an option allows for showing only health 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<a class="headerlink" href="#jmx-access-to-health-checks" title="Permanent link">¶</a></h2> @@ -269,7 +333,7 @@ similar features to the Web Console plug <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 URL parameters which 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> +<p>Note that by design <strong>the Health Checks Servlet doesn't do any access control by itself</strong> to ensure it can detect unhealthy states of the authentication itself. Make sure the configured path is only accessible to relevant infranstructure and operations people. Usually all <code>/system/*</code> paths are only accessible from a local network and not routed to the Internet.</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> @@ -282,7 +346,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. 1695532 by bdelacretaz on Wed, 12 Aug 2015 14:16:33 +0000 + Rev. 1765416 by ghenzler on Tue, 18 Oct 2016 11:36:54 +0000 </div> <div class="trademarkFooter"> Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project