Skip to content

Commit 468043a

Browse files
authored
Merge pull request #7228 from pijemcolu/task/53985-aspnet-healthchecks
Document the ability to use asp.net healthchecks with hostname monitoring
2 parents 39de965 + 6404781 commit 468043a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

umbraco-cloud/optimize-and-maintain-your-site/monitor-and-troubleshoot/hostname-monitoring.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,27 @@ Hostname monitoring can be accessed under **Insights > Hostname Monitoring** on
1919
* **Expected Status Code**: The HTTP status code that indicates a successful response (e.g., `200`, `301`, `404`). Any status code can be monitored, and this value determines whether the UI marks the response as a failure or success.
2020
* **Monitor Enabled**: Toggle to enable or disable monitoring. Disabling a monitor stops the pings but retains history in **Ping Results**.
2121

22+
## ASP.NET Core Health Checks Example
23+
24+
You can use [ASP.NET Core Health Checks](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks?view=aspnetcore-9.0) to monitor the health of your application and its dependencies.
25+
26+
The simplest health check implementation looks like this:
27+
```csharp
28+
// Add health checks
29+
builder.Services.AddHealthChecks();
30+
31+
// Map health check endpoint
32+
app.MapHealthChecks("/health");
33+
```
34+
35+
After creating a health check endpoint (e.g. `/health`) and implementing the `IHealthCheck` interface, your application can expose its internal state by returning a standard HTTP status:
36+
37+
- `200 OK` if healthy
38+
- `503 Service Unavailable` or similar if unhealthy
39+
40+
Umbraco Cloud hostname monitoring checks any path, like `https://customhostname.com/health`, using HTTP response codes to determine if the application is reachable and healthy.
41+
42+
2243
## Ping Results
2344

2445
* Displays logs of pings, including:

0 commit comments

Comments
 (0)