Page tree
Skip to end of metadata
Go to start of metadata

URL: https://123.123.123.123/hosts/add.json

Methode: POST

Response: JSON


HostRequired for addingRequired for editingDescriptionInheritedTypeExample

id
(warning)The host ID
integer123

name(warning)(warning)The name of the host
string"default host"

address(warning)(warning)The IP address of the host
string"123.123.123.123"

satellite_id

ID of the satellite if this host is to be monitored by a satellite
integer123

own_contacts

null = contacts from template |

1 = contacts deviating from template


null | integernull or 1

own_contactgroups

null = contact groups from template |

1 = contact groups that differ from the template


null | integernull or 1

own_customvariables

null = no custom variables |

1 = use custom variables


null | integernull or 1

container_id(warning)(warning)ID of the container in which the host is created (1 = /root)
integer123

shared_container

IDs of the containers in which the host is to be shared
array[ 1, 2, 3, ....]

hosttemplate_id(warning)(warning)ID of the host template from which the host inherits its settings
integer123

description

A description of the host
(tick)
string"host description"

Hostgroup(warning)(warning)IDs of the host groups in which the host is to be located(tick)array[ 1, 2, 3, ....]

Parenthost
(warning)The ID of the parent host
null | integernull oder 123

notes

Notes regarding the host(tick)string"Lorem ipsum dolor sit amet"

host_url

The URL of the host(tick)string"http://hosturl.com"

priority

Priority of the host (not yet implemented)(tick)null | integernull or 1

tags

Host specific label(tick)string"Lorem ipsum dolor sit amet"

notify_period_id

ID of the notification_period(tick)integer123

notification_interval(warning)
The notification interval (in seconds)(tick)integer123

notify_on_recovery

Notification upon recovery(tick)null | integernull or 1

notify_on_down

Notification when down(tick)null | integernull or 1

notify_on_unreachable

Notification when unreachable(tick)null | integernull or 1

notify_on_flapping

Notification when flapping(tick)null | integernull or 1

notify_on_downtime

Notification during downtime(tick)null | integernull or 1

active_checks_enabled

The host is actively checked(tick)null | integernull or 1

Contact

The contact IDs(tick)array[ 1, 2, 3, ....]

Contactgroup

IDs for the contact groups(tick)array[ 1, 2, 3, ....]

command_id(warning)
The command ID(tick)null | integernull or 123

check_period_id

The check_period ID(tick)null | integernull or 123

max_check_attempts

The maximum number of checks to be carried out
null | integernull or count

check_interval(warning)
Check interval (in seconds)(tick)null | integernull or 123

retry_interval(warning)
Retry interval (in seconds)(tick)null | integernull or 123

flap_detection_enabled

If flap_detection is to be activated(tick)null | integernull or 1

flap_detection_on_up

flap_detection when status is "up""(tick)null | integernull or 1

flap_detection_on_down

flap_detection when status is "down"(tick)null | integernull or 1

flap_detection_on_unreachable

flap_detection when status is "unreachable"(tick)null | integernull or 1

JSON to create a host via REST API
{
    "Host" : {
        "name":"api host",
        "address":"127.0.0.1",
        "satellite_id":0,
        "own_contacts":null,
        "own_contactgroups":null,
        "own_customvariables":null,
        "container_id":1,
        "shared_container":[],
        "hosttemplate_id":1,
        "description":"",
        "Hostgroup":[],
        "Parenthost":null,
        "notes":"",
        "host_url":"",
        "priority":null,
        "tags":"",
        "notify_period_id":1,
        "notification_interval":null,
        "notify_on_recovery":null,
        "notify_on_down":null,
        "notify_on_unreachable":null,
        "notify_on_flapping":null,
        "notify_on_downtime":null,
        "active_checks_enabled":null,
        "Contact":[],
        "Contactgroup":[],
        "command_id":$COMMAND_ID,
        "check_period_id":null,
        "max_check_attempts":null,
        "check_interval":null,
        "retry_interval":null,
        "flap_detection_enabled":null,
        "flap_detection_on_up":null,
        "flap_detection_on_down":null,
        "flap_detection_on_unreachable":null
    },
    "Hostcommandargumentvalue":[],
    "Customvariable":{
		"1":{
			"name":"NAME1",
			"value":"$VALUE",
			"objecttype_id":256
		}
	}
}
Minimal JSON
{
    "Host" : {
        "name":"api host",
        "address":"127.0.0.1",
        "container_id":1,
        "hosttemplate_id":1,
        "notification_interval":null,
        "check_interval":null,
        "Hostgroup":[],
        "retry_interval":null
    }
}
Response on successful API call
{
  "id": "123"
}
Example error code
{
  "error": {
    "container_id": [
      "Invalid container."
    ]
  }
}
  • No labels