Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Multiple Health Checks
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<CDriveHasMoreThan1GbFreeHealthCheck>();
services.AddHealthChecks(checks =>
{
checks.AddUrlCheck("https://github.com")
.AddSqlCheck("Local DB Check", "Server=(localdb)\\mssqllocaldb;Database=aspnet-WebApplication1;Trusted_Connection=True;MultipleActiveResultSets=true")
.AddHealthCheckGroup("performance",
group => group.AddPrivateMemorySizeCheck(1000)
.AddVirtualMemorySizeCheck(1000)
.AddWorkingSetCheck(1000)
.AddCheck<CDriveHasMoreThan1GbFreeHealthCheck>("C Drive has more than 1 GB Free"),
CheckStatus.Unhealthy
);
});
services.AddMvc();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment