checkresult from host.var

This forum was archived to /woltlab and is now in read-only mode.
  • Is it possible to create a check and return the result from a host.var.

    Example:

    hots are importet from inventory-database. there is a field like "os_version".

    Now i would like to have a check with something like:

    Code
    1. if host.vars.os_version < 9 then return warning
    2. if host.vars.os_version < 8 then return critival
    3. else return ok
  • I don't think that you can do that inside the Director itself.


    Either you have a check plugin which gets those variables via command parameters on the CLI, or you'll use some Icinga 2 DSL magic. Similar to object accessor functions.


    References:


    https://www.icinga.com/docs/ic…ect-attributes-at-runtime

    https://www.icinga.com/docs/ic…doc/18-library-reference/

    https://www.icinga.com/docs/ic…-library-reference/#macro


    You also need to change the logic order - critical comes first, then warning applies.