SlideShare a Scribd company logo
1
TOPIC
Come sta la nostra
applicazione?
Un viaggio alla scoperta degli Health Check di
ASP.NET Core
Andrea Dottor
@dottor
www.xedotnet.org | www.dottor.net
@cloudgen_verona
#CodeGen2021
3
Errori nelle nostre applicazioni
Possiamo sapere se la
nostra applicazione ha
qualcosa che non funziona?
(e magari saperlo prima che capiti ad
un nostro utente?)
4
Utilizzo dei log
I log sono indispensabili ma non bastano
I log ci raccontano il passato, riportano errori/eccezioni
dopo che sono accaduti
• Informazioni dettagliate dell'errore
• Stack trace
5
Cosa sono gli Health Check?
Introdotti per la prima volta in ASP.NET Core 2.2.0-preview1
Middleware e librerie che permettono di
monitorare lo stato di servizi e dipendenze utilizzati
• Utili per esporre ad un Container Orchestrator (es Kubernetes) lo
stato dell'applicazione eseguita in un container
• Monitoraggio di servizi utilizzati: SQL Server, Azure Storage,
MongoDB, …
• Monitoraggio di informazioni di sistema: memoria, cpu, …
6
Come funzionano gli HealthChecks
Permettono di avere un endpoint dove viene ritornato
lo stato dell'applicazione
(al momento della sua invocazione)
• Healthy 😀
• Degraded 😐
• Unhealthy 🤬
7
Implementare un Health Check
Creare una classe che implementa IHealthCheck
Task<HealthCheckResult> CheckHealthAsync(
HealthCheckContext context,
CancellationToken cancellationToken)
Ritornare:
HealthCheckResult.Healthy("A healthy result.")
HealthCheckResult.Degraded("A degraded result.")
HealthCheckResult.Unhealthy("An unhealthy result.")
Registrare l'HealthCheck nella classe di Startup
.AddCheck<ExampleHealthCheck>("example_health_check")
Abilitare gli Health Check
9
Entity Framework
Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore
Verifica che la connessione utilizzata nel DbContext specificato
sia corretta
• Esegue una "SELECT 1"
Registrare l'HealthCheck nella classe di Startup
• .AddDbContextCheck<PodcastDbContext>();
10
AspNetCore.Diagnostics.HealthChecks
Troviamo molti Health Check già implementati nel
repository GitHub AspNetCore.Diagnostics.HealthChecks
Nota: non sono mantenuti da Microsoft
Sql Server
MySql
Oracle
Sqlite
RavenDB
Postgres
EventStore
RabbitMQ
IbmMQ
Elasticsearch
CosmosDb
Solr
Redis
SendGrid
System: Disk Storage,
Private Memory,
Virtual Memory,
Process, Windows
Service
Azure Service Bus:
EventHub, Queue and
Topics
Azure Storage: Blob,
Queue and Table
Azure Key Vault
Azure DocumentDb
Azure IoT Hub
Amazon DynamoDb
Amazon S3
Google Cloud
Firestore
Network: Ftp, SFtp,
Dns, Tcp port, Smtp,
Imap
MongoDB
Kafka
Identity Server
Uri: single uri and uri
groups
Consul
Hangfire
SignalR
Kubernetes
ArangoDB
Gremlin
11
AspNetCore.HealthChecks.System
Install-Package AspNetCore.HealthChecks.System
Spazio libero in una particolare unità
.AddDiskStorageHealthCheck(s => s.AddDrive("C:", 1024))
Memoria massima allocata
.AddProcessAllocatedMemoryHealthCheck(512)
Processo è in esecuzione
.AddProcessHealthCheck("ProcessName", p => p.Length > 0)
Servizio è in esecuzione
.AddWindowsServiceHealthCheck("someservice",
s => s.Status == ServiceControllerStatus.Running)
12
SQL Server
Install-Package AspNetCore.HealthChecks.SqlServer
Verifica la connessione a un database SQL Server
.AddSqlServer(Configuration["Data:ConnectionStrings:Sql"])
.AddSqlServer(
connectionString: Configuration["Data:ConnectionStrings:Sql"],
healthQuery: "SELECT 1;",
name: "sql",
failureStatus: HealthStatus.Degraded,
tags: new string[] { "db", "sql", "sqlserver" });
13
Servizi e/o url esterni
Install-Package AspNetCore.HealthChecks.Uris
Verifica che l'url specificato non ritorni uno status code di errore
.AddUrlGroup(new Uri("https://localhost:44318/weatherforecast"), "Weather API");
14
AspNetCore.HealthChecks.Hangfire
Install-Package AspNetCore.HealthChecks.Hangfire
Permette di monitorare i Job di Hangfire
.AddHangfire(
setup =>
{
setup.MaximumJobsFailed = 5;
},
name: "Hangfire")
Configurare gli Health Check
16
Install-Package AspNetCore.HealthChecks.UI
HealthCheck UI
17
HealthCheck UI
18
HealthCheck UI - personalizzazione stili
La UI di HealthCheck UI può essere personalizzata solo
tramite CSS ed un minimo di settings
• Fa uso di CSS Variables
HealthCheck UI
20
Health Check Publisher
Realizzando una classe che implementi IHealthCheckPublisher
è possibile far si che periodicamente vengano verificati gli
Health Check per poter inviare (in modalità push) i dati in un
servizio esterno
• Delay: default 5 secondi dopo l'avvio dell'app
• Period: default ogni 30 secondi
• Predicate: funzione che permette di fitrare gli health check da
valutare
• Timeout: default 30 secondi
21
Health Check Publisher
22
Health Check Publisher
Esistono delle implementazioni per i servizi più utilizzati
install-package AspNetcore.HealthChecks.Publisher.ApplicationInsights
install-package AspNetcore.HealthChecks.Publisher.Datadog
install-package AspNetcore.HealthChecks.Publisher.Prometheus
install-package AspNetcore.HealthChecks.Publisher.Seq
23
HealthCheck UI - Webhook
HealthCheck UI permette di invocare servizi esterni tramite
Webhook per notificare eventuali problematiche.
Configurabili tramite appsettings e/o codice
Molti applicativi permettono di ricevere messaggi tramite Webhhok
• Microsoft Teams
• Slack
• SendGrid
• Zapier
• IFTTT
• …
24
Integrazione con Teams
Tramite il connector
Incoming Webhhok è
possibile abilitare la
ricezione di messaggi
(generati da HealthCheck.UI)
I messaggi possono
venir indirizzati in un
preciso Channel
25
HealthCheck.UI configurazione Webhook
{
"Name": "Teams",
"Uri": "https://zzzzzz.webhook.office.com/zzz/zzz....",
"Payload": "{rn "@context":
"http://schema.org/extensions",rn "@type":
"MessageCard",rn "themeColor": "0072C6",rn
"title": "[[LIVENESS]] has failed!",rn "text":
"[[FAILURE]] Click **Learn More** to go to Status
Monitoring Portal",rn "potentialAction": [rn
{rn "@type": "OpenUri",rn "name":
"Lear More",rn "targets": [rn { "os":
"default", "uri": "http://status.dottor.net" }rn
]rn }rn ]rn}",
"RestoredPayload": "{"text":"The HealthCheck
[[LIVENESS]] is recovered. All is up and running"}"
}
26
Teams Webhook payload
{
"@context": "http://schema.org/extensions",
"@type": "MessageCard",
"themeColor": "0072C6",
"title": "[[LIVENESS]] has failed!",
"text": "[[FAILURE]] Click **Learn More** to go to Status Monitoring Portal",
"potentialAction": [
{
"@type": "OpenUri",
"name": "Lear More",
"targets": [{ "os": "default", "uri": "http://status.dottor.net" }]
}]
}
27
Integrazione con Teams
Notifica in Teams quando un Health Check fallisce e quando
lo stato viene ripristinato
HealthCheckService + RazorPages
29
Conclusioni
Di facili utilizzo, e con molti HealthCheck già pronti
Integrazione con strumenti esterni tramite Webhook
• Teams, Slack, SendGrid, Zapier, IFTTT, …
HealthCheck.UI fornisce un'applicazione di monitoraggio a
costo zero
Utili anche in ambito DevOps: possono essere utilizzati per
verificare il corretto deploy di un'applicazione
Thank you
Any questions?
andreadottor @dottor andreadottor
Andrea Dottor
@dottor
https://github.com/andreadottor
https://www.linkedin.com/in/andreadottor/
ANDREA DOTTOR
www.xedotnet.org | www.dottor.net

