ASP dot NET Core Health Checks

Icinga Module for ASP.NET Core Health Checks

Icinga Module for ASP.NET Core Health Checks

This module allows to query health checks from ASP.NET Core services, which use the libraries from Xabaril/AspNetCore.Diagnostics.HealthChecks and their Response writers:

Requirements

Please install:

Examples

Given you configured your health checks like that in your ASP.NET Core Web Application:

config.MapHealthChecks("/health", new HealthCheckOptions
  {
     Predicate = _ => true,
     ResponseWriter = UIResponseWriter.WriteHealthCheckUIRespons
  });

Query the overall status:

check_aspnetcore_healthcheck --url http://servicename/health

Query the status of the health check named PostgreSQL

check_aspnetcore_healthcheck --url http://servicename/health --health-check-name "PostgreSQL"

Minimal Example

Copy the check_aspnetcore_healthcheck to /usr/lib/nagios/plugins

Example in Icinga config:

object CheckCommand "aspnetcore_healthcheck" {
  command = [ PluginDir + "/check_aspnetcore_healthcheck" ]
  arguments = {
    "--url" = {
      value = "$url$",
      description = "The URL of the health check"
    },
    "--health-check-name" = {
      value = "$health-check-name$",
      description = "The name of the health check module, skip it to query overall status"
    }
  }
}

object Host "Host1" {
  address = "host1"
  check_command="hostalive"
}  

object Service "RssService" {
  host_name = "192.168.65.2"
  check_command = "aspnetcore_healthcheck"
  vars.url = "http://host.lcl:8090/health"
}