XperienceCommunity.HealthChecks
1.0.0.4
dotnet add package XperienceCommunity.HealthChecks --version 1.0.0.4
NuGet\Install-Package XperienceCommunity.HealthChecks -Version 1.0.0.4
<PackageReference Include="XperienceCommunity.HealthChecks" Version="1.0.0.4" />
paket add XperienceCommunity.HealthChecks --version 1.0.0.4
#r "nuget: XperienceCommunity.HealthChecks, 1.0.0.4"
// Install XperienceCommunity.HealthChecks as a Cake Addin #addin nuget:?package=XperienceCommunity.HealthChecks&version=1.0.0.4 // Install XperienceCommunity.HealthChecks as a Cake Tool #tool nuget:?package=XperienceCommunity.HealthChecks&version=1.0.0.4
XperienceCommunity.HealthChecks
This project is a NuGet package specifically designed to integrate Health Checks into your Xperience By Kentico site 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 Xperience by Kentico in an ASP.NET Core environment, simplifying the process of monitoring and maintaining the health of their applications.
If you are using Kentico XP 13, please use the package XperienceCommunity.AspNetCore.HealthChecks
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Installation Instructions
To integrate Kentico Health Checks into your ASP.NET Core application, follow these steps:
Ensure Prerequisites:
- Make sure your application is running on
.NET 6
or.NET 8
. - Verify that your application is a Xperience by Kentico application on version 28.2.0 or greater.
- Make sure your application is running on
Install Required Package:
- You need the
Microsoft.Extensions.Diagnostics.HealthChecks
package for utilizing theIHealthChecksBuilder
interface. If not already installed, you can add it via NuGet with the following command:dotnet add package Microsoft.Extensions.Diagnostics.HealthChecks
- You need the
Install Kentico Health Checks Package:
- Install the XperienceCommunity.HealthChecks package via NuGet using the following command:
dotnet add package XperienceCommunity.HealthChecks
- Install the XperienceCommunity.HealthChecks package via NuGet using the following command:
Configure Services:
In your
Startup.cs
orProgram.cs
file, where you configure your services, add the Kentico Health Checks. You can add all available health checks or specific ones based on your needs.To add all Kentico Health Checks:
public void ConfigureServices(IServiceCollection services) { services .AddHealthChecks() .AddKenticoHealthChecks(); }
To add specific Kentico Health Checks:
public void ConfigureServices(IServiceCollection services) { services.AddHealthChecks() .AddCheck<WebFarmHealthCheck>("Site Configuration Health Check"); }
Middleware Registration:
Register the health checks middleware in your
Startup.cs
or equivalent configuration file to expose the health checks via an HTTP endpoint.public void Configure(IApplicationBuilder app) { app.UseHealthChecks("/kentico-health"); }
Endpoint Registration
- In your
Startup.cs
file (or equivalent configuration file), use theMapHealthChecks
extension method on yourIEndpointRouteBuilder
instance. This registers the health checks as an endpoint.
app.UseEndpoints(endpoints => { endpoints.MapHealthChecks("/kentico-health"); }
- In your
Endpoint Registration with Custom Writer
- In your
Startup.cs
file (or equivalent configuration file), use theMapHealthChecks
extension method on yourIEndpointRouteBuilder
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 }); }
- In your
By following these steps, you will successfully integrate Kentico Health Checks into your ASP.NET Core application, allowing you to monitor various aspects of your Kentico application's health.
Health Checks
Application Initialized Health Check
The ApplicationInitializedHealthCheck
class is an implementation of the IHealthCheck
interface. It is used to perform a health check on the application initialization.
Email Health Check
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.
EventLogHealthCheck
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.
WebFarmHealthCheck
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.
WebFarmTaskHealthCheck
The WebFarmTaskHealthCheck
class is an implementation of the IHealthCheck
interface. It is responsible for checking the health of the web farm server tasks.
WebsiteChannelHealthCheck
The WebsiteChannelHealthCheck
class is an implementation of the IHealthCheck
interface. It is responsible for checking if any Website Channels are configured.
Built With
- Microsoft.AspNetCore.Health - The web framework used
- Xperience By Kentico - Kentico Xperience
- NuGet - Dependency Management
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Brandon Henricks - Initial work - Brandon Henricks
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- CSharpFunctionalExtensions (>= 2.41.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (>= 8.0.7)
-
net8.0
- CSharpFunctionalExtensions (>= 2.41.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (>= 8.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.