integer/array drule.get(object parameters)
该方法允许根据给定的参数检索发现规则.
(object)
定义希望输出的参数.
该方法支持以下参数.
参数 类 | 描述 | |
---|---|---|
dhostids | string/array | 返回给定发现主机创建的发现规则 |
druleids | string/array | 返回给定ID的发现规则 |
dserviceids | string/array | 返回给定发现服务创建的发现规则 |
selectDChecks | query | 属性下返回被发现规则使用的发现检查 支持 count . |
selectDHosts | query | 在dhosts 属性下返回发现规则创建的发现主机支持 count . |
limitSelects | integer | 子选项返回的记录数限制. \\适用于如下子选项: selectDChecks - 结果按dcheckid 排序;selectDHosts - 结果按dhostsid 排序. |
sortfield | string/array | 根据指定的属性字段进行排序. 可能的值: druleid and name . |
countOutput | flag | 下面这些参数的get方法在reference commentary里面有详细说明. |
editable | boolean | |
excludeSearch | flag | |
filter | object | |
limit | integer | |
output | query | |
preservekeys | flag | |
search | object | |
searchByAny | boolean | |
searchWildcardsEnabled | boolean | |
sortorder | string/array | |
startSearch | flag |
(integer/array)
返回:
获取已经配置的发现规则及它们所使用的发现检查.
请求:
{
"jsonrpc": "2.0",
"method": "drule.get",
"params": {
"output": "extend",
"selectDChecks": "extend"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
响应:
{
"jsonrpc": "2.0",
"result": [
{
"druleid": "2",
"proxy_hostid": "0",
"name": "Local network",
"iprange": "192.168.3.1-255",
"delay": "5s",
"nextcheck": "1348754327",
"status": "0",
"dchecks": [
{
"dcheckid": "7",
"druleid": "2",
"type": "3",
"key_": "",
"snmp_community": "",
"ports": "21",
"snmpv3_securityname": "",
"snmpv3_securitylevel": "0",
"snmpv3_authpassphrase": "",
"snmpv3_privpassphrase": "",
"uniq": "0",
"snmpv3_authprotocol": "0",
"snmpv3_privprotocol": "0"
},
{
"dcheckid": "8",
"druleid": "2",
"type": "4",
"key_": "",
"snmp_community": "",
"ports": "80",
"snmpv3_securityname": "",
"snmpv3_securitylevel": "0",
"snmpv3_authpassphrase": "",
"snmpv3_privpassphrase": "",
"uniq": "0",
"snmpv3_authprotocol": "0",
"snmpv3_privprotocol": "0"
}
]
},
{
"druleid": "6",
"proxy_hostid": "0",
"name": "Zabbix agent discovery",
"iprange": "192.168.1.1-255",
"delay": "1h",
"nextcheck": "0",
"status": "0",
"dchecks": [
{
"dcheckid": "10",
"druleid": "6",
"type": "9",
"key_": "system.uname",
"snmp_community": "",
"ports": "10050",
"snmpv3_securityname": "",
"snmpv3_securitylevel": "0",
"snmpv3_authpassphrase": "",
"snmpv3_privpassphrase": "",
"uniq": "0",
"snmpv3_authprotocol": "0",
"snmpv3_privprotocol": "0"
}
]
}
],
"id": 1
}
CDRule::get() in frontends/php/include/classes/api/services/CDRule.php.