This method allows to update existing hosts.该方法允许更新目前的主机。
Parameters参数
(object/array)
Host properties to be updated. 需要更新的主机属性。
The hostid
property must be defined for each host, all other properties are optional. Only the given properties will be updated, all others will remain unchanged.每一个主机的hostid属性必须已定义过,其他属性为可选项。Only the given properties will be updated, all others will remain unchanged. 仅指定属性会被更新,其他属性保持不变。
Additionally to the standard host properties, the method accepts the following parameters.另外,对于标准主机属性,此方法接受以下参数。
As opposed to the Zabbix frontend, when name
is the same as host
, updating will not automatically update name
. Both properties need to be updated explicitly.相对于Zabbix前端,当name和host一致,更新host的时候不会自动更新name。两个属性需要明确的更新。
(object)
Returns an object containing the IDs of the updated hosts under the hostids
property.返回一个对象其中包含在hostids属性下已更新主机的ID。
Examples 范例
Enabling a host启用一个主机
Enable host monitoring, i.e. set its status to 0.启用主机监控,例如,把主机状态设置为0。
Request:
- {
- "jsonrpc": "2.0",
- "result": {
- "hostids": [
- "10126"
- ]
- },
- }
Unlinking templates 删除模板链接
Unlink and clear two templates from host.从主机中删除链接并清除两个模板。
Request:
Response:
- {
- "jsonrpc": "2.0",
- "result": {
- "hostids": [
- "10126"
- ]
- },
- "id": 1
- }
Updating host macros更新主机的宏
Replace all host macros with two new ones.用两个新的宏替换主机所有的宏。
Request:
Response:
- {
- "jsonrpc": "2.0",
- "result": {
- "hostids": [
- "10126"
- ]
- },
- }
Updating host inventory 更新主机资产清单
Change inventory mode and add location更改资产清单模式并添加地点。
Request:
- {
- "jsonrpc": "2.0",
- "result": {
- "hostids": [
- "10387"
- ]
- },
- "id": 2
- }