Zabbix Documentation 1.8

3.04.04.2 (current)In development:4.4 (devel)Unsupported:1.82.02.22.43.23.4

User Tools

Site Tools


Sidebar

api:host:get

Table of Contents

get()

Available since version: 1.8
This function allows you to retrieve host details based on filtering options. All parameters are optional. If parameter is set in query this option counted as ON, except if parameter is equal to NULL.

Parameters

ParameterTypeDescriptionDetails
nodeidsarrayNode IDs
groupidsarrayHostGroup IDs
hostidsarrayHost IDs
templateidsarrayTemplate IDs
itemidsarrayItem IDs
triggeridsarrayTrigger IDs
graphidsarrayGraph IDs
proxyidsarrayProxy IDs
maintenanceidsarrayMaintenance IDs
dhostidsarrayDiscovered host IDs
dserviceidsarrayDiscovered services IDs
monitored_hostsintegerreturn only monitored Hosts
templated_hostsintegerinclude templates in result
proxy_hostsintegerreturn only Proxies
with_itemsintegeronly with items
with_monitored_itemsintegeronly with monitored items
with_historical_itemsintegeronly with historical items
with_triggersintegeronly with triggers
with_monitored_triggersintegeronly with monitored triggers
with_httptestsintegeronly with http tests
with_monitored_httptestsintegeronly with monitored http tests
with_graphsintegeronly with graphs
editableintegeronly with read-write permission. Ignored for SuperAdmins
filterarrayOptional filter by host fields
searcharrayReturn hosts by any given host object field pattern
startSearchintegerSearch hosts field pattern only in start of the field
excludeSearchintegerExclude from result, hosts by given field pattern
searchWildcardsEnabledintegerSearch pattern in whole field using wildcards 1 - enable, 0 - disable
outputstringOutput options Values: shorten, refer, extend
select_groupsstringSelect host groups Values: shorten, refer, extend
selectParentTemplatesstringSelect host templates Values: shorten, refer, extend
select_itemsstringSelect host items Values: shorten, refer, extend
select_triggersstringSelect host triggers Values: shorten, refer, extend
select_graphsstringSelect host graphs Values: shorten, refer, extend
select_dhostsstringSelect host related discovery hosts Values: shorten, refer, extend
select_dservicesstringSelect host related discovery services Values: shorten, refer, extend
select_applicationsstringSelect host applications Values: shorten, refer, extend
select_macrosstringSelect host macros Values: shorten, refer, extend
select_profilestringSelect host profile Values: shorten, refer, extend
countOutputintegerCount hosts, return the number of hosts found
groupCountintegerReturn the number of results grouped by given IDs
preservekeysintegerReturn hash instead of array Keys of hash are object IDs
sortfieldstringSort by host field Values: hostid,host,status,dns,ip
sortorderstringSort order Values: ASC, DESC
limitintmax number of host objects to return

Returns

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

Example

Get hosts details by host name “Zabbix-server”,“Zabbix-server TEST”:

{
"jsonrpc":"2.0",
"method":"host.get",
"params":{
	"output":"extend",
	"filter":{
		"host":["Zabbix-server","Zabbix-server TEST"]
		}
	},
"auth":"6f38cddc44cfbb6c1bd186f9a220b5a0",
"id":2
}
Retrieved host details:

{
"jsonrpc":"2.0",
"result":[{
	"maintenances":[{
		"maintenanceid":"0"
	}],
	"hostid":"100100000010017",
	"proxy_hostid":"0",
	"host":"ZABBIX-Server",
	"dns":"ip4-dm",
	"useip":"1",
	"ip":"192.168.3.4",
	"port":"31055",
	"status":"0",
	"disable_until":"0",
	"error":"",
	"available":"1",
	"errors_from":"0",
	"lastaccess":"0",
	"inbytes":"0",
	"outbytes":"0",
	"useipmi":"0",
	"ipmi_port":"623",
	"ipmi_authtype":"-1",
	"ipmi_privilege":"2",
	"ipmi_username":"",
	"ipmi_password":"",
	"ipmi_disable_until":"0",
	"ipmi_available":"0",
	"snmp_disable_until":"0",
	"snmp_available":"0",
	"maintenanceid":"0",
	"maintenance_status":"0",
	"maintenance_type":"0",
	"maintenance_from":"0",
	"ipmi_ip":"",
	"ipmi_errors_from":"0",
	"snmp_errors_from":"0",
	"ipmi_error":"",
	"snmp_error":""
},{
	"maintenances":[{
		"maintenanceid":"0"
	}],
	"hostid":"100100000010229",
	"proxy_hostid":"0",
	"host":"ZABBIX-Server TEST",
	"dns":"ip4-dm",
	"useip":"1",
	"ip":"192.168.3.4",
	"port":"31055",
	"status":"0",
	"disable_until":"0",
	"error":"",
	"available":"1",
	"errors_from":"0",
	"lastaccess":"0",
	"inbytes":"0",
	"outbytes":"0",
	"useipmi":"0",
	"ipmi_port":"623",
	"ipmi_authtype":"-1",
	"ipmi_privilege":"2",
	"ipmi_username":"",
	"ipmi_password":"",
	"ipmi_disable_until":"0",
	"ipmi_available":"0",
	"snmp_disable_until":"0",
	"snmp_available":"0",
	"maintenanceid":"0",
	"maintenance_status":"0",
	"maintenance_type":"0",
	"maintenance_from":"0",
	"ipmi_ip":"",
	"ipmi_errors_from":"0",
	"snmp_errors_from":"0",
	"ipmi_error":"",
	"snmp_error":""
}],
"id":2
}