More Related Content

What's hot

Nginx conference 2015
Nginx conference 2015Nginx conference 2015
Nginx conference 2015ING-IT
 
Azure Kubernetes Service - benefits and challenges
Azure Kubernetes Service - benefits and challengesAzure Kubernetes Service - benefits and challenges
Azure Kubernetes Service - benefits and challengesWojciech Barczyński
 
Trac Project And Process Management For Developers And Sys Admins Presentation
Trac  Project And Process Management For Developers And Sys Admins PresentationTrac  Project And Process Management For Developers And Sys Admins Presentation
Trac Project And Process Management For Developers And Sys Admins Presentationguest3fc4fa
 
Performance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & WebdriverPerformance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & WebdriverBlazeMeter
 
Tech Talk: DevOps at LeanIX @ Startup Camp Berlin
Tech Talk: DevOps at LeanIX @ Startup Camp BerlinTech Talk: DevOps at LeanIX @ Startup Camp Berlin
Tech Talk: DevOps at LeanIX @ Startup Camp BerlinLeanIX GmbH
 
Automated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsAutomated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsJelastic Multi-Cloud PaaS
 
Service Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and KubernetesService Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and KubernetesSreenivas Makam
 
CI / CD / CS - Continuous Security in Kubernetes
CI / CD / CS - Continuous Security in KubernetesCI / CD / CS - Continuous Security in Kubernetes
CI / CD / CS - Continuous Security in KubernetesSysdig
 
fabric8 ... and Docker, Kubernetes & OpenShift
fabric8 ... and Docker, Kubernetes & OpenShiftfabric8 ... and Docker, Kubernetes & OpenShift
fabric8 ... and Docker, Kubernetes & OpenShiftroland.huss
 
Greach 2014 - Road to Grails 3.0
Greach 2014  - Road to Grails 3.0Greach 2014  - Road to Grails 3.0
Greach 2014 - Road to Grails 3.0graemerocher
 
Kubernetes Security
Kubernetes SecurityKubernetes Security
Kubernetes Securityinovex GmbH
 
Finally, easy integration testing with Testcontainers
Finally, easy integration testing with TestcontainersFinally, easy integration testing with Testcontainers
Finally, easy integration testing with TestcontainersRudy De Busscher
 
Cloud networking deep dive
Cloud networking deep diveCloud networking deep dive
Cloud networking deep diveamylynn11
 
Securing Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPSecuring Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPRafal Gancarz
 
Play Support in Cloud Foundry
Play Support in Cloud FoundryPlay Support in Cloud Foundry
Play Support in Cloud Foundryrajdeep
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction Robert Reiz
 
Andrea Di Persio
Andrea Di PersioAndrea Di Persio
Andrea Di PersioCodeFest
 
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»DataArt
 
Hacking on OpenStack\'s Nova source code
Hacking on OpenStack\'s Nova source codeHacking on OpenStack\'s Nova source code
Hacking on OpenStack\'s Nova source codeZhongyue Luo
 

What's hot (20)

Nginx conference 2015
Nginx conference 2015Nginx conference 2015
Nginx conference 2015
 
Azure Kubernetes Service - benefits and challenges
Azure Kubernetes Service - benefits and challengesAzure Kubernetes Service - benefits and challenges
Azure Kubernetes Service - benefits and challenges
 
Trac Project And Process Management For Developers And Sys Admins Presentation
Trac  Project And Process Management For Developers And Sys Admins PresentationTrac  Project And Process Management For Developers And Sys Admins Presentation
Trac Project And Process Management For Developers And Sys Admins Presentation
 
Performance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & WebdriverPerformance Testing using Real Browsers with JMeter & Webdriver
Performance Testing using Real Browsers with JMeter & Webdriver
 
Tech Talk: DevOps at LeanIX @ Startup Camp Berlin
Tech Talk: DevOps at LeanIX @ Startup Camp BerlinTech Talk: DevOps at LeanIX @ Startup Camp Berlin
Tech Talk: DevOps at LeanIX @ Startup Camp Berlin
 
Automated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsAutomated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE Applications
 
Service Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and KubernetesService Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and Kubernetes
 
CI / CD / CS - Continuous Security in Kubernetes
CI / CD / CS - Continuous Security in KubernetesCI / CD / CS - Continuous Security in Kubernetes
CI / CD / CS - Continuous Security in Kubernetes
 
fabric8 ... and Docker, Kubernetes & OpenShift
fabric8 ... and Docker, Kubernetes & OpenShiftfabric8 ... and Docker, Kubernetes & OpenShift
fabric8 ... and Docker, Kubernetes & OpenShift
 
Greach 2014 - Road to Grails 3.0
Greach 2014  - Road to Grails 3.0Greach 2014  - Road to Grails 3.0
Greach 2014 - Road to Grails 3.0
 
Kubernetes Security
Kubernetes SecurityKubernetes Security
Kubernetes Security
 
Finally, easy integration testing with Testcontainers
Finally, easy integration testing with TestcontainersFinally, easy integration testing with Testcontainers
Finally, easy integration testing with Testcontainers
 
Cloud networking deep dive
Cloud networking deep diveCloud networking deep dive
Cloud networking deep dive
 
Securing Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTPSecuring Microservices using Play and Akka HTTP
Securing Microservices using Play and Akka HTTP
 
Play Support in Cloud Foundry
Play Support in Cloud FoundryPlay Support in Cloud Foundry
Play Support in Cloud Foundry
 
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
 
Ansible Introduction
Ansible Introduction Ansible Introduction
Ansible Introduction
 
Andrea Di Persio
Andrea Di PersioAndrea Di Persio
Andrea Di Persio
 
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»
 
