Zabbix Documentation 1.8

2.23.04.0 (current)In development:4.2 (devel)Unsupported:1.82.02.43.23.4

User Tools

Site Tools


Sidebar

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
}