This method allows to create new LLD rules.此方法允许创建新的LLD规则。

    Parameters 参数

    LLD rules to create.

    Additionally to the standard LLD rule properties, the method accepts the following parameters.除了标准LLD规则属性之外,该方法接受以下参数。

    Returns an object containing the IDs of the created LLD rules under the property. The order of the returned IDs matches the order of the passed LLD rules.返回一个包含“itemid”属性下创建的LLD规则的ID的对象。 返回的ID的顺序与传递的LLD规则的顺序相匹配。

    Examples 示例

    Creating an LLD rule

    Request:

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "itemids": [
    4. "27665"
    5. ]
    6. },
    7. "id": 1
    8. }

    Using a filter

    Create an LLD rule with a set of conditions to filter the results by. The conditions will be grouped together using the logical “and” operator.

    Request:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": {
    4. "itemids": [
    5. "27665"
    6. },
    7. "id": 1
    8. }

    Using a custom expression filter

    Create an LLD rule with a filter that will use a custom expression to evaluate the conditions. The LLD rule must only discover objects the “{#MACRO1}” macro value of which matches both regular expression “regex1” and “regex2”, and the value of “{#MACRO2}” matches either “regex3” or “regex4”. The formula IDs “A”, “B”, “C” and “D” have been chosen arbitrarily.

    Request:

    Response:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": {
    4. "itemids": [
    5. "27665"
    6. ]
    7. },
    8. "id": 1

    Source 来源

    CDiscoveryRule::create() in frontends/php/include/classes/api/services/CDiscoveryRule.php.