Hacking on OpenStack\'s Nova source code
Hacking on OpenStack\'s Nova source codeHacking on OpenStack\'s Nova source code
Hacking on OpenStack\'s Nova source code
 

Similar to Come sta la nostra applicazione? Un viaggio alla scoperta degli Health Check di ASP.NET Core

Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSAmazon Web Services
 
Kubernetes & Co, beyond the hype
Kubernetes & Co, beyond the hypeKubernetes & Co, beyond the hype
Kubernetes & Co, beyond the hypeAlexandre Touret
 
Delivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWSDelivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWSNGINX, Inc.
 
ThroughTheLookingGlass_EffectiveObservability.pptx
ThroughTheLookingGlass_EffectiveObservability.pptxThroughTheLookingGlass_EffectiveObservability.pptx
ThroughTheLookingGlass_EffectiveObservability.pptxGrace Jansen
 
Cloud-native .NET-Microservices mit Kubernetes @BASTAcon
Cloud-native .NET-Microservices mit Kubernetes @BASTAconCloud-native .NET-Microservices mit Kubernetes @BASTAcon
Cloud-native .NET-Microservices mit Kubernetes @BASTAconMario-Leander Reimer
 
Bluemix paas 기반 saas 개발 사례
Bluemix paas 기반 saas 개발 사례Bluemix paas 기반 saas 개발 사례
Bluemix paas 기반 saas 개발 사례uEngine Solutions
 
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...Amazon Web Services
 
Using Blueprints to Overcome Multi-speed IT Challenges
Using Blueprints to Overcome Multi-speed IT ChallengesUsing Blueprints to Overcome Multi-speed IT Challenges
Using Blueprints to Overcome Multi-speed IT ChallengesIBM UrbanCode Products
 
Oracle appsloadtestbestpractices
Oracle appsloadtestbestpracticesOracle appsloadtestbestpractices
Oracle appsloadtestbestpracticessonusaini69
 
What's new in log insight 3.3 presentation
What's new in log insight 3.3 presentationWhat's new in log insight 3.3 presentation
What's new in log insight 3.3 presentationDavid Pasek
 
Masterless Puppet Using AWS S3 Buckets and IAM Roles
Masterless Puppet Using AWS S3 Buckets and IAM RolesMasterless Puppet Using AWS S3 Buckets and IAM Roles
Masterless Puppet Using AWS S3 Buckets and IAM RolesMalcolm Duncanson, CISSP
 
Introduction to Apache jclouds at NYJavaSIG
Introduction to Apache jclouds at NYJavaSIGIntroduction to Apache jclouds at NYJavaSIG
Introduction to Apache jclouds at NYJavaSIGEverett Toews
 
Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...Maarten Balliauw
 
Scale Your Data Tier with Windows Server AppFabric
Scale Your Data Tier with Windows Server AppFabricScale Your Data Tier with Windows Server AppFabric
Scale Your Data Tier with Windows Server AppFabricWim Van den Broeck
 
Health monitoring and dependency injection - CNUG November 2019
Health monitoring and dependency injection - CNUG November 2019Health monitoring and dependency injection - CNUG November 2019
Health monitoring and dependency injection - CNUG November 2019Alex Thissen
 
Final Report To Executive ManagersXXXXXCCA 625Un
Final Report To Executive ManagersXXXXXCCA 625UnFinal Report To Executive ManagersXXXXXCCA 625Un
Final Report To Executive ManagersXXXXXCCA 625UnChereCheek752
 
AZ-204 A Top-Notch Exam Of Developing Solutions for Microsoft Azure.pdf
AZ-204 A Top-Notch Exam Of Developing Solutions for Microsoft Azure.pdfAZ-204 A Top-Notch Exam Of Developing Solutions for Microsoft Azure.pdf
AZ-204 A Top-Notch Exam Of Developing Solutions for Microsoft Azure.pdfshirlybaker1
 
AWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAmazon Web Services
 

Similar to Come sta la nostra applicazione? Un viaggio alla scoperta degli Health Check di ASP.NET Core (20)

Iac d.damyanov 4.pptx
Iac d.damyanov 4.pptxIac d.damyanov 4.pptx
Iac d.damyanov 4.pptx
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWS
 
Kubernetes & Co, beyond the hype
Kubernetes & Co, beyond the hypeKubernetes & Co, beyond the hype
Kubernetes & Co, beyond the hype
 
Delivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWSDelivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWS
 
ThroughTheLookingGlass_EffectiveObservability.pptx
ThroughTheLookingGlass_EffectiveObservability.pptxThroughTheLookingGlass_EffectiveObservability.pptx
ThroughTheLookingGlass_EffectiveObservability.pptx
 
