Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joncloud/vitality-net
Provides component status evaluation to integrate with monitoring services
https://github.com/joncloud/vitality-net
asp-net-core availability azure check component entity-framework-core health monitor mvc status storage-account
Last synced: about 1 month ago
JSON representation
Provides component status evaluation to integrate with monitoring services
- Host: GitHub
- URL: https://github.com/joncloud/vitality-net
- Owner: joncloud
- License: mit
- Created: 2017-11-30T18:50:36.000Z (about 7 years ago)
- Default Branch: publish
- Last Pushed: 2022-12-07T18:41:56.000Z (about 2 years ago)
- Last Synced: 2024-10-13T13:32:21.174Z (2 months ago)
- Topics: asp-net-core, availability, azure, check, component, entity-framework-core, health, monitor, mvc, status, storage-account
- Language: C#
- Homepage:
- Size: 57.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Vitality.NET
[![Travis](https://img.shields.io/travis/joncloud/vitality-net.svg)](https://travis-ci.org/joncloud/vitality-net/)
[![NuGet](https://img.shields.io/nuget/v/Vitality.svg)](https://www.nuget.org/packages/Vitality/)## Description
Vitality.NET provides component status evaluation to integrate with monitoring services.## Licensing
Released under the MIT License. See the [LICENSE][] file for further details.[license]: LICENSE.md
## Installation
In the Package Manager Console execute```powershell
Install-Package Vitality
```Or update `*.csproj` to include a dependency on
```xml
```
## Usage
Sample authorization for details:
```csharp
class Startup {
public void ConfigureServices(IServiceCollection services) =>
services.AddVitality(options => options.AuthorizeDetails = ctx => ctx.User.IsInRole("Admin"));
}
```Sample integration with Sqlite Database:
```csharp
class Startup {
// ...
public void ConfigureServices(IServiceCollection services) =>
services.AddVitality(options => options.AddDbConnectionEvaluator("SqliteDatabase", () => new SqliteConnection(), "Data Source=:memory:;"));
public void Configure(IApplicationBuilder app, IHostingEnvironment env) =>
app.UseVitality().UseMvc();
}
```Sample output for `/vitality` results in
```json
{
"sqliteDatabase": "Up"
}
```Test results can be cached by using the appropriate overload:
```csharp
services.AddVitality(options => options.AddDbConnectionEvaluator("SqliteDatabase", () => new SqliteConnection(), "Data Source=:memory:;"), TimeSpan.FromMinutes(5));
```Test an Entity Framework DbContext (include Vitality.EntityFrameworkCore):
```csharp
// Simply make sure the database connection is correct.
services.AddVitality(options => options.AddDbContextEvaluator("ApplicationDbContext"));// Check something on the context for verification.
services.AddVitality(options => options.AddDbContextEvaluator("ApplicationDbContext", ctx => ctx.CriticalTableMustHaveRows.AnyAsync()));
```For additional usage see [Tests][].
[Tests]: tests/Vitality.Tests