Zabbix Documentation 1.8

2.23.03.4In development:4.0Unsupported versions:1.82.02.43.2

User Tools

Site Tools


Sidebar


Ask questions to Zabbix Dev Team in person at the Zabbix Summit 2018!
api:host:massadd

Table of Contents

massAdd()

Available since version: 1.8

Parameters

multidimensional array with Hosts, Groups, Template, Macros data

Only host details can be added this way, not hosts themselves.

ParameterTypeOptionalDescriptionDetails
hostsarray Host objects to update
groupsarray Yes Host group objects where hosts should be added.
templatesarray Yes Template objects which should be linked to hosts.
macrosarray Yes Macros objects which should be added to hosts.

Returns

ParameterDescription
resultOperation successful. Result will contain array of updated Host IDs.
errorIn case of any errors

Example

Add two macros to host with ID “100100000010092”

{
"jsonrpc":"2.0",
"method":"host.massAdd",
"params":{
"hosts":
 {
  "hostid": "100100000010092"
 },
"macros": [
  {
    "macro": "{$TEST1}",
    "value": "MACROTEST1"
  },
  {
    "macro": "{$TEST2}",
    "value": "MACROTEST2"
  }
]
},
"auth":"f223adf833b2bf2ff38574a67bba6372",
"id":2
}

Hosts updated successfully:

{
"jsonrpc":"2.0",
"result":{
   "hostids":["100100000010092"]
},
"id":2
}