[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]: # ({73370a7a-14171778})
### パラメータ

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

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

|Parameter|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|active|flag|監視中のホストに属する、有効なトリガープロトタイプのみを返します。|
|discoveryids|ID/array|指定したLLDルールに属するトリガープロトタイプのみを返します。|
|functions|string/array|指定した関数を使用するトリガーのみを返します。<br><br>サポートされている関数の一覧は、[Supported functions](/manual/appendix/functions)ページを参照してください。|
|group|string|指定した名前のホストグループまたはテンプレートグループに属するホストまたはテンプレートに属するトリガープロトタイプのみを返します。|
|groupids|ID/array|指定したホストグループまたはテンプレートグループに属するホストまたはテンプレートに属するトリガープロトタイプのみを返します。|
|host|string|指定した名前のホストに属するトリガープロトタイプのみを返します。|
|hostids|ID/array|指定したホストに属するトリガープロトタイプのみを返します。|
|inherited|boolean|`true` に設定した場合、テンプレートから継承されたトリガープロトタイプのみを返します。|
|maintenance|boolean|`true` に設定した場合、メンテナンス中のホストに属する、有効なトリガープロトタイプのみを返します。|
|min\_severity|integer|指定した深刻度以上のトリガープロトタイプのみを返します。|
|monitored|flag|監視中のホストに属し、かつ有効なアイテムのみを含む、有効なトリガープロトタイプのみを返します。|
|templated|boolean|`true` に設定した場合、テンプレートに属するトリガープロトタイプのみを返します。|
|templateids|ID/array|指定したテンプレートに属するトリガープロトタイプのみを返します。|
|triggerids|ID/array|指定したIDを持つトリガープロトタイプのみを返します。|
|expandExpression|flag|トリガー式内の関数およびマクロを展開します。|
|selectDependencies|query|トリガープロトタイプが依存しているトリガープロトタイプおよびトリガーを、`dependencies` プロパティで返します。|
|selectDiscoveryData|query|トリガープロトタイプのディスカバリオブジェクトデータを含む `discoveryData` プロパティを返します。トリガープロトタイプのディスカバリオブジェクトは、検出されたトリガープロトタイプを、その元となったトリガープロトタイプに関連付けます。<br><br>このオブジェクトは以下のプロパティを持ちます。<br>`parent_triggerid` - `(ID)` トリガープロトタイプの作成元となったトリガープロトタイプのID。<br>`status` - `(int)` トリガープロトタイプのディスカバリステータス:<br>0 - *(default)* トリガープロトタイプは検出されています。<br>1 - トリガープロトタイプはすでに検出されていません。<br>`ts_delete` - `(timestamp)` すでに検出されていないトリガープロトタイプが削除される時刻。<br>`ts_disable` - `(timestamp)` すでに検出されていないトリガープロトタイプが無効化される時刻。<br>`disable_source` - `(int)` トリガープロトタイプがLLDルールによって無効化されたか、手動で無効化されたかを示す指標:<br>0 - *(default)* 自動的に無効化。<br>1 - LLDルールによって無効化。|
|selectDiscoveryRule|query|トリガープロトタイプが属する[LLD rule](/manual/api/reference/discoveryrule/object)を `discoveryRule` プロパティで返します。|
|selectDiscoveryRulePrototype|query|トリガープロトタイプが属する親LLDルールプロトタイプを含む [`discoveryRulePrototype`](/manual/api/reference/discoveryruleprototype/object) プロパティを返します。|
|selectFunctions|query|トリガープロトタイプで使用されている関数を `functions` プロパティで返します。<br><br>関数オブジェクトはトリガー式で使用される関数を表し、以下のプロパティを持ちます。<br>`functionid` - `(ID)` 関数のID。<br>`itemid` - `(ID)` 関数で使用されるアイテムのID。<br>`function` - `(string)` 関数名。<br>`parameter` - `(string)` 関数に渡されるパラメータ。クエリパラメータは、返される文字列では `$` 記号に置き換えられます。|
|selectHostGroups|query|トリガープロトタイプが属するホストグループを [`hostgroups`](/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) プロパティで返します。|
|selectTemplateGroups|query|トリガープロトタイプが属するテンプレートグループを [`templategroups`](/manual/api/reference/templategroup/object) プロパティで返します。|
|filter|object|指定したフィルターに完全一致する結果のみを返します。<br><br>プロパティ名をキーとし、照合する値または値の配列を値とするオブジェクトを受け付けます。<br><br>`text` [data type](/manual/api/reference_commentary#data-types) のプロパティはサポートしていません。<br><br>追加のプロパティをサポートしています。<br>`host` - トリガープロトタイプが属するホストの技術名。<br>`hostid` - トリガープロトタイプが属するホストのID。|
|limitSelects|integer|サブセレクトで返されるレコード数を制限します。<br><br>以下のサブセレクトに適用されます。<br>`selectHosts` - 結果は `host` でソートされます。|
|sortfield|string/array|指定したプロパティで結果をソートします。<br><br>指定可能な値: `triggerid`, `description`, `status`, `priority`, `discovered`.|
|countOutput|boolean|これらのパラメータは[reference commentary](/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]: # ({/73370a7a-14171778})

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

`(integer/array)` 以下のいずれかを返します。

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

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

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

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

[comment]: # ({8756baad-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]: # ({/8756baad-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]: # ({cf0cf439-222d46a0})
### 関連項目

-   [ディスカバリルール](/manual/api/reference/discoveryrule/object#discovery-rule)
-   [アイテム](/manual/api/reference/item/object#item)
-   [ホスト](/manual/api/reference/host/object#host)
-   [ホストグループ](/manual/api/reference/hostgroup/object#host-group)
-   [テンプレートグループ](/manual/api/reference/templategroup/object#template-group)

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

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

*ui/include/classes/api/services/CTriggerPrototype.php* 内の CTriggerPrototype::get()。

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