Cloud-native .NET-Microservices mit Kubernetes @BASTAcon
Cloud-native .NET-Microservices mit Kubernetes @BASTAconCloud-native .NET-Microservices mit Kubernetes @BASTAcon
Cloud-native .NET-Microservices mit Kubernetes @BASTAcon
 
Bluemix paas 기반 saas 개발 사례
Bluemix paas 기반 saas 개발 사례Bluemix paas 기반 saas 개발 사례
Bluemix paas 기반 saas 개발 사례
 
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
 
Using Blueprints to Overcome Multi-speed IT Challenges
Using Blueprints to Overcome Multi-speed IT ChallengesUsing Blueprints to Overcome Multi-speed IT Challenges
Using Blueprints to Overcome Multi-speed IT Challenges
 
Oracle appsloadtestbestpractices
Oracle appsloadtestbestpracticesOracle appsloadtestbestpractices
Oracle appsloadtestbestpractices
 
What's new in log insight 3.3 presentation
What's new in log insight 3.3 presentationWhat's new in log insight 3.3 presentation
What's new in log insight 3.3 presentation
 
Masterless Puppet Using AWS S3 Buckets and IAM Roles
Masterless Puppet Using AWS S3 Buckets and IAM RolesMasterless Puppet Using AWS S3 Buckets and IAM Roles
Masterless Puppet Using AWS S3 Buckets and IAM Roles
 
Introduction to Apache jclouds at NYJavaSIG
Introduction to Apache jclouds at NYJavaSIGIntroduction to Apache jclouds at NYJavaSIG
Introduction to Apache jclouds at NYJavaSIG
 
Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...Sherlock Homepage - A detective story about running large web services - WebN...
Sherlock Homepage - A detective story about running large web services - WebN...
 
Scale Your Data Tier with Windows Server AppFabric
Scale Your Data Tier with Windows Server AppFabricScale Your Data Tier with Windows Server AppFabric
Scale Your Data Tier with Windows Server AppFabric
 
Health monitoring and dependency injection - CNUG November 2019
Health monitoring and dependency injection - CNUG November 2019Health monitoring and dependency injection - CNUG November 2019
Health monitoring and dependency injection - CNUG November 2019
 
citus™ iot ecosystem
citus™ iot ecosystemcitus™ iot ecosystem
citus™ iot ecosystem
 
Final Report To Executive ManagersXXXXXCCA 625Un
Final Report To Executive ManagersXXXXXCCA 625UnFinal Report To Executive ManagersXXXXXCCA 625Un
Final Report To Executive ManagersXXXXXCCA 625Un
 
AZ-204 A Top-Notch Exam Of Developing Solutions for Microsoft Azure.pdf
AZ-204 A Top-Notch Exam Of Developing Solutions for Microsoft Azure.pdfAZ-204 A Top-Notch Exam Of Developing Solutions for Microsoft Azure.pdf
AZ-204 A Top-Notch Exam Of Developing Solutions for Microsoft Azure.pdf
 
AWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for GovernmentAWS Webcast - Build Agile Applications in AWS Cloud for Government
AWS Webcast - Build Agile Applications in AWS Cloud for Government
 

More from Andrea Dottor

Blazor ♥️ JavaScript
Blazor ♥️ JavaScriptBlazor ♥️ JavaScript
Blazor ♥️ JavaScriptAndrea Dottor
 
Dal RenderFragment ai Generics, tips for Blazor developers
Dal RenderFragment ai Generics, tips for Blazor developersDal RenderFragment ai Generics, tips for Blazor developers
Dal RenderFragment ai Generics, tips for Blazor developersAndrea Dottor
 
Blazor per uno sviluppatore Web Form
Blazor per uno sviluppatore Web FormBlazor per uno sviluppatore Web Form
Blazor per uno sviluppatore Web FormAndrea Dottor
 
Blazor ha vinto? Storie di casi reali
Blazor ha vinto? Storie di casi realiBlazor ha vinto? Storie di casi reali
Blazor ha vinto? Storie di casi realiAndrea Dottor
 
What's New in ASP.NET Core 3
What's New in ASP.NET Core 3What's New in ASP.NET Core 3
What's New in ASP.NET Core 3Andrea Dottor
 
Alla scoperta di gRPC
Alla scoperta di gRPCAlla scoperta di gRPC
Alla scoperta di gRPCAndrea Dottor
 
Back to the Future: Migrare da WebForm ad ASP.NET Core gradualmente
Back to the Future: Migrare da WebForm ad ASP.NET Core gradualmente Back to the Future: Migrare da WebForm ad ASP.NET Core gradualmente
Back to the Future: Migrare da WebForm ad ASP.NET Core gradualmente Andrea Dottor
 
