这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.
2022 Zabbix中国峰会
2022 Zabbix中国峰会

获取

描述

integer/array proxy.get(object parameters)

该方法允许根据给定的参数检索proxy。

此方法对于任何用户可用。可以在用户角色设置中撤销调用该方法的权限。更多信息请查看 用户角色

参数

(object) 定义所需输出的参数。

此方法支持以下参数。

参数 类型 描述
proxyids string/array 仅返回具有给定 ID 的proxy。
selectHosts query 返回一个主机属性,其中包含proxy监控的主机。
selectInterface query 返回一个接口属性, 其中包含被 被动proxy使用的proxy接口。
sortfield string/array 按照给定的属性对结果进行排序。

可用值:hostidhoststatus
countOutput boolean 这些参数对所有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) 返回其中一个:

  • 一个对象数组;
  • 如果使用了countOutput参数,被检索对象的数量。

示例

检索所有proxy

检索所有已配置的proxy及其接口。

请求:

{
           "jsonrpc": "2.0",
           "method": "proxy.get",
           "params": {
               "output": "extend",
               "selectInterface": "extend"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

响应:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "host": "Active proxy",
                   "status": "5",
                   "lastaccess": "0",
                   "description": "",
                   "tls_connect": "1",
                   "tls_accept": "1",
                   "tls_issuer": "",
                   "tls_subject": "",
                   "proxy_address": "",
                   "auto_compress": "0",
                   "proxyid": "30091",
                   "interface": []
               },
               {
                   "host": "Passive proxy",
                   "status": "6",
                   "lastaccess": "0",
                   "description": "",
                   "tls_connect": "1",
                   "tls_accept": "1",
                   "tls_issuer": "",
                   "tls_subject": "",
                   "proxy_address": "",
                   "auto_compress": "0",
                   "proxyid": "30092",
                   "interface": {
                       "interfaceid": "30109",
                       "hostid": "30092",
                       "useip": "1",
                       "ip": "127.0.0.1",
                       "dns": "",
                       "port": "10051"
                   ]
               }
           ],
           "id": 1
       }

参见

来源

CProxy::get() in ui/include/classes/api/services/CProxy.php.