https://github.com/arnab-developer/httphealthcheckdashboard
Health check dashboard for web apps
https://github.com/arnab-developer/httphealthcheckdashboard
csharp docker dotnet
Last synced: 3 months ago
JSON representation
Health check dashboard for web apps
- Host: GitHub
- URL: https://github.com/arnab-developer/httphealthcheckdashboard
- Owner: Arnab-Developer
- License: mit
- Created: 2021-05-07T16:06:12.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-13T04:11:28.000Z (about 3 years ago)
- Last Synced: 2025-01-17T02:24:19.684Z (5 months ago)
- Topics: csharp, docker, dotnet
- Language: C#
- Homepage:
- Size: 57.6 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HTTP health check web dashboard
This is a dashboard to show health check results of your favorite http web apps.

This app has been hosted in
[docker hub](https://hub.docker.com/r/45862391/httphealthcheckdashboard) in a
container image.## How to extend this app
This app is checking health of some URIs, you can find them in `appsettings.json`
and `appsettings.Development.json` file. If you want to check your own URI as well
in this app then do the following changes.- Add a new section in `appsettings.json` under `ApiDetails`
```json
"ApiDetails": [
{
"Name": "[name of the URI]",
"Url": "[URI]",
"Credential": {
"UserName": "[user name if any]",
"Password": "[password if any]"
},
"IsEnable": true
}
]
```- Add a new section in `appsettings.json` under `HealthChecks-UI` -> `HealthChecks`
```json
"HealthChecks-UI": {
"HealthChecks": [
{
"Name": "[name of health check]",
"Uri": "[health check URI]"
}
]
}
```- Create a new class inside `HttpHealthCheckDashboard` -> `HealthChecks` which
inherits `BaseHealthCheck````csharp
public class [ClassName]HealthCheck : BaseHealthCheck
{
public [ClassName]HealthCheck(IEnumerable urlDetails,
ICommonHealthCheck commonHealthCheck) : base(urlDetails, commonHealthCheck)
{
}
}
```- Add the class into `HttpHealthCheckDashboard.HealthCheckExtensions.AddHealthChecksUrls(this IServiceCollection services)`
```csharp
public static IHealthChecksBuilder AddHealthChecksUrls(this IServiceCollection services) =>
services
.AddHealthChecks()
.AddCheck<[ClassName]HealthCheck>("[ClassName]");
```- Add endpoint mapping in `HttpHealthCheckDashboard.HealthCheckExtensions.MapHealthChecksUrls(this IEndpointRouteBuilder endpoints)`
```csharp
public static void MapHealthChecksUrls(this IEndpointRouteBuilder endpoints)
{
endpoints.MapHealthChecks("/[classname]-hc", new HealthCheckOptions()
{
Predicate = r => r.Name.Contains("[ClassName]"),
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
}
```- Open your bowser and navigate to `http://localhost:[your-machine-port]/hc-ui` and you
should see your new URI in the health check app.