# WebhookのNQL条件設定

Webhookの**NQL条件**フィールドにクエリを書く:

* Webhookが対応している[NQLテーブル](#configuringwebhooknqlconditions-nqltablessupportedbywebhooks)と[NQLプロパティ](#configuringwebhooknqlconditions-nqlpropertiessupportedbywebhooksnqlpropertieswebhooks)。
* Webhookが対応している[NQL演算子](#configuringwebhooknqlconditions-nqloperatorssupportedbywebhooks)。

## Webhookが対応しているNQLテーブル <a href="#configuringwebhooknqlconditions-nqltablessupportedbywebhooks" id="configuringwebhooknqlconditions-nqltablessupportedbywebhooks"></a>

以下はWebhookが対応しているNQLテーブルの形式`<namespace>.<table>`を示します。\`。

NQL条件フィールドにサポートされていないNQLオブジェクトが含まれるWebhook設定を保存すると、システムはエラーメッセージを表示します。正しい構文であっても。

{% hint style="info" %}
ページの最後にある[WebhookのためのNQL条件の例](#configuringwebhooknqlconditions-validnqlconditionsexamplesforalert-relatedwebhooksnqlconditionexampl)にジャンプします。
{% endhint %}

| Webhookが対応しているNQLオブジェクト              |
| ------------------------------------ |
| `alert.alerts`                       |
| `campaign.responses`                 |
| `execution.crashes`                  |
| `device_performance.boots`           |
| `device_performance.system_crashes`  |
| `device_performance.hard_resets`     |
| `remote_action.executions`           |
| `セッション`                              |
| `platform.audit_logs`"}]} }}}}n}]} } |
| `web.events`                         |
| `web.errors`                         |
| `web.page_views`                     |
| `web.transactions`                   |
| `workflow.executions`                |

### Webhookが対応しているNQLプロパティ <a href="#configuringwebhooknqlconditions-nqlpropertiessupportedbywebhooksnqlpropertieswebhooks" id="configuringwebhooknqlconditions-nqlpropertiessupportedbywebhooksnqlpropertieswebhooks"></a>

[Webhook設定](/platform/ja/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/outbound-connectors/webhooks/managing-webhooks.md#managingwebhooks-creatinganewwebhook)ページでNQL条件フィールドにクエリを書く際、システムは上記にリストされた[NQLオブジェクト](#configuringwebhooknqlconditions-nqltablessupportedbywebhooks)から対応するNQLプロパティを表示します。 以下の画像を参照してください。

{% hint style="info" %}
サポートされていないNQLテーブルプロパティを使用すると、正しい構文であってもシステムエラーが発生します。

ページの最後にある[WebhookのためのNQL条件の例](#configuringwebhooknqlconditions-validnqlconditionsexamplesforalert-relatedwebhooksnqlconditionexampl)にジャンプします。
{% endhint %}

## Webhookが対応しているNQL演算子 <a href="#configuringwebhooknqlconditions-nqloperatorssupportedbywebhooks" id="configuringwebhooknqlconditions-nqloperatorssupportedbywebhooks"></a>

すべてのNQL演算子がお客様に提供されているわけではありません。 特定のイベントに取り組む場合、次のNQL演算子のサブセットを使用してください。

| NQL演算子  | タイプ     | Webhookで利用可能 | 必須           |
| ------- | ------- | ------------ | ------------ |
| `where` | 選択      | あり           | いいえ          |
| `list`  | 投影      | あり           | はい、少なくとも1回は。 |
| `そして`   | フィルタリング | あり           | いいえ          |
| `または`   | フィルタリング | あり           | いいえ          |
| `含む`    | フィルタリング | あり           | いいえ          |
| `内に`    | フィルタリング | あり           | いいえ          |

{% hint style="warning" %}
使用するすべてのNQLフィールドをWebhookの**リソース**または**ペイロード**の[プレースホルダ](/platform/ja/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/outbound-connectors/webhooks/managing-webhooks/configuring-webhook-fields_-method-resource-and-payload.md#configuringwebhookfields-method-resource-andpayload-usingdatamodelvariablesasplaceholdersinthepayloa)として追加しなければなりません。

プレースホルダをまったく使用しない場合でも、`list`句には1つのNQLフィールドを必ず追加しなければなりません。
{% endhint %}

## アラート関連のWebhookのための有効なNQL条件の例 <a href="#configuringwebhooknqlconditions-validnqlconditionsexamplesforalert-relatedwebhooksnqlconditionexampl" id="configuringwebhooknqlconditions-validnqlconditionsexamplesforalert-relatedwebhooksnqlconditionexampl"></a>

以下の有効なNQLクエリの例のいくつかは、関連する`アラート`を事前に定義していることを前提としています。 詳細については、[アラートの概要](/platform/ja/user-guide/alerts-and-diagnostics/getting-started-with-alerts.md)を参照してください。

有効なNQL例.1 - 特定のWebアプリケーションの条件が満たされたときにアラートをトリガするモニター「(…)」のWebhookをトリガします。

```
alert.alerts
| where monitor.tags contains "web-applications"
| where alert.context contains "*Salesforce*" or alert.context contains "*Microsoft*"
| list alert.monitor.name, alert.status, monitor.tags, alert.context, trigger_time, recovery_time, alert.monitor.thresholds, monitor.priority, alert.trigger_values, alert.trigger_reference_value, alert.recovery_values, alert.context, device_view_link , issue_view_link
```

有効なNQL例.2 - モニター「最近24時間でMS Teamsがクラッシュ」と名付けられたモニターがアラートをトリガした場合のWebhookをトリガします。

```
alert.alerts
| where monitor.nql_id == "#ms_teams_crashes_in_the_last_24_hours"
| list alert.context
```

有効なNQL例.3 - `高`優先度のモニターがアラートをトリガするときにWebhookをトリガします。

```
alert.alerts
| where monitor.priority == high
| list alert.context
```

有効なNQL例.4 - モニター「最近24時間でMS Teamsがクラッシュ」または「コンピューターのための低品質のビデオ」がアラートをトリガする場合にWebhookをトリガします。

```
alert.alerts
| where monitor.name == "MS Teams crashes in the last 24 hours" or monitor.name == "Poor video quality for computers"
| list alert.context
```

有効なNQL例.5 - `高`優先度またはモニター「SD用MS Teamsがクラッシュ」と名付けられたモニター、及びタグに「servicenow」が含まれている場合にアラートをトリガするWebhookをトリガします。

```
alert.alerts
| where monitor.priority == high or monitor.name == "MS Teams crashes for SD" and monitor.tags contains "servicenow"
| list alert.context
```

## その他のWebhookのための有効なNQL条件例 <a href="#configuringwebhooknqlconditions-othervalidnqlconditionsexamplesforwebhooks" id="configuringwebhooknqlconditions-othervalidnqlconditionsexamplesforwebhooks"></a>

有効なNQL例.6 - デバイスブートの`fast_startup`に等しく、持続時間が200秒を超える場合をフィルタリングします。

```
device_performance.boots
| where type == fast_startup and duration > 200s
| list device_performance.boot.type, device_performance.boot.duration
```

有効なNQL例.7 - タイムアウト状況を示すエラーコード`335`または`49`によるデバイスクラッシュをフィルタリングします。

```
device_performance.system_crashes
| where error_code == 335 or error_code == 49 and label in ["TIMEOUT"]
| list device_performance.system_crash.error_code
```

有効なNQL例.8 - 開始時に5回以上クラッシュしたバイナリ**zoom.exe**のすべての実行クラッシュをフィルタリングします。

```
execution.crashes
| where binary_path in ["zoom.exe"] and number_of_crashes >= 5 and crash_on_start == true
| list execution.crash.number_of_crashes
```

有効なNQL例.9 - `nql_id`によるリモートアクションをフィルタリングし、`[expired , failure , cancelled ]`のステータスなしで完了したものをフィルタリングします。

```
remote_action.executions
| where remote_action.nql_id == "#update_binary" and status in [expired , failure , cancelled ]
| list remote_action.execution.outputs
```

有効なNQL例.10 - 特定のキャンペーンの回答、状態、および詳細をリストアップします。

```
campaign.responses 
| where campaign.name == "campaign name" 
| list answers , state , state_details
```

## Webhookのための無効なNQL条件と一般的なミス <a href="#configuringwebhooknqlconditions-invalidnqlconditionsforwebhooksandcommonmistakes" id="configuringwebhooknqlconditions-invalidnqlconditionsforwebhooksandcommonmistakes"></a>

以下の無効なNQLクエリの例のいくつかは、関連する`アラート`を事前に定義していることを前提としています。 詳細については、[アラートの概要](/platform/ja/user-guide/alerts-and-diagnostics/getting-started-with-alerts.md)を参照してください。

無効なNQL例.1 - サポートされていないNQLテーブル、`リスト`演算子が欠落しており、`イン`演算子の誤用。

```
device_performance.system_crashes
| where error_code == 335 or error_code == 49 and label in [*TIMEOUT*]
```

無効なNQL例.2 - 利用できないプロパティおよび`イン`演算子の誤用。

```
alert.alerts
| where trigger_time == "2021-10-23" and monitor.tags in ["*Logitech*"]
| list alert.context
```

無効なNQL例.3 - 利用できない演算子。

```
devices
| with alert.alerts during past 7d 
| summarize c1 = count() by sid
```

無効なNQL例.4 - サポートされていないNQLテーブル。

```
devices
| where device.operating_system.platform == Windows
| list device.name
```

無効なNQL例.5 - サポートされていないNQL演算子。

```
devices
| with execution.crashes
| summarize count=count() by operating_system.name
```

無効なNQL例.6 - 列挙型を比較する際の間違った値。

```
device_performance.BoOTS | where type == FULLboot
device_PErformance.BoOTS | where type == FULLboot
device_PErformance.BoOTS | where TyPe == FULLboot
device_performance . boots | where type == FullbooT
```

***

関連トピック

* [アラートの概要](/platform/ja/user-guide/alerts-and-diagnostics/getting-started-with-alerts.md)
* [Webhookの管理](/platform/ja/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/outbound-connectors/webhooks/managing-webhooks.md)
* [NQLデータモデル](/platform/ja/understanding-key-data-platform-concepts/nql-data-model.md)
* [NQL構文の概要](/platform/ja/understanding-key-data-platform-concepts/nexthink-query-language-nql/nql-syntax-overview.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nexthink.com/platform/ja/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/outbound-connectors/webhooks/managing-webhooks/configuring-webhook-nql-conditions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
