This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

host.massupdate

Description

object host.massupdate(object parameters)

This method allows to simultaneously replace or remove related objects and update properties on multiple hosts.

This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object) Parameters containing the IDs of the hosts to update and the properties that should be updated.

Additionally to the standard host properties, the method accepts the following parameters.

Parameter Type Description
hosts
(required)
object/array Hosts to be updated.

The hosts must have the hostid property defined.
groups object/array Host groups to replace the current host groups the hosts belong to.

The host groups must have the groupid property defined.
interfaces object/array Host interfaces to replace the current host interfaces on the given hosts.
inventory object Host inventory properties.

Host inventory mode cannot be updated using the inventory parameter, use inventory_mode instead.
macros object/array User macros to replace the current user macros on the given hosts.
templates object/array Templates to replace the currently linked templates on the given hosts.

The templates must have the templateid property defined.
templates_clear object/array Templates to unlink and clear from the given hosts.

The templates must have the templateid property defined.

Return values

(object) Returns an object containing the IDs of the updated hosts under the hostids property.

Examples

Enabling multiple hosts

Enable monitoring of two hosts, i.e., set their status to 0.

Request:

{
           "jsonrpc": "2.0",
           "method": "host.massupdate",
           "params": {
               "hosts": [
                   {
                       "hostid": "69665"
                   },
                   {
                       "hostid": "69666"
                   }
               ],
               "status": 0
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "hostids": [
                   "69665",
                   "69666"
               ]
           },
           "id": 1
       }

See also

Source

CHost::massUpdate() in ui/include/classes/api/services/CHost.php.