Real case: migrate from Web Forms to ASP.NET Core gradually
Real case: migrate from Web Forms to ASP.NET Core graduallyReal case: migrate from Web Forms to ASP.NET Core gradually
Real case: migrate from Web Forms to ASP.NET Core graduallyAndrea Dottor
 
ASP.NET Core - Razor Pages
ASP.NET Core - Razor PagesASP.NET Core - Razor Pages
ASP.NET Core - Razor PagesAndrea Dottor
 
ASP.NET Core - dove siamo arrivati
ASP.NET Core - dove siamo arrivatiASP.NET Core - dove siamo arrivati
ASP.NET Core - dove siamo arrivatiAndrea Dottor
 
Dependency injection questa sconosciuta
Dependency injection questa sconosciutaDependency injection questa sconosciuta
Dependency injection questa sconosciutaAndrea Dottor
 
Customize ASP.NET Core scaffolding
Customize ASP.NET Core scaffoldingCustomize ASP.NET Core scaffolding
Customize ASP.NET Core scaffoldingAndrea Dottor
 
ASP.NET, ottimizziamo con la cache
ASP.NET, ottimizziamo con la cacheASP.NET, ottimizziamo con la cache
ASP.NET, ottimizziamo con la cacheAndrea Dottor
 
Cosa c'è di nuovo in asp.net core 2 0
Cosa c'è di nuovo in asp.net core 2 0Cosa c'è di nuovo in asp.net core 2 0
Cosa c'è di nuovo in asp.net core 2 0Andrea Dottor
 
Creare API pubbliche, come evitare gli errori comuni
 Creare API pubbliche, come evitare gli errori comuni Creare API pubbliche, come evitare gli errori comuni
Creare API pubbliche, come evitare gli errori comuniAndrea Dottor
 
Deploy & Run on Azure App Service
Deploy & Run on Azure App ServiceDeploy & Run on Azure App Service
Deploy & Run on Azure App ServiceAndrea Dottor
 
L'evoluzione del web
L'evoluzione del webL'evoluzione del web
L'evoluzione del webAndrea Dottor
 
Introduzione ad ASP.NET Core
Introduzione ad ASP.NET CoreIntroduzione ad ASP.NET Core
Introduzione ad ASP.NET CoreAndrea Dottor
 
Sviluppare Azure Web Apps
Sviluppare Azure Web AppsSviluppare Azure Web Apps
Sviluppare Azure Web AppsAndrea Dottor
 

More from Andrea Dottor (20)

Blazor ♥️ JavaScript
Blazor ♥️ JavaScriptBlazor ♥️ JavaScript
Blazor ♥️ JavaScript
 
Dal RenderFragment ai Generics, tips for Blazor developers
Dal RenderFragment ai Generics, tips for Blazor developersDal RenderFragment ai Generics, tips for Blazor developers
Dal RenderFragment ai Generics, tips for Blazor developers
 
Blazor per uno sviluppatore Web Form
Blazor per uno sviluppatore Web FormBlazor per uno sviluppatore Web Form
Blazor per uno sviluppatore Web Form
 
Blazor ha vinto? Storie di casi reali
Blazor ha vinto? Storie di casi realiBlazor ha vinto? Storie di casi reali
Blazor ha vinto? Storie di casi reali
 
What's New in ASP.NET Core 3
What's New in ASP.NET Core 3What's New in ASP.NET Core 3
What's New in ASP.NET Core 3
 
Alla scoperta di gRPC
Alla scoperta di gRPCAlla scoperta di gRPC
Alla scoperta di gRPC
 
Back to the Future: Migrare da WebForm ad ASP.NET Core gradualmente
Back to the Future: Migrare da WebForm ad ASP.NET Core gradualmente Back to the Future: Migrare da WebForm ad ASP.NET Core gradualmente
Back to the Future: Migrare da WebForm ad ASP.NET Core gradualmente
 
Real case: migrate from Web Forms to ASP.NET Core gradually
Real case: migrate from Web Forms to ASP.NET Core graduallyReal case: migrate from Web Forms to ASP.NET Core gradually
Real case: migrate from Web Forms to ASP.NET Core gradually
 
ASP.NET Core - Razor Pages
ASP.NET Core - Razor PagesASP.NET Core - Razor Pages
ASP.NET Core - Razor Pages
 
ASP.NET Core - dove siamo arrivati
ASP.NET Core - dove siamo arrivatiASP.NET Core - dove siamo arrivati
ASP.NET Core - dove siamo arrivati
 
Dependency injection questa sconosciuta
Dependency injection questa sconosciutaDependency injection questa sconosciuta
Dependency injection questa sconosciuta
 
Customize ASP.NET Core scaffolding
Customize ASP.NET Core scaffoldingCustomize ASP.NET Core scaffolding
Customize ASP.NET Core scaffolding
 
