Giter Club home page Giter Club logo

aem-healthcheck's Introduction

Build Status Known Vulnerabilities

HealthCheck Servlet for AEM

This servlet makes the JMX health check results accessible via HTTP.

It is used to execute Sling Health Checks based on provided tags (if no tags are provided, all registered health checks will be executed). For the full list of provided health checks in AEM, go to http://localhost:4502/system/console/healthcheck.

Sample requests:

Sample responses:

shallow:
{
  "results": [
    {
      "name": "Smoke Health Check",
      "status": "OK",
      "timeInMs": 1
    }
  ]
}
deep:
{
  "results": [
    {
      "name": "Bundle Health Check",
      "status": "OK",
      "timeMs": 0
    },
    {
      "name": "Replication Queue Health Check",
      "status": "OK",
      "timeMs": 18
    },
    {
      "name": "Sling Jobs Health Check",
      "status": "OK",
      "timeMs": 0
    },
    {
      "name": "Startup Listener Check",
      "status": "OK",
      "timeMs": 1
    }
  ]
}

A 200 status code will be returned if ALL health checks return the status OK. Otherwise a 503 is returned.

Note: It is assumed that all /system/* paths are only accessible from a local network and not routed to the Internet.

Ignored Bundles Configuration

This healthcheck can take an optional OSGi configuration file.

/apps/healthcheck/config/com.shinesolutions.healthcheck.hc.impl.ActiveBundleHealthCheck:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
          jcr:primaryType="sling:OsgiConfig"
          bundles.ignored="[com.day.cq.dam.dam-webdav-support]"/>

With this configuration, the com.day.cq.dam.dam-webdav-support bundle would be ignored in the ActiveBundleHealthCheck.

Downloading

Release artifacts are available for download via Maven Central at: https://repo1.maven.org/maven2/com/shinesolutions/aem-healthcheck-content/

Building

This project uses Maven for building. Common commands:

From the root directory, run mvn -PautoInstallPackage clean install to build the bundle and content package and install to a CQ instance.

From the bundle directory, run mvn -PautoInstallBundle clean install to build just the bundle and install to a CQ instance.

Installing

  • Navigate to the CRX Package Manager
  • Upload the aem-healthcheck-content-<version>.zip package
  • Install the package

Release

Create a release branch off the master branch

git branch release/X.X

Prepare the release (use vX.X for the tag)

mvn release:prepare

Push the branch to the repository

git push origin

Checkout the newly created tag and build the project

git checkout tags/vX.X
mvn clean package

Attach the CRX package to the release on Github and merge back to master.

Specifying CRX Host/Port

The CRX host and port can be specified on the command line with:

mvn -Dcrx.host=otherhost -Dcrx.port=5502 <goals>

Available Tags

Besides the out-of-the-box tags, two new tags have been incorporated to the health check:

Custom tags

Tag Health Checks Description
shallow, devops SmokeHealthCheck This tag runs a simple Smoke health check that determines if an instance is running.
deep
  • ActiveBundleHealthCheck
  • ReplicationQueueHealthCheck
  • SlingJobsHealthCheck
This tag runs three different health checks.
  • The first health check scans the current OSGi bundles and reports if there is any inactive bundles.
  • The second health check verifies the replication queue of agents.
  • The third health check tests the number of active jobs and their general health in the queue.

Out-of-the-box tags

Tags Health Checks
sling Sling Get Servlet, Sling Java Script Handler, Sling Jsp Script Handler, Sling Jobs, Sling Referrer Filter
jobs Sling Jobs
dispatcher CQ Dispatcher Configuration
cq CQ HTML Library Manager Config, Replication and Transport Users, WCM Filters Configuration
bundles CRXDE Support, DavEx Health Check, WebDAV Health Check
packages, startup Default CQ content packages are present
content Default CQ content packages are present, Example Content Packages
login Default Login Accounts, Example Content Packages
example Example Content Packages
replication Replication and Transport Users
dos Sling Get Servlet
webserver, clickjacking Web Server Configuration
deserialization Deserialization Firewall Attach API Readiness, Deserialization Firewall Functional, Deserialization Firewall Loaded
queries Query Traversal Limits
csrf Sling Referer Filter
acl User Profile Default Access
production CQ Dispatcher Configuration, CQ HTML Library Manager Config, CRXDE Support,Default Login Accounts, Default Login Accounts, Example Content Packages, Sling Get Servlet, Sling Java Script Handler, Sling Jsp Script Handler, WCM Filters Configuration, Web Server Configuration, Authorizable Node Name Generation, DavEx Health Check, Sling Referrer Filter, WebDAV Health Check
security CQ Dispatcher Configuration, CQ HTML Library Manager Config, CRXDE Support, Default Login Accounts, Example Content Packages, Replication and Transport Users, Sling Get Servlet, Sling Java Script Handler, Sling Jsp Script Handler, WCM Filters Configuration, Web Server Configuration, Authorizable Node Name Generation, DavEx Health Check, Deserialization Firewall Attach API Readiness, Deserialization Firewall Functional, Deserialization Firewall Loaded, Sling Referrer Filter, User Profile Default Access, WebDAV Health Check
system Maintenance Task com.day.cq.audit.impl.AuditLogMaintenanceTask, Maintenance Task WorkflowPurgeTask, Maintenance Task RevisionCleanupTask

aem-healthcheck's People

Contributors

cliffano avatar lenuhc avatar michaeldiender-shinesolutions avatar mickleroy avatar ovlords avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aem-healthcheck's Issues

Whitelist bundle for AEM 6.3

In AEM 6.3, any bundles using loginAdministrative need to be whitelisted via org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment

The maven project should only install an OSGi bundle

The application is currently setup to install a content package as well as an OSGi bundle. However the content package only consists of an empty /apps/healthcheck directory which is not serving any purpose.

The Maven project should be modified to only install the OSGi bundle.

Introduce shallow and deep tags

Other than health check type tags, we also need to introduce health check level tags.

  • shallow will be executed very frequently (think an ELB doing a heartbeat), it should be minimum check that indicates that AEM is healthy, it shouldn't consume much resource on the server

  • deep will be executed less frequent, it should give high level of confidence that AEM is healthy, it can consume some resource but obviously not to cause AEM itself to struggle

Health check needs to be accessible without authentication

/system/health currently requires authentication (responds with 401 if none supplied), which is not always possible, e.g. when the health check is meant to be performed from an ELB - we can't put any credential in plain text there.

Hence we need to be able to access the health check without authentication.

Provide configurable set of white listed bundles

An OSGi configuration should be able to be used to specify a list of bundle symbolic names. Bundles part of this white list should be ignored for the purposes of the health check.

This feature is required because some bundles (i.e. webdav) are intentionally disabled for security purposes.

Threshold values should be configurable

The following values should be made configurable so that they can be tailored to an instance's needs:

ReplicationQueueHealthCheck
private static final int MAX_REPLICATION_TRIES = 3;

SlingJobsHealthCheck
private static final int MAX_JOBS_QUEUED = 1000;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.