The method allows to retrieve LLD rules according to the given parameters. 此方法允许根据给定的参数获取LLD规则。

    Parameters 参数

    (object) Parameters defining the desired output. (object) 参数定义期望输出。

    The method supports the following parameters. 此方法支持如下参数。

    (integer/array) Returns either:

    • an array of objects;

    • the count of retrieved objects, if the countOutput parameter has been used.

    Examples 示例

    Retrieving discovery rules from a host 从一个主机获取多有的发现规则

    Request:

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": [
    4. {
    5. "itemid": "27425",
    6. "type": "0",
    7. "snmp_community": "",
    8. "snmp_oid": "",
    9. "hostid": "10202",
    10. "name": "Network interface discovery",
    11. "key_": "net.if.discovery",
    12. "delay": "1h",
    13. "state": "0",
    14. "status": "0",
    15. "trapper_hosts": "",
    16. "snmpv3_securityname": "",
    17. "snmpv3_securitylevel": "0",
    18. "snmpv3_authpassphrase": "",
    19. "snmpv3_privpassphrase": "",
    20. "error": "",
    21. "templateid": "22444",
    22. "params": "",
    23. "ipmi_sensor": "",
    24. "authtype": "0",
    25. "username": "",
    26. "password": "",
    27. "publickey": "",
    28. "privatekey": "",
    29. "interfaceid": "119",
    30. "port": "",
    31. "description": "Discovery of network interfaces as defined in global regular expression \"Network interfaces for discovery\".",
    32. "lifetime": "30d",
    33. "snmpv3_authprotocol": "0",
    34. "snmpv3_privprotocol": "0",
    35. "snmpv3_contextname": "",
    36. "jmx_endpoint": "",
    37. "master_itemid": "0",
    38. "timeout": "3s",
    39. "url": "",
    40. "query_fields": [],
    41. "posts": "",
    42. "status_codes": "200",
    43. "follow_redirects": "1",
    44. "post_type": "0",
    45. "http_proxy": "",
    46. "headers": [],
    47. "retrieve_mode": "0",
    48. "request_method": "1",
    49. "ssl_cert_file": "",
    50. "ssl_key_password": "",
    51. "verify_peer": "0",
    52. "verify_host": "0",
    53. "allow_traps": "0"
    54. },
    55. {
    56. "itemid": "27426",
    57. "type": "0",
    58. "snmp_community": "",
    59. "snmp_oid": "",
    60. "hostid": "10202",
    61. "name": "Mounted filesystem discovery",
    62. "key_": "vfs.fs.discovery",
    63. "delay": "1h",
    64. "state": "0",
    65. "status": "0",
    66. "trapper_hosts": "",
    67. "snmpv3_securityname": "",
    68. "snmpv3_authpassphrase": "",
    69. "snmpv3_privpassphrase": "",
    70. "error": "",
    71. "templateid": "22450",
    72. "params": "",
    73. "ipmi_sensor": "",
    74. "authtype": "0",
    75. "username": "",
    76. "password": "",
    77. "publickey": "",
    78. "privatekey": "",
    79. "interfaceid": "119",
    80. "port": "",
    81. "description": "Discovery of file systems of different types as defined in global regular expression \"File systems for discovery\".",
    82. "lifetime": "30d",
    83. "snmpv3_authprotocol": "0",
    84. "snmpv3_privprotocol": "0",
    85. "snmpv3_contextname": "",
    86. "jmx_endpoint": "",
    87. "master_itemid": "0",
    88. "timeout": "3s",
    89. "url": "",
    90. "query_fields": [],
    91. "posts": "",
    92. "status_codes": "200",
    93. "follow_redirects": "1",
    94. "post_type": "0",
    95. "http_proxy": "",
    96. "headers": [],
    97. "retrieve_mode": "0",
    98. "request_method": "1",
    99. "ssl_cert_file": "",
    100. "ssl_key_file": "",
    101. "ssl_key_password": "",
    102. "verify_peer": "0",
    103. "verify_host": "0",
    104. "allow_traps": "0"
    105. }
    106. ],
    107. "id": 1
    108. }

    Retrieving filter conditions

    Retrieve the name of the LLD rule “24681” and its filter conditions. The filter uses the “and” evaluation type, so the formula property is empty and eval_formula is generated automatically.

    Request:

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": [
    4. {
    5. "itemid": "24681",
    6. "name": "Filtered LLD rule",
    7. "filter": {
    8. "evaltype": "1",
    9. "formula": "",
    10. "conditions": [
    11. {
    12. "macro": "{#MACRO1}",
    13. "value": "@regex1",
    14. "operator": "8",
    15. "formulaid": "A"
    16. },
    17. {
    18. "macro": "{#MACRO2}",
    19. "value": "@regex2",
    20. "operator": "8",
    21. "formulaid": "B"
    22. },
    23. {
    24. "macro": "{#MACRO3}",
    25. "operator": "8",
    26. "formulaid": "C"
    27. }
    28. ],
    29. "eval_formula": "A and B and C"
    30. }
    31. }
    32. ],
    33. "id": 1
    34. }

    Retrieve LLD rule by URL 根据URL获取LLD规则

    Retrieve LLD rule for host by rule URL field value. Only exact match of URL string defined for LLD rule is supported. 根据主机的规则URL字段值获取LLD规则。仅返回精确匹配定义的URL字符串的规则。

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": [
    4. "itemid": "28336",
    5. "type": "19",
    6. "snmp_community": "",
    7. "snmp_oid": "",
    8. "hostid": "10257",
    9. "name": "API HTTP agent",
    10. "key_": "api_discovery_rule",
    11. "delay": "5s",
    12. "history": "90d",
    13. "trends": "0",
    14. "status": "0",
    15. "value_type": "4",
    16. "trapper_hosts": "",
    17. "units": "",
    18. "snmpv3_securityname": "",
    19. "snmpv3_securitylevel": "0",
    20. "snmpv3_authpassphrase": "",
    21. "snmpv3_privpassphrase": "",
    22. "error": "",
    23. "lastlogsize": "0",
    24. "logtimefmt": "",
    25. "templateid": "0",
    26. "valuemapid": "0",
    27. "params": "",
    28. "ipmi_sensor": "",
    29. "authtype": "0",
    30. "username": "",
    31. "password": "",
    32. "publickey": "",
    33. "privatekey": "",
    34. "mtime": "0",
    35. "flags": "1",
    36. "interfaceid": "5",
    37. "port": "",
    38. "description": "",
    39. "inventory_link": "0",
    40. "lifetime": "30d",
    41. "snmpv3_authprotocol": "0",
    42. "snmpv3_privprotocol": "0",
    43. "state": "0",
    44. "snmpv3_contextname": "",
    45. "jmx_endpoint": "",
    46. "master_itemid": "0",
    47. "timeout": "3s",
    48. "url": "http://127.0.0.1/discoverer.php",
    49. "query_fields": [
    50. {
    51. "mode": "json"
    52. },
    53. {
    54. "elements": "2"
    55. }
    56. ],
    57. "posts": "",
    58. "status_codes": "200",
    59. "follow_redirects": "1",
    60. "post_type": "0",
    61. "http_proxy": "",
    62. "headers": {
    63. "X-Type": "api",
    64. "Authorization": "Bearer mF_A.B5f-2.1JcM"
    65. },
    66. "retrieve_mode": "0",
    67. "request_method": "1",
    68. "ssl_cert_file": "",
    69. "ssl_key_file": "",
    70. "ssl_key_password": "",
    71. "verify_peer": "0",
    72. "verify_host": "0",
    73. "allow_traps": "0"
    74. }
    75. ],
    76. }

    Source