ASP.NET, ottimizziamo con la cache
ASP.NET, ottimizziamo con la cacheASP.NET, ottimizziamo con la cache
ASP.NET, ottimizziamo con la cache
 
Cosa c'è di nuovo in asp.net core 2 0
Cosa c'è di nuovo in asp.net core 2 0Cosa c'è di nuovo in asp.net core 2 0
Cosa c'è di nuovo in asp.net core 2 0
 
Creare API pubbliche, come evitare gli errori comuni
 Creare API pubbliche, come evitare gli errori comuni Creare API pubbliche, come evitare gli errori comuni
Creare API pubbliche, come evitare gli errori comuni
 
Deploy & Run on Azure App Service
Deploy & Run on Azure App ServiceDeploy & Run on Azure App Service
Deploy & Run on Azure App Service
 
ASP.NET Core
ASP.NET CoreASP.NET Core
ASP.NET Core
 
L'evoluzione del web
L'evoluzione del webL'evoluzione del web
L'evoluzione del web
 
Introduzione ad ASP.NET Core
Introduzione ad ASP.NET CoreIntroduzione ad ASP.NET Core
Introduzione ad ASP.NET Core
 
Sviluppare Azure Web Apps
Sviluppare Azure Web AppsSviluppare Azure Web Apps
Sviluppare Azure Web Apps
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Alison B. Lowndes
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1DianaGray10
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsVlad Stirbu
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»QADay
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsPaul Groth
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxAbida Shariff
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupCatarinaPereira64715
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesThousandEyes
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsExpeed Software
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 

