EasyHealth.HealthChecks 1.0.0

dotnet add package EasyHealth.HealthChecks --version 1.0.0
                    
NuGet\Install-Package EasyHealth.HealthChecks -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasyHealth.HealthChecks" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EasyHealth.HealthChecks" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="EasyHealth.HealthChecks" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EasyHealth.HealthChecks --version 1.0.0
                    
#r "nuget: EasyHealth.HealthChecks, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EasyHealth.HealthChecks@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EasyHealth.HealthChecks&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=EasyHealth.HealthChecks&version=1.0.0
                    
Install as a Cake Tool

EasyHealth.HealthChecks

A comprehensive health check package for ASP.NET Core applications with minimal configuration and maximum reliability. Always returns results even when the application has issues.

Features

  • 🚀 Minimal Configuration: Add health checks with just one line of code
  • 🛡️ Always Reliable: Never throws exceptions, always returns meaningful results
  • 📊 Built-in Checks: Memory, disk space, database, HTTP endpoints
  • 🎯 Multi-targeting: Supports .NET 8 and .NET 9
  • 📈 Detailed Reporting: Rich JSON responses with timing and metadata
  • 🔧 Extensible: Easy to add custom health checks

Quick Start

1. Install the Package

dotnet add package EasyHealth.HealthChecks

2. Add to Your Program.cs

using EasyHealth.HealthChecks.Extensions;

var builder = WebApplication.CreateBuilder(args);

// Add services
builder.Services.AddEasyHealthChecks();

var app = builder.Build();

// Add middleware
app.UseEasyHealthChecks();

app.Run();

That's it! Your application now has health checks at /health.

Configuration Examples

Basic with Database

builder.Services.AddEasyHealthChecks("Server=localhost;Database=MyApp;Integrated Security=true;");

Advanced Configuration

builder.Services.AddEasyHealthChecks(config =>
{
    config.AddDatabase("Server=localhost;Database=MyApp;Integrated Security=true;");
    config.AddMemoryCheck(maxMemoryMB: 2048);
    config.AddDiskSpaceCheck(minFreeSpaceGB: 10);
    config.AddHttpCheck("https://api.external-service.com/health");
});

Multiple Endpoints

// Basic health check
app.UseEasyHealthChecks("/health");

// Detailed health check for monitoring systems
app.UseDetailedEasyHealthChecks("/health/detailed");

Built-in Health Checks

Memory Check

Monitors application memory usage:

  • Healthy: Memory usage below 80% of limit
  • Degraded: Memory usage between 80% and 100% of limit
  • Unhealthy: Memory usage exceeds limit

Disk Space Check

Monitors available disk space:

  • Healthy: Free space above 2x minimum requirement
  • Degraded: Free space between 1x and 2x minimum requirement
  • Unhealthy: Free space below minimum requirement

Database Check

Verifies database connectivity using Entity Framework health checks.

HTTP Endpoint Check

Monitors external service availability with configurable timeouts.

Health Check Responses

Basic Response (/health)

{
  "status": "Healthy",
  "timestamp": "2024-01-15T10:30:00Z",
  "totalDuration": 125.5,
  "checks": [
    {
      "name": "memory",
      "status": "Healthy",
      "description": "Memory usage 512MB is within acceptable limits",
      "duration": 2.1,
      "data": {
        "workingSetMB": 512,
        "gcMemoryMB": 256,
        "maxAllowedMB": 1024
      }
    }
  ]
}

Detailed Response (/health/detailed)

Includes additional system information like environment, machine name, and process ID.

Resilient Design

EasyHealth.HealthChecks is designed to never fail catastrophically:

  • No Exceptions: All health checks are wrapped to prevent exceptions from bubbling up
  • Timeouts: Automatic timeouts prevent hanging health checks
  • Graceful Degradation: When checks fail, the service reports "Degraded" instead of "Unhealthy"
  • Always Returns: Even if the entire health check system fails, a meaningful response is returned

Best Practices

  1. Use in Production: The resilient design makes it safe for production monitoring
  2. Monitor Trends: Use the detailed endpoint for monitoring systems that can track trends
  3. Set Appropriate Limits: Configure memory and disk space limits based on your application's needs
  4. External Dependencies: Use HTTP checks for critical external services
  5. Database Monitoring: Always include database health checks for data-driven applications

License

MIT License - see LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET 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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 133 8/13/2025