Available since version: 1.8
The method is used to control all host attributes including host template linkage, macros and host group membership. The method is a wrapper for host.massUpdate function.
Parameter | Type | Optional | Description | Details |
---|---|---|---|---|
hostid | string | Host ID. | ||
host | string | Yes | Host name. | |
status | int | Yes | Host Status. | |
dns | string | Yes | Host DNS. | |
ip | string | Yes | Host IP. | |
useip | int | Yes | Use IP. | |
port | int | Yes | Host Port. | |
proxy_hostid | int | Yes | Proxy id. | |
useipmi | int | Yes | Use IPMI. | |
ipmi_ip | string | Yes | IPMI IP. | |
ipmi_port | int | Yes | IPMI port. | |
ipmi_authtype | int | Yes | IPMI authentication type. | |
ipmi_privilege | int | Yes | IPMI privilege. | |
ipmi_username | string | Yes | IPMI username. | |
ipmi_password | string | Yes | IPMI password. | |
groups | array | Yes | Host groups. | |
templates | array | Yes | Update host templates linkage. Missing templates will be linked, existed stay, others unlinked | |
templates_clear | array | Yes | Templates to unlink and clear. | |
macros | array | Yes | Update host macros. Missing macros will be added, existed updated, others deleted. |
Parameter | Description |
---|---|
result | Operation successful. Result will contain array of updated Host IDs. |
error | In case of any errors |
Enable host, .i.e set its status to '0':
{
"jsonrpc": "2.0",
"method": "host.update",
"params": {
"hostid": "10092",
"status": 0
},
"auth": "700ca65537074ec963db7efabda78259",
"id": 2
}
Retrieved updated host IDs:
Unlink and clear templates on host:
{
"jsonrpc": "2.0",
"method": "host.update",
"params": {
"hostid": "10126",
"templates_clear": [{
"templateid": "10124"
},{
"templateid": "10125"
}]
},
"auth": "700ca65537074ec963db7efabda78259",
"id": 2
}
Retrieved updated host IDs:
Update macros on host:
{
"jsonrpc": "2.0",
"method": "host.update",
"params": {
"hostid": "10126",
"macros":[{
"macro":"{$PASS}",
"value":"password"
},{
"macro":"{$DISC}",
"value":"sda"
}]
},
"auth": "700ca65537074ec963db7efabda78259",
"id": 2
}
Retrieved updated host IDs: