AspNetCore.Live.Api.HealthChecks.Client
1.0.0
See the version list below for details.
dotnet add package AspNetCore.Live.Api.HealthChecks.Client --version 1.0.0
NuGet\Install-Package AspNetCore.Live.Api.HealthChecks.Client -Version 1.0.0
<PackageReference Include="AspNetCore.Live.Api.HealthChecks.Client" Version="1.0.0" />
paket add AspNetCore.Live.Api.HealthChecks.Client --version 1.0.0
#r "nuget: AspNetCore.Live.Api.HealthChecks.Client, 1.0.0"
// Install AspNetCore.Live.Api.HealthChecks.Client as a Cake Addin #addin nuget:?package=AspNetCore.Live.Api.HealthChecks.Client&version=1.0.0 // Install AspNetCore.Live.Api.HealthChecks.Client as a Cake Tool #tool nuget:?package=AspNetCore.Live.Api.HealthChecks.Client&version=1.0.0
Real-Time Api Health Check Monitoring
The Asp Net Core Web Api has a Health Checks system built into it.
This project taps into that system & makes the generated Health Report,
available to Monitoring client applications, in real-time.
The Client package, installed in the Api, runs the Health Check periodically,
and uploads the generated Health Report to the Server SignalR Hub.
The Hub generates sends a push notification to the connected clients,
notifying them of the Health Report in real-time.
Server
You can use a Console app as a Health Checks Server.
Just create one with Web Sdk (project file):
<Project Sdk="Microsoft.NET.Sdk.Web">
Then, plug in the Server package.
var builder = WebApplication.CreateBuilder();
builder.Services.AddSignalR();
builder.Services.AddLiveHealthChecksServer(settings => settings.SecretKey = "43bf0968-17e0-4d22-816a-6eaadd766692");
var app = builder.Build();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<LiveHealthChecksHub>("/livehealthcheckshub");
});
app.Run();
Asp Net Core Api
In your Api add the Client Nuget package.
then
//Required - add all your health checks
services.AddHealthChecks();
services.AddLiveHealthChecksClient(settings =>
{
settings.HealthCheckIntervalInMinutes = 60;
settings.ReceiveMethod = "SampleApiHealth";
settings.HealthCheckServerHubUrl = "https://localhost:5001/livehealthcheckshub";
settings.SecretKey = "43bf0968-17e0-4d22-816a-6eaadd766692";
});
The ReceiveMethod is what the SignalR method that Monitoring app needs to listen to.
The SecretKey must be the same between Server & Api.
The Server sends the Health Report as a real-time push notification.
Monitoring app
In your Monitoring app, create a SignalR connection to the Server Hub.
Then, start listening to the set ReceiveMethod ie "SampleApiHealth".
var connection = new HubConnectionBuilder()
.WithUrl("https://localhost:5001/livehealthcheckshub")
.WithAutomaticReconnect()
.Build();
connection.On("SampleApiHealth", new Type[] {typeof(object), typeof(object)},
(arg1, arg2) =>
{
Console.WriteLine(arg1[0]);
return Task.CompletedTask;
}, new object());
await connection.StartAsync();
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 was computed. 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
- Microsoft.AspNetCore.SignalR.Client (>= 6.0.16)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release