integer/array application.get(object parameters)
该方法用于根据规定的参数获取应用集。
(object) 定义所需输出的参数。
该方法提供以下参数。
| Parameter | Type | Description |
|---|---|---|
| applicationids | string/array | 只返回指定 ID 的应用集。 |
| groupids | string/array | 只返回指定主机组所属主机的应用集。 |
| hostids | string/array | 只返回指定主机所属的应用集。 |
| inherited | boolean | 如果设定为true,只返回继承该模板的应用集。 |
| itemids | string/array | 只返回包含特定监控项的应用集。 |
| templated | boolean | 如果设定为true,只返回属于该模板的应用集。 |
| templateids | string/array | 只返回指定模板的应用集。 |
| selectHost | query | 返回值中会包括应用集所属的主机名属性。 |
| selectItems | query | 返回值中会应用集包含的监控项属性。 |
| selectDiscoveryRule | query | 返回值中会包括应用集的底层自动发现规则属性。 |
| selectApplicationDiscovery | query | 返回值中会包括应用集发现的对象属性。 |
| sortfield | string/array | 使用规定的属性将结果分类。 可能的值: applicationid 和name。 |
| countOutput | boolean | 在 reference commentary 中详细描述了所有"get"方法的相关参数. |
| 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) 返回两者其中之一:
从主机中根据名称排序检索所有的应用集。
请求:
{
"jsonrpc": "2.0",
"method": "application.get",
"params": {
"output": "extend",
"hostids": "10001",
"sortfield": "name"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}响应:
{
"jsonrpc": "2.0",
"result": [
{
"applicationid": "13",
"hostid": "10001",
"name": "CPU",
"templateids": []
},
{
"applicationid": "5",
"hostid": "10001",
"name": "Filesystems",
"templateids": []
},
{
"applicationid": "21",
"hostid": "10001",
"name": "General",
"templateids": []
},
{
"applicationid": "15",
"hostid": "10001",
"name": "Memory",
"templateids": []
},
],
"id": 1
}CApplication::get() in frontends/php/include/classes/api/services/CApplication.php.
integer/array application.get(object parameters)
The method allows to retrieve applications according to the given parameters.
(object) Parameters defining the desired output.
The method supports the following parameters.
| Parameter | Type | Description |
|---|---|---|
| applicationids | string/array | Return only applications with the given IDs. |
| groupids | string/array | Return only applications that belong to hosts from the given host groups. |
| hostids | string/array | Return only applications that belong to the given hosts. |
| inherited | boolean | If set to true return only applications inherited from a template. |
| itemids | string/array | Return only applications that contain the given items. |
| templated | boolean | If set to true return only applications that belong to templates. |
| templateids | string/array | Return only applications that belong to the given templates. |
| selectHost | query | Return the host that the application belongs to in the host property. |
| selectItems | query | Return the items contained in the application in the items property. |
| selectDiscoveryRule | query | Return the LLD rule that created the application in the discoveryRule property. |
| selectApplicationDiscovery | query | Return the application discovery object in the applicationDiscovery property. |
| sortfield | string/array | Sort the result by the given properties. Possible values are: applicationid and 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 applications from a host sorted by name.
Request:
{
"jsonrpc": "2.0",
"method": "application.get",
"params": {
"output": "extend",
"hostids": "10001",
"sortfield": "name"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}Response:
{
"jsonrpc": "2.0",
"result": [
{
"applicationid": "13",
"hostid": "10001",
"name": "CPU",
"templateids": []
},
{
"applicationid": "5",
"hostid": "10001",
"name": "Filesystems",
"templateids": []
},
{
"applicationid": "21",
"hostid": "10001",
"name": "General",
"templateids": []
},
{
"applicationid": "15",
"hostid": "10001",
"name": "Memory",
"templateids": []
},
],
"id": 1
}CApplication::get() in frontends/php/include/classes/api/services/CApplication.php.