Check State in Metrics Writers

Hello,

I am currently experimenting with visualizing the state of my hosts using Grafana.

I noticed that the OpenTSDB Writer also writes a few additional metrics, e.g. the state of the check.

Other Writers, especially the OTLPMetricsWriter (which i would like to use, since i already have a prometheus instance in my stack), do not seem to write that kind of information.

Is it possible to add this, or do i have to use the OpenTSDB writer, if i want to add the Status of a check to Grafana?

object OTLPMetricsWriter "oteltest" {
  host = "127.0.0.1"
  port = 8428

  metrics_endpoint = "/opentelemetry/v1/metrics"
  service_namespace = "icinga2-test"

  host_resource_attributes = {
    "check.return_code" = "$host.last_check_result.exit_status$"
  }

  service_resource_attributes = {
    "check.return_code" = "$service.last_check_result.exit_status$"
  }
  enable_send_thresholds = true
}

Thank you so much!

I didn’t think about adding the Exit Status as a label.

This works for me.