Closed justinteaw closed 5 years ago
Are you configuring the appsettings like the UI sample project? You have to tell the UI the endpoints to monitorize. In this case the same host that registers the hcs
it's similar. What i have currently is:
Snippet
"HealthChecks-UI": { "HealthChecks": [ { "Name": "HTTP Basic", "Uri": "http://localhost:5001/hc" } ], "Webhooks": [], "EvaluationTimeOnSeconds": 10, "MinimumSecondsBetweenFailureNotifications": 60 }
On Thu, Feb 7, 2019 at 2:15 PM Carlos Landeras notifications@github.com wrote:
Are you configuring the appsettings like the UI sample project? You have to tell the UI the endpoints to monitorize. In this case the same host that registers the hcs
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/issues/87#issuecomment-461558992, or mute the thread https://github.com/notifications/unsubscribe-auth/AHY2D_oJrtyQBm1Y5KXGWI0rM2lHdAxcks5vLHtDgaJpZM4aoh1n .
Hi @justinteaw
You have invalid configuration, please review the samples in order to set this correctly, in your code you have the same path for ui and healthcheks results.
app.UseHealthChecks("/hc", new HealthCheckOptions()
{
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
})
.UseHealthChecksUI(setup =>
{
setup.ApiPath = "/hc";
setup.UIPath = "/hc-ui";
});
You can set, for example UseHealthChecks("/healthz"...)
and USeHealthChecksUI() without setup. After this in configuration set http://localhost:[port]/healthz
You have a sample for this scenario on https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/tree/master/samples/HealthChecks.UIAndApiCustomization
Great, that was it! thanks!
On Fri, Feb 8, 2019 at 10:06 AM Unai Zorrilla notifications@github.com wrote:
Hi @justinteaw https://github.com/justinteaw
You have invalid configuration, please review the samples in order to set this correctly, in your code you have the same path for ui and healthcheks results.
app.UseHealthChecks("/hc", new HealthCheckOptions() { Predicate = _ => true, ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse }) .UseHealthChecksUI(setup => { setup.ApiPath = "/hc"; setup.UIPath = "/hc-ui"; });
You can set, for example UseHealthChecks("/healthz"...)
and USeHealthChecks() without setup. After this in configuration set http://localhost:[port]/healthz
You have a sample for this scenario on
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/issues/87#issuecomment-461832234, or mute the thread https://github.com/notifications/unsubscribe-auth/AHY2DyEjTACmUh_VBRMuo6l0SSaipSyUks5vLZJ1gaJpZM4aoh1n .
Hello @ranouf, you are exposing healthcheck results and api in the same /hc path.
Change the API path or use the default
Also in the appsettings, the target path is the one you register with UseHealthChecks (in this case /hc) instead of hc-ui that is the spa path to see the html site.
I recommend you to check and run the samples.
The things is the sample are with .net core 3.0 and I m using 2.2. I tried to go back in the history, but I didn t succeed to find to good way to configure it :)
Thanks @CarlosLanderas for answering, you were right, the issue came from the appsettings.
when I go to hc-ui I see "Could not retrieve health checks data"
This is what i have in my startup page: public void ConfigureServices(IServiceCollection services) { services .AddHealthChecksUI() .AddHealthChecks() .AddSqlServer(connectionString: Configuration["Data:ConnectionStrings:Monitoring"]);
public void Configure(IApplicationBuilder app, IHostingEnvironment env) {