Come sta la nostra applicazione? Un viaggio alla scoperta degli Health Check di ASP.NET Core

  • 1. 1 TOPIC Come sta la nostra applicazione? Un viaggio alla scoperta degli Health Check di ASP.NET Core Andrea Dottor @dottor www.xedotnet.org | www.dottor.net
  • 3. 3 Errori nelle nostre applicazioni Possiamo sapere se la nostra applicazione ha qualcosa che non funziona? (e magari saperlo prima che capiti ad un nostro utente?)
  • 4. 4 Utilizzo dei log I log sono indispensabili ma non bastano I log ci raccontano il passato, riportano errori/eccezioni dopo che sono accaduti • Informazioni dettagliate dell'errore • Stack trace
  • 5. 5 Cosa sono gli Health Check? Introdotti per la prima volta in ASP.NET Core 2.2.0-preview1 Middleware e librerie che permettono di monitorare lo stato di servizi e dipendenze utilizzati • Utili per esporre ad un Container Orchestrator (es Kubernetes) lo stato dell'applicazione eseguita in un container • Monitoraggio di servizi utilizzati: SQL Server, Azure Storage, MongoDB, … • Monitoraggio di informazioni di sistema: memoria, cpu, …
  • 6. 6 Come funzionano gli HealthChecks Permettono di avere un endpoint dove viene ritornato lo stato dell'applicazione (al momento della sua invocazione) • Healthy 😀 • Degraded 😐 • Unhealthy 🤬
  • 7. 7 Implementare un Health Check Creare una classe che implementa IHealthCheck Task<HealthCheckResult> CheckHealthAsync( HealthCheckContext context, CancellationToken cancellationToken) Ritornare: HealthCheckResult.Healthy("A healthy result.") HealthCheckResult.Degraded("A degraded result.") HealthCheckResult.Unhealthy("An unhealthy result.") Registrare l'HealthCheck nella classe di Startup .AddCheck<ExampleHealthCheck>("example_health_check")
  • 9. 9 Entity Framework Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore Verifica che la connessione utilizzata nel DbContext specificato sia corretta • Esegue una "SELECT 1" Registrare l'HealthCheck nella classe di Startup • .AddDbContextCheck<PodcastDbContext>();
  • 10. 10 AspNetCore.Diagnostics.HealthChecks Troviamo molti Health Check già implementati nel repository GitHub AspNetCore.Diagnostics.HealthChecks Nota: non sono mantenuti da Microsoft Sql Server MySql Oracle Sqlite RavenDB Postgres EventStore RabbitMQ IbmMQ Elasticsearch CosmosDb Solr Redis SendGrid System: Disk Storage, Private Memory, Virtual Memory, Process, Windows Service Azure Service Bus: EventHub, Queue and Topics Azure Storage: Blob, Queue and Table Azure Key Vault Azure DocumentDb Azure IoT Hub Amazon DynamoDb Amazon S3 Google Cloud Firestore Network: Ftp, SFtp, Dns, Tcp port, Smtp, Imap MongoDB Kafka Identity Server Uri: single uri and uri groups Consul Hangfire SignalR Kubernetes ArangoDB Gremlin
  • 11. 11 AspNetCore.HealthChecks.System Install-Package AspNetCore.HealthChecks.System Spazio libero in una particolare unità .AddDiskStorageHealthCheck(s => s.AddDrive("C:", 1024)) Memoria massima allocata .AddProcessAllocatedMemoryHealthCheck(512) Processo è in esecuzione .AddProcessHealthCheck("ProcessName", p => p.Length > 0) Servizio è in esecuzione .AddWindowsServiceHealthCheck("someservice", s => s.Status == ServiceControllerStatus.Running)
  • 12. 12 SQL Server Install-Package AspNetCore.HealthChecks.SqlServer Verifica la connessione a un database SQL Server .AddSqlServer(Configuration["Data:ConnectionStrings:Sql"]) .AddSqlServer( connectionString: Configuration["Data:ConnectionStrings:Sql"], healthQuery: "SELECT 1;", name: "sql", failureStatus: HealthStatus.Degraded, tags: new string[] { "db", "sql", "sqlserver" });
  • 13. 13 Servizi e/o url esterni Install-Package AspNetCore.HealthChecks.Uris Verifica che l'url specificato non ritorni uno status code di errore .AddUrlGroup(new Uri("https://localhost:44318/weatherforecast"), "Weather API");
  • 14. 14 AspNetCore.HealthChecks.Hangfire Install-Package AspNetCore.HealthChecks.Hangfire Permette di monitorare i Job di Hangfire .AddHangfire( setup => { setup.MaximumJobsFailed = 5; }, name: "Hangfire")
  • 18. 18 HealthCheck UI - personalizzazione stili La UI di HealthCheck UI può essere personalizzata solo tramite CSS ed un minimo di settings • Fa uso di CSS Variables
  • 20. 20 Health Check Publisher Realizzando una classe che implementi IHealthCheckPublisher è possibile far si che periodicamente vengano verificati gli Health Check per poter inviare (in modalità push) i dati in un servizio esterno • Delay: default 5 secondi dopo l'avvio dell'app • Period: default ogni 30 secondi • Predicate: funzione che permette di fitrare gli health check da valutare • Timeout: default 30 secondi
  • 22. 22 Health Check Publisher Esistono delle implementazioni per i servizi più utilizzati install-package AspNetcore.HealthChecks.Publisher.ApplicationInsights install-package AspNetcore.HealthChecks.Publisher.Datadog install-package AspNetcore.HealthChecks.Publisher.Prometheus install-package AspNetcore.HealthChecks.Publisher.Seq
  • 23. 23 HealthCheck UI - Webhook HealthCheck UI permette di invocare servizi esterni tramite Webhook per notificare eventuali problematiche. Configurabili tramite appsettings e/o codice Molti applicativi permettono di ricevere messaggi tramite Webhhok • Microsoft Teams • Slack • SendGrid • Zapier • IFTTT • …
  • 24. 24 Integrazione con Teams Tramite il connector Incoming Webhhok è possibile abilitare la ricezione di messaggi (generati da HealthCheck.UI) I messaggi possono venir indirizzati in un preciso Channel
  • 25. 25 HealthCheck.UI configurazione Webhook { "Name": "Teams", "Uri": "https://zzzzzz.webhook.office.com/zzz/zzz....", "Payload": "{rn "@context": "http://schema.org/extensions",rn "@type": "MessageCard",rn "themeColor": "0072C6",rn "title": "[[LIVENESS]] has failed!",rn "text": "[[FAILURE]] Click **Learn More** to go to Status Monitoring Portal",rn "potentialAction": [rn {rn "@type": "OpenUri",rn "name": "Lear More",rn "targets": [rn { "os": "default", "uri": "http://status.dottor.net" }rn ]rn }rn ]rn}", "RestoredPayload": "{"text":"The HealthCheck [[LIVENESS]] is recovered. All is up and running"}" }
  • 26. 26 Teams Webhook payload { "@context": "http://schema.org/extensions", "@type": "MessageCard", "themeColor": "0072C6", "title": "[[LIVENESS]] has failed!", "text": "[[FAILURE]] Click **Learn More** to go to Status Monitoring Portal", "potentialAction": [ { "@type": "OpenUri", "name": "Lear More", "targets": [{ "os": "default", "uri": "http://status.dottor.net" }] }] }
  • 27. 27 Integrazione con Teams Notifica in Teams quando un Health Check fallisce e quando lo stato viene ripristinato
  • 29. 29 Conclusioni Di facili utilizzo, e con molti HealthCheck già pronti Integrazione con strumenti esterni tramite Webhook • Teams, Slack, SendGrid, Zapier, IFTTT, … HealthCheck.UI fornisce un'applicazione di monitoraggio a costo zero Utili anche in ambito DevOps: possono essere utilizzati per verificare il corretto deploy di un'applicazione