Skip to content

icinga create-service

Creates a new service object

Description

Creates a new service object

Synopsis

icinga create-service
    [--site <site>]
    [--cluster <cluster>]
    --name <name>
    [--templates <templates>]
    [--ignore_on_err]
    --host_name <host_name>
    [--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 service object. Must be unique on a per-host basis
     Example: --name "service1"
     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-service"
     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

host_name - (string)

     The host this service belongs to. There must be a Host object with that name.
     Example: --host_name "host1"
     Default: _None_      Attributes: required

groups - (string)

     A list of service groups this service belongs to
     Example: --groups "group1"
     Default: _None_      Attributes: optional

vars - (string)

     A dictionary containing custom variables that are specific to this service.
     Example: --vars "{"snmp_community":"public", "snmp_oid":"DISMAN-EVENT-MIB::sysUpTimeInstance"}"
     Default: _None_      Attributes: optional

check_command - (string)

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

Examples

Input:

! icinga create-service --name "service1" --host_name "host1" --check_command "snmp" --vars `{"snmp_community":"public", "snmp_oid":"DISMAN-EVENT-MIB::sysUpTimeInstance"}`
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 "service"
Object ID

Please see Access Control for details.