Retrive output from check_command

I created check command

object CheckCommand "check_interfaces" {
  command = [ "ip", "-br", "addr" ]

When create service

apply Service "intf" {
  host_name = "localhost"
  check_command = "check_interfaces"
  vars.stat = last_check_result.output
  command_endpoint = host.vars.agent_endpoint
  assign where host.vars.agent_endpoint

last_check_result in Host or Service objects always return “nul”. Same for last_check_result.output

Is there any way to use check_command output and apply service depend on that output?

  • Version used (icinga2 --version)
  icinga2 - The Icinga 2 network monitoring daemon (version: 2.11.2-1)

Copyright (c) 2012-2022 Icinga GmbH (
License GPLv2+: GNU GPL version 2 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

System information:
  Platform: CentOS Linux
  Platform version: 7 (Core)
  Kernel: Linux
  Kernel version: 3.10.0-957.27.2.el7.x86_64
  Architecture: x86_64

Build information:
  Compiler: GNU 4.8.5
  Build host: runner-LTrJQZ9N-project-322-concurrent-0

Application information:

General paths:
  Config directory: /etc/icinga2
  Data directory: /var/lib/icinga2
  Log directory: /var/log/icinga2
  Cache directory: /var/cache/icinga2
  Spool directory: /var/spool/icinga2
  Run directory: /run/icinga2

Old paths (deprecated):
  Installation root: /usr
  Sysconf directory: /etc
  Run directory (base): /run
  Local state directory: /var

Internal paths:
  Package data directory: /usr/share/icinga2
  State path: /var/lib/icinga2/icinga2.state
  Modified attributes path: /var/lib/icinga2/modified-attributes.conf
  Objects path: /var/cache/icinga2/icinga2.debug
  Vars path: /var/cache/icinga2/icinga2.vars
  PID path: /run/icinga2/
  • Enabled features (icinga2 feature list)
Disabled features: compatlog debuglog elasticsearch gelf graphite opentsdb perfdata statusdata syslog
Enabled features: api checker ido-pgsql influxdb mainlog notification

No, as the result and output are runtime variables which are not available during configuration compilation.

We had also similar challeng … I have ended up with developing wrapper written in python.

so the idea is → exec nagios_plugin → store results in variable of the → do evaluation and thresholding → send status to icinga with same or diff output msg.

or you can write your own icinga plugin for checking interface :slight_smile:

So, how/where i can use last_check_result?

For example when accessing objects during runtime to build your own cluster check: Advanced Topics - Icinga 2