# 複数のデバイスに影響を与える問題の検出

{% hint style="info" %}
既存のアラートに関連するデバイスをNQLを使用して調査およびクエリする方法の詳細については、[アラートFAQ](https://docs.nexthink.com/platform/ja/user-guide/alerts-faq#how-can-i-investigate-and-query-devices-associated-with-an-existing-alert)を参照してください。
{% endhint %}

アプリケーションおよびネットワークL2+チームが特定の領域でのグローバルな問題に事前に対応できるように、複数のデバイスに影響を与える問題を検出します。 関連するアプリケーションの所有者に対して、そのアプリケーションに影響を与える問題を通知します。 以下のユースケースを使用して評価します。

* 影響を受けるデバイスやユーザーの数（例：特定のアプリケーションクラッシュを含むデバイスの数）
* デバイス全体での頻繁な問題（例：すべてのデバイスにおける特定のアプリケーションクラッシュの回数）

両方のアプローチは重要で、多くの場合、お互いを補完します。 監視トリガー条件を設定する際は、受信者に関連性のない問題でアラートや通知を避けるために、どちらのアプローチも使用できます。 たとえば、すべてのデバイスの特定のアプリケーションクラッシュ数が20を超え、なおかつ5台以上のデバイスに影響を及ぼす場合、システムはアラートをトリガーします。 その後、システムはアプリケーション所有者に通知します。

以下のセクションでは、2つのユースケースを詳しく説明します。

## 問題を持つデバイスまたはユーザーの数を監視する <a href="#detectingissuesimpactingmultipledevices-monitoringthenumberofdevicesoruserswithissues" id="detectingissuesimpactingmultipledevices-monitoringthenumberofdevicesoruserswithissues"></a>

複数のデバイスに影響を与える問題を積極的に監視するために、問題のあるデバイスまたはユーザーの数を検出します。

デバイス数を要約して返すNQLクエリを作成します。 アプリケーションがフォアグラウンドで実行中に発生したクラッシュのみをカウントします。 結果をグループ化するために、`by` キーワードをオプションで使用します。 システムは、グループごとにアラートをトリガーします。

```
デバイス
| execution.crashes の過去24時間内
| binary.name="outlook.exe" 
| process_visibility == foreground のときにクラッシュを計算
| entity ごとにデバイス数を要約
```

### **通知**

システムは、すべてのデバイスに対して一度に通知を送信するか、クエリに`by`句が含まれている場合は、それぞれのグループごとに通知を送信します。 通知には値としてのデバイス数のみが含まれます。 影響を受けたすべてのデバイスの詳細は、NexthinkのWebインターフェースで確認できます。

### **アラート概要ダッシュボード**

[アラート概要](https://docs.nexthink.com/platform/ja/user-guide/alerts-and-diagnostics/responding-to-alerts/alerts-overview) ダッシュボードでは、アラートは1行に表示されます。また、グループ化がされている場合は、各グループごとにグループ化のコンテキストと共に別の行に表示されます。

## デバイス全体での頻繁な問題の監視 <a href="#detectingissuesimpactingmultipledevices-monitoringfrequentissuesacrossdevices" id="detectingissuesimpactingmultipledevices-monitoringfrequentissuesacrossdevices"></a>

複数のデバイスにわたる問題を検出し、集約された指標値に反映されています。

要約されたメトリック値を返すNQLクエリを作成します。 必須であれば、`by`キーワードを使用して結果をグループ化します。 システムは、グループごとにアラートをトリガーします。

```
execution.crashes during past 24h
| summarize 
  total_number_of_crashes = count(), 
  devices_with_crashes = device.count()
by binary.name
```

### **通知**

システムは単一のメトリックに対する通知を送信するか、クエリに`by`句が含まれている場合はそれぞれのグループごとに通知を送信します。 通知には、条件で定義された各メトリックの閾値を超えた値に関する情報が含まれます。

### **アラート概要ダッシュボード**

[アラート概要](https://docs.nexthink.com/platform/ja/user-guide/alerts-and-diagnostics/responding-to-alerts/alerts-overview) ダッシュボードでは、アラートはコンテキストに関連するラベルが含まれず、1行に表示されます。 グルーピングが追加された場合、グループに関するコンテキストと共に、それぞれのグループに対して別々の行でアラートが表示されます。

NQL に関するさらに詳しい情報は、以下の NQL の例と [NQLデータモデル](https://docs.nexthink.com/platform/ja/understanding-key-data-platform-concepts/nql-data-model) ドキュメントをご参照ください。

## NQLの例 <a href="#detectingissuesimpactingmultipledevices-nqlexamples" id="detectingissuesimpactingmultipledevices-nqlexamples"></a>

モニターを作成および編集するためのNQLクエリの例を以下にリストアップしています。 クエリを見直し、作成または編集したモニターに最も類似したものを選択してください。 クエリをコピーして使用事例に合わせて調整し、例として提供されている閾値を含めてください。

### 特定のアプリケーションに対する特定のウェブエラーを検出します。

このNQLクエリは、特定のアプリケーションに対する集約されたエラー数およびエラーを持つデバイスの数を返し、特定のエラーコードごとに個別にアラートをトリガーします。

{% code overflow="wrap" lineNumbers="true" %}

```
web.errors during past 1h
| where application.name  in ["Jenkins"] 
| where error.code !in [405, 404, 403]
| summarize nr_of_devices_impacted = device.count(), nr_of_errors = count() by label
```

{% endcode %}

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-70881d56f1292c442303d7727361d3a5e4c5e488%2Ftrigger_condition_1.png?alt=media" alt=""><figcaption></figcaption></figure>

### ウェブエラー率が高いアプリケーションを検出します。

十分な使用量があり、偽陽性を回避するために十分な数の問題があることを確認するために、他の閾値を選択してください。

{% code overflow="wrap" lineNumbers="true" fullWidth="false" %}

```
application.applications
| with web.page_views during past 60min
| where is_soft_navigation = false
| compute total_number_of_page_views = number_of_page_views.sum(), all_users = user.count()
| with web.errors during past 60min
| compute number_page_views_with_error = error.number_of_errors.sum(), users_with_errors = user.count()
| summarize web_errors_ratio = number_page_views_with_error.sum() * 100 / total_number_of_page_views.sum(), number_of_errors = number_page_views_with_error.sum(), users_with_issues = users_with_errors.sum(), ratio_of_users_with_issues = users_with_errors.sum() * 100 / all_users.sum() by application.name
```

{% endcode %}

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-1e2cb613755ee6607c533968329e7aa113c65ec9%2Ftrigger_condition_2.png?alt=media" alt=""><figcaption></figcaption></figure>

### バイナリに対するクラッシュ数が多いことを検出します。

{% code overflow="wrap" lineNumbers="true" %}

```
execution.crashes during past 24h
| summarize total_number_of_crashes = count(), devices_with_crashes = device.count() by binary.name
| sort total_number_of_crashes desc
```

{% endcode %}

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-c85daeb8c115806160aadb3b7b62839054234fe2%2Ftrigger_condition_3.png?alt=media" alt=""><figcaption></figcaption></figure>

### 国別の地理位置でブート時間が長いデバイスが多いことを検出します。

長いブート時間は、`time_until_desktop_is_visible>= 60s`として定義されています。

{% code overflow="wrap" lineNumbers="true" %}

```
devices
| with session.logins during past 24h
| compute total_devices = device.count(), avg_time_until_desktop_ready = time_until_desktop_is_ready.avg(), avg_time_until_desktop_visible = time_until_desktop_is_visible.avg()
| include session.logins during past 24h
| where time_until_desktop_is_visible>= 60s
| compute number_of_device_with_long_login = device.count()
| summarize percentage_of_devices_with_issue = number_of_device_with_long_login.sum() * 100 / total_devices.sum(), average_time_until_desktop_ready = avg_time_until_desktop_ready.avg(), average_time_until_desktop_visible = avg_time_until_desktop_visible.avg(), number_of_devices_with_issue = number_of_device_with_long_login.sum() by public_ip.country
```

{% endcode %}

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-81693bf199199c82d68484340a098725cce3c1a1%2Ftrigger_condition_4.png?alt=media" alt=""><figcaption></figcaption></figure>

### 平均CPUキューの長さがデスクトッププールごとに>= 3の場合のバーチャリゼーションアラート

{% code overflow="wrap" lineNumbers="true" %}

```
device_performance.events during past 30min
| where device.virtualization.desktop_pool != null
| summarize Average_cpu_queue_length = cpu_queue_length.avg() / number_of_logical_processors.avg() by device.virtualization.desktop_pool
```

{% endcode %}

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-a1127af1a24eba4602a42c79894fe8edc3f98629%2Ftrigger_condition_5.png?alt=media" alt=""><figcaption></figcaption></figure>
