Apache

Custom Sling Health Checks

Custom Sling Health Checks run on the Felix Health Checks runtime.

Best location for Health Checks

It is best practice to place health check next to the functionality they check. Also documentation of those check should be provided along with the documentation of the functionality.

The below checks are exceptions to that rule as they are generic in what they check (but still require Sling features, that's whey they are not in Apache Felix).

Apache Sling Health Check Support Module

Check PID Factory Description
Default Logins Check org.apache.sling.hc.support.DefaultLoginsHealthCheck yes Set a list of default logins in config array logins separed by :, e.g. author:author
Scripted Check org.apache.felix.hc.generalchecks.ScriptedHealthCheck yes Allows to run an arbitrary script in the same way as the Scripted Check from from Apache Felix bundle general checks, except that this check allows to use files being loaded from JCR by using a scriptUrl with prefix jcr:, e.g. jcr:/apps/ops/my-custom-check.groovy
Request Status Health Check Deprecated Use instead the corresponding check from general checks

Health Checks as server-side JUnit tests

The org.apache.sling.hc.junit.bridge bundle makes selected Health Checks available as server-side JUnit tests.

It requires the org.apache.sling.junit.core bundle which provides the server-side JUnit tests infrastructure.

The idea is to implement the smoke tests of your system, for example, as health checks. You can then run them as part of integration testing, using the Sling Testing Tools
remote testing utilities, and also as plain Health Checks for monitoring or troubleshooting Sling instances.

To use this module, configure sets of tags at /system/console/configMgr/org.apache.sling.hc.junitbridge.HealthCheckTestsProvider using the standard includeThisTag,-omitThatTag syntax, and JUnit tests will be available at /system/sling/junit/HealthChecks.html to run the corresponding Health Checks.