integer/array hostgroup.get(object parameters)
The method allows to retrieve host groups according to the given parameters.
This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.
(object)
Parameters defining the desired output.
The method supports the following parameters.
Parameter | Type | Description |
---|---|---|
graphids | ID/array | Return only host groups that contain hosts with the given graphs. |
groupids | ID/array | Return only host groups with the given host group IDs. |
hostids | ID/array | Return only host groups that contain the given hosts. |
maintenanceids | ID/array | Return only host groups that are affected by the given maintenances. |
triggerids | ID/array | Return only host groups that contain hosts with the given triggers. |
with_graphs | flag | Return only host groups that contain hosts with graphs. |
with_graph_prototypes | flag | Return only host groups that contain hosts with graph prototypes. |
with_hosts | flag | Return only host groups that contain hosts. |
with_httptests | flag | Return only host groups that contain hosts with web checks. Overrides the with_monitored_httptests parameter. |
with_items | flag | Return only host groups that contain hosts with items. Overrides the with_monitored_items and with_simple_graph_items parameters. |
with_item_prototypes | flag | Return only host groups that contain hosts with item prototypes. Overrides the with_simple_graph_item_prototypes parameter. |
with_simple_graph_item_prototypes | flag | Return only host groups that contain hosts with item prototypes, which are enabled for creation and have numeric type of information. |
with_monitored_httptests | flag | Return only host groups that contain hosts with enabled web checks. |
with_monitored_hosts | flag | Return only host groups that contain monitored hosts. |
with_monitored_items | flag | Return only host groups that contain hosts with enabled items. Overrides the with_simple_graph_items parameter. |
with_monitored_triggers | flag | Return only host groups that contain hosts with enabled triggers. All of the items used in the trigger must also be enabled. |
with_simple_graph_items | flag | Return only host groups that contain hosts with numeric items. |
with_triggers | flag | Return only host groups that contain hosts with triggers. Overrides the with_monitored_triggers parameter. |
selectDiscoveryRules | query | Return a discoveryRules property with the LLD rules that discovered the host group. |
selectGroupDiscoveries | query | Return a groupDiscoveries property with the host group discovery objects.Each host group discovery object is a host group prototype linked to the discovered host group and has the following properties: parent_group_prototypeid - (ID) ID of the host group prototype from which the host group was discovered;name - (string) name of the host group prototype;lastcheck - (timestamp) time when the host group was last discovered;ts_delete - (timestamp) time when the host group that is no longer discovered will be deleted;status - (int) host group discovery status:0 - (default) host group is discovered, 1 - host group is not discovered anymore. |
selectHostPrototypes | query | Return a hostPrototypes property with host prototypes that discovered this host group. |
selectHosts | query | Return a hosts property with the hosts that belong to the host group.Supports count . |
limitSelects | integer | Limits the number of records returned by subselects. Applies to the following subselects: selectHosts - results will be sorted by host . |
sortfield | string/array | Sort the result by the given properties. Possible values: groupid , name . |
countOutput | boolean | These parameters being common for all get methods are described in detail in the reference commentary page. |
editable | boolean | |
excludeSearch | boolean | |
filter | object | |
limit | integer | |
output | query | |
preservekeys | boolean | |
search | object | |
searchByAny | boolean | |
searchWildcardsEnabled | boolean | |
sortorder | string/array | |
startSearch | boolean |
(integer/array)
Returns either:
countOutput
parameter has been used.Retrieve all data about two host groups named "Zabbix servers" and "Linux servers".
{
"jsonrpc": "2.0",
"method": "hostgroup.get",
"params": {
"output": "extend",
"filter": {
"name": [
"Zabbix servers",
"Linux servers"
]
}
},
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"groupid": "2",
"name": "Linux servers",
"internal": "0"
},
{
"groupid": "4",
"name": "Zabbix servers",
"internal": "0"
}
],
"id": 1
}
CHostGroup::get() in ui/include/classes/api/services/CHostGroup.php.