> For the complete documentation index, see [llms.txt](https://docs.nexthink.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nexthink.com/platform/ja/user-guide/investigations/investigations-nql-examples.md).

# 調査のNQLサンプル

このクエリ例のリストは、Nexthinkのウェブインターフェースで効果的な調査を行うために設計されています。以下に示す調査を確認し、ご自身が行おうとしている調査に最も似ているものを選んでください。クエリをコピーし、ご自身のユースケースに合わせて調整してください。

## デバイス テーブルを照会する <a href="#investigationsnqlexamples-querydevicetables" id="investigationsnqlexamples-querydevicetables"></a>

<details>

<summary>過去7日間における、すべてのデバイスでのOutlookの総受信トラフィックを取得します。</summary>

```
devices
| include execution.events during past 7d
| where binary.name == "outlook.exe"
| compute total_incoming_traffic = incoming_traffic.sum()
| list device.name, device.entity, total_incoming_traffic
```

</details>

<details>

<summary>過去1時間に頻繁なシステムクラッシュがあったかを確認します。例えば、過去24時間で2%以上のデバイスがクラッシュした場合</summary>

```
devices during past 24h
| include device_performance.system_crashes
| compute system_crash_count= number_of_system_crashes.sum(), crashing_devices= device.count()
| summarize ratio_of_devices_crashing= crashing_devices.sum() * 100 / count() , total_system_crashes= system_crash_count.sum()
```

</details>

<details>

<summary>メモリアップグレードが必要な全てのデバイスをリストします。</summary>

```
devices during past 7d
| include device_performance.events during past 7d
| compute used_memory_ = event.used_memory.avg(), used_memory_percentage= event.used_memory.avg()*100/device.hardware.memory.avg()
| where used_memory_percentage> 75
| list device.name, device.entity, device.hardware.model, device.hardware.type, device.operating_system.name, device.hardware.memory, used_memory_, used_memory_percentage
```

</details>

<details>

<summary>メモリアップグレードが必要なデバイスの数を計算し、ハードウェアメーカーごとにデバイスを分類します。</summary>

```
devices during past 7d
| include device_performance.events during past 7d
| compute used_memory_ = event.used_memory.avg(), used_memory_percentage= event.used_memory.avg()*100/device.hardware.memory.avg()
| where used_memory_percentage> 75
| summarize c1 = count() by hardware.manufacturer
```

</details>

<details>

<summary>ディスク空き容量の少ないデバイスのリスト。</summary>

```
devices
| with device_performance.events during past 124h
| compute free_space_on_system_drive = system_drive_free_space.avg()
| where free_space_on_system_drive < 2000MB
```

</details>

<details>

<summary>デバイスを取得します。</summary>

Nexthink Collectorパッケージがインストールされているすべてのデバイスをリストします。

```
devices
| with package.installed_packages
| where package.name == "Nexthink Collector"
```

</details>

<details>

<summary>デバイスを取得する。</summary>

Nexthink Collectorパッケージがインストールされていないすべてのデバイスを一覧表示します。

```
devices
| include package.installed_packages
| where package.name == "Nexthink Collector"
| compute number_of_package_installed = count()
| where number_of_package_installed == 0
```

</details>

### 他のテーブルを照会する <a href="#investigationsnqlexamples-queryothertables" id="investigationsnqlexamples-queryothertables"></a>

<details>

<summary>インストール イベントを取得します。</summary>

すべてのデバイスにわたる特定のパッケージのアンインストールを一覧表示します。

```
package.uninstallations
| where package.name == "Nexthink Collector"
| list time, device.name, package.name, package.version
```

</details>

<details>

<summary>パッケージを取得します。</summary>

最も多くのデバイスにインストールされているものから始めてすべてのパッケージを一覧表示します。

```
package.installed_packages
| summarize number_of_packages_installed = count() by package.name
| sort number_of_packages_installed desc
```

</details>

<details>

<summary>パッケージを取得します。</summary>

最も少ないデバイスにインストールされているものから始めてすべてのパッケージを一覧表示します。

```
package.installed_packages
| summarize number_of_packages_installed = count() by package.name
| sort number_of_packages_installed asc
```

</details>

<details>

<summary>パッケージを取得します。</summary>

少なくとも1台のデバイスにインストールされているが、5台未満のデバイスにインストールされているパッケージを一覧表示します。

```
package.installed_packages
| summarize number_of_packages_installed = count() by package.name
| where number_of_packages_installed > 0 and number_of_packages_installed < 5
```

</details>

<details>

<summary>クラッシュごとにエラー ラベルでグループ化されたシステム クラッシュの数を一覧表示します。</summary>

```
device_performance.system_crashes during past 7d
| summarize number_of_crashes = number_of_system_crashes.sum() by label
| sort number_of_crashes desc
```

</details>

<details>

<summary>過去7日間のアクティブ デバイスの数をカウントします。</summary>

```
device_performance.events during past 7d
| summarize nb_devices = device.count() by 1d
| sort start_time asc
```

</details>

<details>

<summary>ディスク空き容量の少ないデバイス数の履歴 (14 日間) を取得します。</summary>

```
device_performance.events during past 14d
| where system_drive_free_space.avg <= 1000MB
| summarize devices_with_low_disk_space = device.count() by 1d
```

</details>

<details>

<summary>バイナリごとのクラッシュ統計を取得します。</summary>

```
execution.crashes during past 7d
| summarize crashes = count(), devices_with_crashes = device.count(), versions_with_crashes = binary.version.count() by binary.name, binary.product_name, binary.platform
| sort devices_with_crashes desc
```

</details>

<details>

<summary>選択されたバイナリのタイムライン上のクラッシュ統計を取得します。</summary>

```
execution.crashes during past 7d
| where binary.name = "zscaler"
| summarize foreground_crashes = countif(process_visibility == foreground), background_crashes = countif(process_visibility == background), devices_with_crashes = device.count(), versions_with_crashes = binary.version.count() by 1d
```

</details>

<details>

<summary>部門ごとのユーザー 1 日あたりのアプリケーションの平均使用時間を計算します。</summary>

```
web.events during past 7d
| where application.name == "Salesforce Lightning"
| summarize average_department_usage_time_per_user = duration.sum()/ user.name.count() by ad.department
| sort average_department_usage_time_per_user desc
```

</details>

<details>

<summary>キャンペーンの進捗を把握するために、キャンペーンおよび州ごとにキャンペーンの応答数をカウントします。</summary>

```
campaign.responses
| where campaign.name != null
| summarize number_of_responses = count() by campaign.name, state, state_details
| sort campaign.name asc
```

</details>

<details>

<summary>過去7日間のバイナリを取得します。</summary>

カテゴリとサブカテゴリごとに要約します。

```
binaries during past 7d
| where product_category != null
| summarize nr_binaries = count() by product_category, product_subcategory
| sort product_category asc
```

</details>

<details>

<summary>過去7日間のバイナリを取得します。</summary>

アクセシビリティのカテゴリとビジョンアクセシビリティのサブカテゴリに従って要約します。

```
binary.binaries during past 7d
| where binary.product_category != null
| where (binary.product_category == "Accessibility" and binary.product_subcategory == "Vision Accessibility")
| list binary.name, binary.product_name, binary.version, binary.product_category, binary.product_subcategory
```

</details>

<details>

<summary>過去7日間のユーザーを取得します。</summary>

開発ツールのカテゴリおよびコードエディタとIDEのサブカテゴリの下のバイナリについて、使用時間が30 分以上であるユーザーを一覧表示します。

```
users during past 7d
| include execution.events during past 7d
| where binary.product_category == "Development Tools" and binary.product_subcategory == "Code Editors and IDEs"
| compute usage_time = execution.event.focus_time.sum()
| where usage_time >= 30min
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.nexthink.com/platform/ja/user-guide/investigations/investigations-nql-examples.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
