lurumad / aspnetcore-health

AspNetCore.Health enables load balancers to monitor the status of deployed Web applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AspNetCore.Health MyGet CI NuGet

#f03c15 This libray has been discontinued in favor of BeatPulse #f03c15

What Is Application Health Check?

Health checking is the process where load balancers or application delivery controller does periodic check on our applications to make sure that they are up and responding without any problems. If our applications are down for every reason or any of the system that our applications depends on (A database, a distributed cache, web service, ect) are down, the load balancer should detect this and stop sending traffic its way.

Why AspNetCore.Health?

AspNetCore.Health enables load balancers to monitor the status of deployed Web applications.

Scenarios

AspNetCore.Health enables you to do the following tasks:

  • Monitor the performance of an AspNetCore application to make sure that it is healthy.
  • Rapidly diagnose applications or systems that are failing.

Install AspNetCore Health

You should install AspNetCore.Health with NuGet:

Install-Package AspNetCore.Health

This command from Package Manager Console will download and install AspNetCore.Health and all required dependencies.

Meet AspNetCore.Health

By default AspNetCore provides out of the box some health checks providers:

  • Check Urls (Http services)
  • Ftp
public void ConfigureServices(IServiceCollection app)
{
    services.AddHealthChecks(context =>
    {
        context
            .AddUrlCheck("http://www.google.com")
            .AddFtp("ftp.uconn.edu", "anonymous", "", 21, FtpTransferMode.Binary, "Public Ftp Test");
    });
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    app.UseHealthCheck("/health")
}

You can create your own health check providers in a functional style avoiding inheritance:

Func<Task<HealthCheckResult>>

You can see some examples [here] (https://github.com/lurumad/aspnetcore-health/blob/master/src/AspNetCore.Health/HealthCheckContextExtensions.cs)

Run the HealthSample and open your browser http://localhost:5000/health

[
    {
        Name: "WebService (Google)",
        Status: "Healthy"
    }
]

If all services are healthy, returns http 200 OK status code, but if there are any unhealthy service returns http 500 Internal Server Error status code.

Try with other services!

Continous integration build

Platform Status
AppVeyor (.NET Core) Build status

Copyright

Copyright © 2016 Luis Ruiz (lurumad)

About

AspNetCore.Health enables load balancers to monitor the status of deployed Web applications.

License:Apache License 2.0


Languages

Language:C# 88.5%Language:PowerShell 11.5%