3

I am trying to learn more about .Net Core Health Checks.

I understand the concept of a web hook i.e. it notifies you that an event has occurred in a third party application. However, I do not understand the concept of a web hook in the context of the Health Checks UI. If I setup the Health Checks UI, then there are two menu items in the sidebar i.e. Health Checks (as expected) and web hooks.

What are webhooks used for in the Health Checks UI? I have spent hours Googling this and all I have found is this: https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/blob/master/doc/webhooks.md, which has not helped.

w0051977
  • 15,099
  • 32
  • 152
  • 329
  • From my understanding the health check will invoke the webhooks to notify that there was a failure as apposed to having to check them yourself by calling the health check api – Nkosi Mar 26 '20 at 21:41
  • @Nkosi, thanks that makes sense. Is there any documentation that explains how to configure them? – w0051977 Mar 26 '20 at 21:45
  • Not that I know of but a quick google found this https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks#Webhooks-and-Failure-Notifications which basically links back to what you already found – Nkosi Mar 26 '20 at 21:48

1 Answers1

5

You can configure Webhooks in the Startup.cs.

services.AddHealthChecksUI(options => {
            options.AddWebhookNotification("email",
                uri: "http://localhost:5008/api/noti/email", 
                payload: "{ \"message\": \"Webhook report for [[LIVENESS]]: [[FAILURE]] - Description: [[DESCRIPTIONS]]\"}",
                restorePayload: "{ \"message\": \"[[LIVENESS]] is back to life\"}");
        }).AddInMemoryStorage();
darrenji
  • 75
  • 1
  • 5