Health Check - TcmExtensions/TcmCDService GitHub Wiki

Health Check

TcmCDService allows configuration of healthchecks which are automatically executed whenever the configured HTTP binding is accessed by a normal HTTP client.

The result output will allow automated monitoring tools to validate the status of TcmCDService on regular intervals.

Opening http://localhost:12001 with the default configuration will give the following result:

TcmCDService

Service listening on...
http://localhost:12001/

--------------------------------------------------------------------------------

ComponentLink-1 (Uri tcm:233-345159): Success
ComponentPresentation-1 (Uri tcm:233-215329): Success

Configuration

Multiple healthchecks can be defined in the TcmCDService configuration file:

<healthCheckTypes>
    <!-- HealthCheck over HTTP - Uses TcmCDService.HealthChecks.WebHealthCheck service configuration -->
    <healthCheckType type="TcmCDService.HealthChecks.WebHealthCheck, TcmCDService">
        <healthChecks>
            <healthCheck name="ComponentLink-1" type="ComponentLink" uri="tcm:233-345159" />
            <healthCheck name="ComponentPresentation-1" type="ComponentPresentation" uri="tcm:233-215329" />
        </healthChecks>
    </healthCheckType>
    <!-- HealthCheck to a status file -->
    <healthCheckType type="TcmCDService.HealthChecks.FileHealthCheck, TcmCDService">
        <settings>
            <!-- HealthCheck status file -->
            <setting key="path">F:\temp\TcmCDService.status</setting>
            <!-- HealthCheck interval in seconds -->
            <setting key="interval">360</setting>
        </settings>
        <healthChecks>
            <healthCheck name="ComponentLink-1" type="ComponentLink" uri="tcm:233-345159" />
            <healthCheck name="ComponentPresentation-1" type="ComponentPresentation" uri="tcm:233-215329" />
        </healthChecks>			
    </healthCheckType>
</healthCheckTypes>

Currently two healthcheck types are available:

  • WebHealthCheck: This exposes a webpage with live healthcheck information. The healthchecks are executed each time the page is requested.

    The web-based healthcheck uses a standard WCF service configuration:

     <service name="TcmCDService.HealthChecks.WebHealthCheck" behaviorConfiguration="TcmCDServiceBehavior">
         <clear />
         <endpoint bindingNamespace="" binding="webHttpBinding" contract="TcmCDService.Contracts.IHealthCheck" address="" bindingConfiguration="webHttp" behaviorConfiguration="web" />				
         <host>
             <baseAddresses>
                 <add baseAddress="http://localhost:12001" />
             </baseAddresses>
         </host>				
     </service>
    
  • FileHealthCheck: Healthcheck information is written to a status file on a configured interval. This file can then be monitored by external monitoring tools.

    The status file and interval as configured as inner settings:

     <healthCheckType type="TcmCDService.HealthChecks.FileHealthCheck, TcmCDService">
         <settings>
             <!-- HealthCheck status file -->
             <setting key="path">F:\temp\TcmCDService.status</setting>
             <!-- HealthCheck interval in seconds -->
             <setting key="interval">360</setting>
         </settings>
    

For each healthcheck inside the healthcheck type, the fields name, uri and type are required. Additional settings can be defined as an inner configuration, for example to specific the path and the interval for the FileHealthCheck.

For example:

<healthCheck name="ComponentLink-1" type="ComponentLink" uri="tcm:233-345159">
    <setting key="templateUri">tcm:233-12345-32</setting>
</healthCheck>

Currently the following types are available:

  • ComponentLink

    Resolve the component link indicated by "uri", returns "Success" or "Failure"

  • ComponentPresentation

    Retrieve the component presentation indicated by "uri", returns "Success" or "Failure"

    Note that the component presentation should not have empty content

⚠️ **GitHub.com Fallback** ⚠️