This project is a NuGet package specifically designed to integrate Kentico Health Checks into applications using the Microsoft.AspNetCore.Health framework. It provides a set of custom health checks that monitor various aspects of a Kentico application, ensuring its optimal performance and stability.
The health checks included in this package cover a wide range of Kentico functionalities, from site configuration and event logs to web farm and search tasks. By leveraging the Microsoft.AspNetCore.Health framework, these health checks can be easily added to any ASP.NET Core application, providing developers with immediate insights into the health of their Kentico applications.
This package is an essential tool for any developer working with Kentico in an ASP.NET Core environment, simplifying the process of monitoring and maintaining the health of their applications.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- .NET 6/.NET 8
- Kentico Xperience 13 Application.
This package provides a set of Kentico-specific health checks that you can easily add to your ASP.NET Core project. Here's how you can do it:
-
First, make sure you have the necessary dependencies installed. You will need the
Microsoft.Extensions.DependencyInjectionpackage for theIServiceCollectioninterface. -
Install this package via NuGet.
-
In your
Startup.csfile (or wherever you configure your services), use theAddKenticoHealthChecksextension method on yourIServiceCollectioninstance. Here's an example:
This method will add all the Kentico Health checks to your application.
public void ConfigureServices(IServiceCollection services)
{
services.AddKenticoHealthChecks();
}This method will add all the Kentico Health checks to your application.
public void ConfigureServices(IServiceCollection services)
{
services
.AddHealthChecks()
.AddKenticoHealthChecks();
}This method will allow you the most flexibility to add only the health checks you want for your application.
public void ConfigureServices(IServiceCollection services)
{
services.AddHealthChecks()
.AddCheck<SiteConfigurationHealthCheck>("Site Configuration Health Check");
}In your Startup.cs file (or wherever you configure your application), use the UseHealthChecks extension method on your IApplicationBuilder instance. This registers the health checks as middleware.Here's an example:
public void Configure(IApplicationBuilder app)
{
app.UseHealthChecks("/kentico-health");
}In your Startup.cs file (or wherever you configure your application), use the MapHealthChecks extension method on your IEndpointRouteBuilder instance. This registers the health checks as an endpoint.
Here's an example:
app.UseEndpoints(endpoints =>
{
endpoints.MapHealthChecks("/kentico-health");
}In your Startup.cs file (or wherever you configure your application), use the MapHealthChecks extension method on your IEndpointRouteBuilder instance. This registers the health checks as an endpoint.
This allows you to customize your HealthCheckOptions class, and specifiy a custom Response Writer.
Here's an example:
app.UseEndpoints(endpoints =>
{
endpoints.MapHealthChecks("/kentico-health",
new HealthCheckOptions()
{
AllowCachingResponses = true,
ResponseWriter = HealthCheckResponseWriter.WriteResponse
});
}The ApplicationInitializedHealthCheck class is an implementation of the IHealthCheck interface. It is used to perform a health check on the application initialization.
The AzureSearchTaskHealthCheck is a health check implementation that checks the Azure Search Task for any errors.
The EmailHealthCheck class is an implementation of the IHealthCheck interface. It is used to perform a health check on the email service in the application.
The EventLogHealthCheck class is an implementation of the IHealthCheck interface. It is used to perform a health check on the event log by investigating the last 100 event log entries for errors.
The LocalSearchTaskHealthCheck class is an implementation of the IHealthCheck interface. It is responsible for checking the health of local search tasks and determining if any errors are present. This health check is used to monitor the status of search tasks in the application.
The SiteConfigurationHealthCheck class is an implementation of the IHealthCheck interface. It is responsible for checking the health of the site configuration in a CMS (Content Management System) application.
The SitePresentationHealthCheck class is an implementation of the IHealthCheck interface. It is responsible for checking the health of the site presentation configuration in an ASP.NET Core application.
The StagingTaskHealthCheck class is an implementation of the IHealthCheck interface. It is responsible for checking the health of staging tasks in a Kentico Xperience CMS application.
The WebFarmHealthCheck class is an implementation of the IHealthCheck interface provided by the Microsoft.Extensions.Diagnostics.HealthChecks namespace. It is used to perform health checks on the Kentico web farm servers.
The WebFarmTaskHealthCheck class is an implementation of the IHealthCheck interface. It is responsible for checking the health of the web farm server tasks.
- Microsoft.AspNetCore.Health - The web framework used
- Kentico Xperience 13 - Kentico Xperience
- NuGet - Dependency Management
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Brandon Henricks - Initial work - Brandon Henricks
This project is licensed under the MIT License - see the LICENSE.md file for details
- Chris Blaylock
- Mike Wills
- Jordan Walters
- Alan Abair