[comment]: # translation:outdated

[comment]: # ({c7072ca6-c7072ca6})
# triggerprototype.get

[comment]: # ({/c7072ca6-c7072ca6})

[comment]: # ({1e3ce6d6-12701833})
### 説明

`integer/array triggerprototype.get(object parameters)`

このメソッドは、指定したパラメーターに応じたトリガーのプロトタイプを取得できます。

::: noteclassic
このメソッドは、すべてのタイプのユーザーが利用できます。メソッドを呼び出す権限は、ユーザーの役割の設定で取り消すことができます。詳細は[ユーザーの役割](/manual/web_interface/frontend_sections/users/user_roles)を参照してください。
:::

[comment]: # ({/1e3ce6d6-12701833})

[comment]: # ({5b56f94e-14171778})
### パラメータ

`(object)` 目的の出力を定義するパラメーター

このメソッドは、次のパラメーターをサポートしています。

|パラメータ|[タイプ](/manual/api/reference_commentary#data_types)|説明|
|--|--|------|
|active|flag|監視対象ホストに属する有効なトリガー プロトタイプのみを返します。|
|discoveryids|string/array|指定された LLD ルールに属するトリガー プロトタイプのみを返します。|
|functions|string/array|指定された関数を使用するトリガーのみを返します。<br><br>サポートされている関数のリストについては、[サポートされているトリガー関数](/manual/appendix/triggers/functions) ページを参照してください。|
|group|string|指定された名前のホスト グループのホストに属するトリガー プロトタイプのみを返します。|
|groupids|string/array|指定されたホスト グループのホストに属するトリガー プロトタイプのみを返します。|
|host|string|指定された名前のホストに属するトリガー プロトタイプのみを返します。|
|hostids|string/array|指定されたホストに属するトリガー プロトタイプのみを返します。|
|inherited|boolean|"true"に設定すると、テンプレートから継承されたトリガー プロトタイプのみが返されます。|
|maintenance|boolean|"true"に設定すると、メンテナンス中のホストに属する有効なトリガー プロトタイプのみが返されます。|
|min\_severity|integer|指定された深刻度以上の深刻度を持つトリガー プロトタイプのみを返します。|
|monitored|flag|監視対象ホストに属し、有効なアイテムのみを含む有効なトリガー プロトタイプのみを返します。|
|templated|boolean|"true"に設定すると、テンプレートに属するトリガー プロトタイプのみが返されます。|
|templateids|string/array|指定されたテンプレートに属するトリガー プロトタイプのみを返します。|
|triggerids|string/array|指定された ID を持つトリガー プロトタイプのみを返します。|
|expandExpression|flag|トリガー式で関数とマクロを展開します。|
|selectDependencies|query|トリガー プロトタイプと、トリガー プロトタイプが依存するトリガーを `dependencies` プロパティで返します。|
|selectDiscoveryRule|query|トリガー プロトタイプが属する [LLD ルール](/manual/api/reference/discoveryrule/object) を返します。|
|selectFunctions|query|`functions` プロパティのトリガー プロトタイプで使用される関数を返します。<br><br>関数オブジェクトは、トリガー式で使用される関数を表し、次のプロパティがあります:<br>`functionid` - *(string)* ID 関数の;<br>`itemid` - *(string)* 関数で使用されるアイテムの ID;<br>`function` - *(string)* 関数の名前;<br>`parameter` - * (文字列)* 関数に渡されるパラメーター。 クエリ パラメータは、返された文字列で `$` 記号に置き換えられます。|
|selectGroups|query|[groups](/manual/api/reference/hostgroup/object) プロパティで、トリガー プロトタイプが属するホスト グループを返します。|
|selectHosts|query|[hosts](/manual/api/reference/host/object) プロパティでトリガー プロトタイプが属するホストを返します。|
|selectItems|query|[items](/manual/api/reference/item/object) プロパティでトリガー プロトタイプを使用したアイテムとアイテム プロトタイプを返します。|
|selectTags|query|[tags](/manual/api/reference/triggerprototype/object#Trigger_prototype_tag) プロパティでトリガー プロトタイプ タグを返します。|
|filter|object|指定されたフィルタに正確に一致する結果のみを返します。<br><br>配列を受け入れます。キーはプロパティ名で、値は単一の値または照合する値の配列です。<br><br >追加のフィルターをサポート:<br>`host` - トリガー プロトタイプが属するホストの技術名;<br>`hostid` - トリガー プロトタイプが属するホストの ID|
|limitSelects|integer|サブselects によって返されるレコードの数を制限します。<br><br>次のサブselects に適用されます:<br>`selectHosts` - 結果は `host` でソートされます。|
|sortfield|string/array|指定されたプロパティで結果を並べ替えます。<br><br>使用可能な値: `triggerid`,`description`,`status`,`priority`|
|countOutput|boolean|すべての`get`メソッドに共通するこれらのパラメーターについては[リファレンス解説](/manual/api/reference_commentary#common_get_method_parameters)ページで詳しく説明されています。|
|editable|boolean|^|
|excludeSearch|boolean|^|
|limit|integer|^|
|output|query|^|
|preservekeys|boolean|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|boolean|^|

[comment]: # ({/5b56f94e-14171778})

[comment]: # ({07ca11ca-7223bab1})
### 戻り値

`(integer/array)` 次のいずれかを返します:

-   オブジェクトの配列
-   `countOutput`パラメータが使用されている場合、取得されたオブジェクトの数

[comment]: # ({/07ca11ca-7223bab1})

[comment]: # ({b41637d2-b41637d2})
### 例

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({582baf6f-81de28c1})
#### LLDルールからトリガープロトタイプの取得

すべてのトリガープロトタイプとその関数をLLDルールから取得します。

[リクエスト](/manual/api#performing-requests) :

```json
{
    "jsonrpc": "2.0",
    "method": "triggerprototype.get",
    "params": {
        "output": "extend",
        "selectFunctions": "extend",
        "discoveryids": "22450"
    },
    "id": 1
}
```

レスポンス :

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "triggerid": "13272",
            "expression": "{12598}<20",
            "description": "Free inodes is less than 20% on volume {#FSNAME}",
            "url": "",
            "status": "0",
            "value": "0",
            "priority": "2",
            "lastchange": "0",
            "comments": "",
            "error": "",
            "templateid": "0",
            "type": "0",
            "state": "0",
            "flags": "2",
            "recovery_mode": "0",
            "recovery_expression": "",
            "correlation_mode": "0",
            "correlation_tag": "",
            "manual_close": "0",
            "opdata": "",
            "discover": "0",
            "event_name": "",
            "uuid": "6ce467d05e8745409a177799bed34bb3",
            "url_name": "",
            "functions": [
                {
                    "functionid": "12598",
                    "itemid": "22454",
                    "triggerid": "13272",
                    "parameter": "$",
                    "function": "last"
                }
            ]
        },
        {
            "triggerid": "13266",
            "expression": "{13500}<20",
            "description": "Free disk space is less than 20% on volume {#FSNAME}",
            "url": "",
            "status": "0",
            "value": "0",
            "priority": "2",
            "lastchange": "0",
            "comments": "",
            "error": "",
            "templateid": "0",
            "type": "0",
            "state": "0",
            "flags": "2",
            "recovery_mode": "0",
            "recovery_expression": "",
            "correlation_mode": "0",
            "correlation_tag": "",
            "manual_close": "0",
            "opdata": "",
            "discover": "0",
            "event_name": "",
            "uuid": "74a1fc62bfe24b7eabe4e244c70dc384",
            "url_name": "",
            "functions": [
                {
                    "functionid": "13500",
                    "itemid": "22686",
                    "triggerid": "13266",
                    "parameter": "$",
                    "function": "last"
                }
            ]
        }
    ],
    "id": 1
}
```

[comment]: # ({/582baf6f-81de28c1})

[comment]: # ({af95a04d-2cb80f2d})
#### タグで特定のトリガープロトタイプを取得

[リクエスト](/manual/api#performing-requests) :

```json
{
    "jsonrpc": "2.0",
    "method": "triggerprototype.get",
    "params": {
        "output": [
            "triggerid",
            "description"
        ],
        "selectTags": "extend",
        "triggerids": [
            "17373"
        ]
    },
    "id": 1
}
```

レスポンス :

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "triggerid": "17373",
            "description": "Free disk space is less than 20% on volume {#FSNAME}",
            "tags": [
                {
                    "tag": "volume",
                    "value": "{#FSNAME}"
                },
                {
                    "tag": "type",
                    "value": "{#FSTYPE}"
                }
            ]
        }
    ],
    "id": 1
}
```

[comment]: # ({/af95a04d-2cb80f2d})

[comment]: # ({11e314dd-222d46a0})
### 参照

-   [Discovery rule](/manual/api/reference/discoveryrule/object#discovery_rule)
-   [Item](/manual/api/reference/item/object#item)
-   [Host](/manual/api/reference/host/object#host)
-   [Host group](/manual/api/reference/hostgroup/object#host_group)
-   [Template group](/manual/api/reference/templategroup/object#template_group)

[comment]: # ({/11e314dd-222d46a0})

[comment]: # ({526ca55d-1136c1c7})
### ソース

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

[comment]: # ({/526ca55d-1136c1c7})
