integer/array hostinterface.get(object parameters)
此方法允许获取给定参数的主机接口记录。
(object) 定义期望输出的参数。
该方法支持以下参数。
| 参数 [ | 型](/zh/manual/api/reference_commentary#data_types) 描述 | |
|---|---|---|
| hostids | 字符串/数组 返回给定 | 机使用的主机接口。 |
| interfaceids | 字符串/数组 返回给定 | D的主机接口。 |
| itemids | 字符串/数组 返回给定 | 目的主机接口。 |
| triggerids | 字符串/数组 返回给定 | 发器中项目使用的主机接口。 |
| selectItems | 查询 返 | items属性中使用接口的监控项。 支持 count。 |
| selectHosts | 查询 返 | hosts属性中使用接口作为数组的主机。 |
| limitSelects | 整数 限 | 子选择返回的记录数。 适用于以下子选项: selectItems。 |
| sortfield | 字符串/数组 按照给定 | 属性对结果进行排序。 可能的值: interfaceid,dns,ip。 |
| countOutput | 布尔值 这些 | 数对于所有get方法都是通用的,详情可参考 reference commentary。 |
| editable | 布尔值 :: | |
| excludeSearch | 布尔值 :: | |
| filter | 对象 : | : |
| limit | 整数 : | : |
| nodeids | 字符串/数组 ::: | |
| output | 查询 : | : |
| preservekeys | 布尔值 :: | |
| search | 对象 : | : |
| searchByAny | 布尔值 :: | |
| searchWildcardsEnabled | 布尔值 :: | |
| sortorder | 字符串/数组 ::: | |
| startSearch | 布尔值 :: | |
(integer/array) 返回:
countOutput参数,则返回获取到的对象数量。获取ID为''30057'的主机使用的接口的所有数据。
请求:
{
"jsonrpc": "2.0",
"result": [
{
"interfaceid": "30050",
"hostid": "30057",
"main": "1",
"type": "1",
"useip": "1",
"ip": "127.0.0.1",
"dns": "",
"port": "10050",
"details": []
},
{
"interfaceid": "30067",
"hostid": "30057",
"main": "0",
"type": "1",
"useip": "0",
"ip": "",
"dns": "localhost",
"port": "10050",
"details": []
},
{
"interfaceid": "30068",
"hostid": "30057",
"main": "1",
"type": "2",
"useip": "1",
"ip": "127.0.0.1",
"dns": "",
"port": "161",
"details": {
"version": "2",
"bulk": "0",
"community": "{$SNMP_COMMUNITY}"
}
}
],
"id": 1
}CHostInterface::get() in ui/include/classes/api/services/CHostInterface.php.