Skip to content

icinga create-host

Creates a new host object

Description

Creates a new host object

Synopsis

icinga create-host
    [--site <site>]
    [--cluster <cluster>]
    --name <name>
    [--templates <templates>]
    [--ignore_on_err]
    [--address <address>]
    [--groups <groups>]
    [--vars <vars>]
    --check_command <check_command>

Arguments

site - (string)

     Site where this command will be executed
     Example: --site "site-1"
     Default: input.site      Attributes: optional

cluster - (string)

     Name of Icinga cluster
     Example: --cluster "icinga-default"
     Default: icinga-default      Attributes: optional

name - (string)

     Name of the host object
     Example: --name "example.localdomain"
     Default: _None_      Attributes: required

templates - (string)

     Import existing configuration templates for this object type. These templates must either be statically configured or provided in config packages
     Example: --templates "generic-host"
     Default: _None_      Attributes: optional, multiple allowed

ignore_on_err - (bool)

     If set, Ignore object creation errors and return an HTTP 200 status instead.
     Example: --ignore_on_err
     Default: _None_      Attributes: optional

address - (string)

     The host’s IPv4 address. Available as command runtime macro $address$ if set.
     Example: --address "192.168.1.1"
     Default: _None_      Attributes: optional

groups - (string)

     A list of host groups this host belongs to
     Example: --groups "group1"
     Default: _None_      Attributes: optional, multiple allowed

vars - (string)

     A dictionary containing custom variables that are specific to this host.
     Example: --vars "{"os":"linux"}"
     Default: _None_      Attributes: optional

check_command - (string)

     The name of the check command.
     Example: --check_command "hostalive"
     Default: _None_      Attributes: required

Examples

Input:

! icinga create-host --cluster "icinga-default" --name "host1" --templates "generic-host" --ignore_on_err --address "192.168.5.96" --check_command "hostalive" --vars `{"os":"linux"}`
Output:
{
  "results": [
    {
      "code": 200,
      "status": "Object was created"
    }
  ]
}

Access Control

To use this command, you need access to the following:

Field Value
Action "create"
Service Type "icinga"
Service Instance cluster
Namespace
Object Type "host"
Object ID

Please see Access Control for details.