Po co się męczyć?

2

Warden Cię wyręczy!

2

Piotr Gankiewicz... kto?

2

piotrgankiewicz.com

 

spetzu

1

spetz

1

piotrgankiewiczblog

 

Moc

 

2

Ach, ten monitoring...

2

Wykresy, szmery, bajery

 

Mnogość usług

 

Padła baza - szefie, "pszypał"

 

Czy aktualne rozwiązania są wystarczające?

 

Warden... co?

2

.NET Core & C#

 

Monitoring

 

Open Source

 

Web UI & Azure

 

NuGet

 

Warden - pojęcia

2

Warden - konfigurowalna usługa działająca w iteracjach, odpowiedzialna za monitoring wybranych zasobów.

 

Watcher - pojedyncza usługa monitorująca wybrany zasób jak np. API, proces, plik lub bazę danych.

 

Hook - callback, używany w konfiguracji do "podpięcia" się pod powiadomienia np. o niepowodzeniu monitorowania.

 

Integration - rozszerzenie umożliwiające szybką integrację z zewnętrznym serwisem np. SendGrid aby wysłać email.

 

Warden, a internety

2

https://getwarden.net

Warden @NuGet

2

Warden Core

Disk, MongoDB, MSSQL, Performance, Process, Redis, Web

HTTP API, Slack, SendGrid, Twilio

Półżywe demo

2

Lecimy z koksem!

0. Tworzymy aplikację

2

Console Application

Windows Service (np. TopShelf)

 

WPF

 

WinForms

 

ASP.NET MVC

 

UWP

 

1. Instalujemy paczki

2

Warden

Warden.Watchers.Web

 

Warden.Watchers.MSSQL

 

Warden.Integrations.HttpApi

 

Warden.Inegrations.SendGrid

 

Install-Package

etc.

2. Konfigurujemy Wardena

2
var configuration = WardenConfiguration
    .Create()
    .AddDiskWatcher(cfg =>
    {
        cfg.WithFilesToCheck(@"D:\Test\File1.txt", @"D:\Test\File2.txt")
           .WithPartitionsToCheck("D", @"E:\")
           .WithDirectoriesToCheck(@"D:\Test")
           .EnsureThat(check => check.FreeSpace > 100000000)
    })
    .AddMongoDbWatcher("mongodb://localhost:27017", "MyDatabase", cfg =>
    {
        cfg.WithQuery("Users", "{\"name\": \"admin\"}")
           .EnsureThat(users => users.Any(user => user.role == "admin"));
    })
    .AddWebWatcher("http://httpstat.us/200")
    .AddWebWatcher("http://my-api.com", HttpRequest.Post("users", new {name = "test"},
        headers: new Dictionary<string, string>
        {
            ["Authorization"] = "Token MyBase64EncodedString",
        }), 
        cfg => cfg.EnsureThat(response => response.Headers.Any())
    )
   .SetIterationDelay(TimeSpan.FromMinutes(1))
   .Build();
   

3. Dodajemy integracje

2
.IntegrateWithSlack("https://hooks.slack.com/services/XXX/YYY/ZZZ")
.IntegrateWithSendGrid("api-key", "noreply@system.com", cfg =>
{
    cfg.WithDefaultSubject("Monitoring status")
       .WithDefaultReceivers("admin@system.com");
})
.IntegrateWithTwilio("accountSid", "authToken", "+1111222333", cfg =>
{
    cfg.WithDefaultMessage("Monitoring status")
       .WithDefaultReceivers("+1123456789");
})

4. Definiujemy "hooki"

2
.SetHooks((hooks, integrations) =>
{
    hooks.OnIterationCompleted(iteration => OnIterationCompleted(iteration))
        .OnIterationCompletedAsync(iteration =>
            integrations.Slack()
            .SendMessageAsync($"Iteration {iteration.Ordinal} has completed."))
        .OnError(exception => System.Console.WriteLine(exception));
})
.SetGlobalWatcherHooks(hooks =>
{
    hooks.OnStart(check => GlobalHookOnStart(check))
        .OnFailure(result => GlobalHookOnFailure(result))
        .OnSuccess(result => GlobalHookOnSuccess(result))
        .OnCompleted(result => GlobalHookOnCompleted(result));
})
.SetAggregatedWatcherHooks((hooks, integrations) =>
{
    hooks.OnFirstFailureAsync(result =>
        integrations.SendGrid().SendEmailAsync("Monitoring errors have occured."))
        .OnFirstSuccessAsync(results =>
            integrations.SendGrid().SendEmailAsync("Everything is ok again!"));
})

5. Odpalamy aplikację

2
Warden.Create(wardenConfiguration);
Task.WaitAll(warden.StartAsync());

Co w UI piszczy?

2

https://panel.getwarden.net

 

Install-Package Warden.Integrations.HttpApi

 

Rejestracja i organizacja

2

Jeszcze tylko klucz API

2
.IntegrateWithHttpApi("https://panel.getwarden.net/api",
    "1pi0Tp9/n2wdLSRsUBAKXwHGPXoFU/58wV8Dc+vIL+k2/fWF14VXPiuK",
    "0b8351f1-dc93-4137-90b9-e3a7d7e12054")

Wykresy i kolorowanki

2

Dane historyczne

2

Epilog

2

Uszanowanko

<spam />

2

42.do

 
Made with Slides.com