> 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/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/inbound-connectors/connector-for-vmware-vsphere-hypervisor.md).

# VMware vSphere Hypervisor コネクター

{% hint style="warning" %}
このドキュメントは外部ソースを参照しています。 Nexthink はサードパーティのドキュメントの正確性や、このページに記載されている情報に矛盾を生じさせる可能性のある外部の更新または変更を制御することはできません。エラーや矛盾を[Nexthink サポート](https://support.nexthink.com/)に報告してください。
{% endhint %}

VMware vSphere 用 Nexthink Connector は、vCenter Server が管理する ESXi ホストからパフォーマンスデータを取得します。取得するデータには、CPU、メモリ、ディスクのメトリクス、および各ホストのクラスター、電源ポリシー、ハイパースレッディングの状態が含まれます。電源がオンになっている各仮想マシン（VM）の設定も取得します。設定には、リソースプール、CPU 制限、CPU シェア、IOPS 制限、VMware Tools のバージョンが含まれます。

このインストールガイドでは、コネクタを安全にインストールする方法を説明します。セキュリティチームは、このドキュメントに記載されているインストール手順を確認し、組織のセキュリティポリシーに合わせて調整してください。

## Nexthink にインポートされるデータ

### ハイパーバイザーホストイベント

コネクタは、`device_performance.hypervisor_host_events` テーブルの次のフィールドを設定します。

| Nexthinkフィールド                      | タイプ             | 説明                                                                                                                                                                                                                                                                                                                                   |
| ---------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `cluster`                          | 文字列             | 共有リソース、ポリシー適用、その他の機能を提供するために、ハイパーバイザーホストを単一のユニットとして管理する論理的なグループ化です。                                                                                                                                                                                                                                                                  |
| `cpu.normalized_usage`             | パーセント           | 選択した期間における物理 CPU の平均使用率で、0〜100% の尺度で表されます。 CPU がビジー状態であった時間の割合を示します。                                                                                                                                                                                                                                                                 |
| `cpu.number_of_logical_processors` | integer         | ハイパーバイザーホストの CPU コア数に、各コアで実行可能なスレッド数を掛けた値です。                                                                                                                                                                                                                                                                                         |
| `cpu.number_of_vcpus`              | integer         | 観測期間中にホスト上でプロビジョニングされた仮想プロセッサの数です。                                                                                                                                                                                                                                                                                                   |
| `cpu.ready`                        | パーセント           | 観測期間中に、仮想マシンの実行準備はできていたものの、物理 CPU で実行するようスケジュールできなかった時間の割合。                                                                                                                                                                                                                                                                          |
| `cpu.time`                         | 長さ              | 観測期間中に物理 CPU が積極的に使用されていた合計時間です。                                                                                                                                                                                                                                                                                                     |
| `disk.latency`                     | 長さ              | 収集間隔中の平均ディスクレイテンシであり、ゲスト OS から発行された SCSI コマンドを処理するのに要した時間を示します。                                                                                                                                                                                                                                                                      |
| `disk.read_throughput`             | throughput\_Bps | 観測期間中の平均ディスク読み取りスループットで、1秒あたりのバイト数で測定されます。                                                                                                                                                                                                                                                                                           |
| `disk.write_throughput`            | throughput\_Bps | 観測期間中の平均ディスク書き込みスループット（1 秒あたりのバイト数で測定）。                                                                                                                                                                                                                                                                                              |
| `ホスト名`                             | 文字列             | 仮想マシンを実行している仮想化ホストの名前。                                                                                                                                                                                                                                                                                                               |
| `hyperthreading`                   | 列挙型             | <p>ホストで CPU の同時マルチスレッディングが有効になっているかどうかを示します。可能な値:</p><ul><li><code>enabled</code></li><li><code>disabled</code></li></ul>                                                                                                                                                                                                            |
| `memory.ballooning`                | バイト             | バルーンドライバーによってゲスト仮想マシンから回収されたメモリの総量。                                                                                                                                                                                                                                                                                                  |
| `memory.committed`                 | バイト             | ハイパーバイザー上で稼働中のすべての仮想マシンに対して設定されているメモリの合計量。継続的にコミット済みメモリとインストール済みメモリの比率が 1.0 を超えている場合、メモリのオーバーコミットを示している可能性があり、負荷時にメモリ競合が増加することがあります。                                                                                                                                                                                                 |
| `memory.installed`                 | バイト             | ハイパーバイザーホストにインストールされている物理メモリの総容量。ハイパーバイザー上のメモリ使用率およびオーバーコミットを評価するための容量ベースラインとして使用されます。                                                                                                                                                                                                                                               |
| `memory.state`                     | 列挙型             | <p>現在のホストのメモリプレッシャー状態と、ハイパーバイザーによって適用されているメモリ再生のレベルを示します。レベルが高いほど競合が増加し、パフォーマンスに影響するリスクが高まります。可能な値:</p><ul><li><code>low</code>: 再生なし</li><li><code>soft</code>: バルーニングおよび軽度の圧縮。影響は最小限と予想されます</li><li><code>hard</code>: 圧縮がアクティブ。スワップが開始される可能性があり、パフォーマンスへの影響が見込まれます</li><li><code>high</code>: アクティブなスワップ。パフォーマンスへの大きな影響</li></ul> |
| `memory.swap_in_throughput`        | throughput\_Bps | 観測期間中に、ゲスト物理メモリがディスクからスワップインされる平均速度。                                                                                                                                                                                                                                                                                                 |
| `memory.swap_out_throughput`       | throughput\_Bps | 観測期間中に、ゲストの物理メモリがディスクへスワップアウトされる平均速度。                                                                                                                                                                                                                                                                                                |
| `memory.swap_size`                 | バイト             | 仮想マシンが実際に使用しているスワップ領域の量で、物理メモリではなくディスクに保存されたメモリページを示します。                                                                                                                                                                                                                                                                             |
| `memory.usage`                     | パーセント           | 観測期間中に消費されたホスト物理メモリの割合です。                                                                                                                                                                                                                                                                                                            |
| `number_of_vms`                    | integer         | アクティブなユーザーセッションがない VM を含め、ハイパーバイザー上で実行中のアクティブな VM の数。                                                                                                                                                                                                                                                                                |
| `power_policy`                     | 列挙型             | <p>ホストに設定された電源管理モードで、パフォーマンスとエネルギー効率のバランスを定義します。可能な値:</p><ul><li><code>high\_performance</code></li><li><code>balanced</code></li><li><code>low\_power</code></li><li><code>custom</code></li></ul>                                                                                                                                  |

### デバイス

コネクタは、Nexthink 内のデバイスと名前が一致する、電源がオンになっている各仮想マシンについて、`devices` テーブルの `virtualization` グループにある以下のフィールドを設定します。

| Nexthinkフィールド                      | タイプ | 説明                                                                                                                                                                                                                                                                        |
| ---------------------------------- | --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `virtualization.cpu_limit`         | 列挙型 | <p>仮想マシンの CPU 消費量が設定済みの制限値で上限設定されているか、または利用可能なホスト CPU リソースを制限なく使用できるかを示します。可能な値:</p><ul><li><code>limited</code></li><li><code>unlimited</code></li><li><code>unknown</code>: 互換性のある Hypervisor Connector が構成されていないか、利用できません</li></ul>                                    |
| `virtualization.cpu_shares`        | 列挙型 | <p>ホスト CPU リソースが競合している場合に、CPU スケジューリングのために仮想マシンに割り当てられる相対的な優先度。可能な値:</p><ul><li><code>low</code></li><li><code>normal</code></li><li><code>high</code></li><li><code>custom</code></li><li><code>unknown</code>: 互換性のある Hypervisor Connector が構成されていないか、利用できません</li></ul> |
| `virtualization.guest_driver`      | 文字列 | ゲストオペレーティングシステムにインストールされる、仮想化固有のドライバパッケージです。                                                                                                                                                                                                                              |
| `virtualization.iops_limit_source` | 列挙型 | <p>IOPS 制約が仮想マシンに適用されているかどうかを示します。可能な値:</p><ul><li><code>limited</code></li><li><code>unlimited</code></li><li><code>unknown</code>: 互換性のある Hypervisor Connector が構成されていないか、利用できません</li></ul>                                                                             |
| `virtualization.resource_pool`     | 文字列 | 仮想マシンの CPU とメモリを割り当て、優先順位付けするために使用される、ハイパーバイザー内のコンピューティングリソースの論理グループ。                                                                                                                                                                                                     |

## Nexthink コネクター サーバー <a href="#connectorforcitrixvirtualappsanddesktops-nexthinkconnectorserver" id="connectorforcitrixvirtualappsanddesktops-nexthinkconnectorserver"></a>

コネクタは、読み取り対象の vSphere インフラストラクチャを中断しないよう、vCenter Server や ESXi ホストではなく、別の Windows サーバーにインストールしてください。

### 前提条件 <a href="#connectorforcitrixvirtualappsanddesktops-prerequisites" id="connectorforcitrixvirtualappsanddesktops-prerequisites"></a>

* [VM 向け Collector の構成と展開](https://docs.nexthink.com/platform/ja/configuring_nexthink/bringing-data-into-your-nexthink-instance/deploying-nexthink-in-non-vdi-environment/installing-collector/installing-collector-on-windows/configuring-and-deploying-collector-for-vms.md)で説明されている、各 VMware vSphere 環境の仮想マシンにインストールされた Nexthink Collector。
* Windows PowerShell 5.1 がインストールされていること。
* 実行ポリシーが **Bypass** に設定されていること。
* コネクタを実行するローカルユーザーアカウントにインストールされている、次の PowerShell モジュール:
  * [Logging 4.8.5](https://www.powershellgallery.com/packages/Logging/4.8.5)
  * [CredentialManager 2.0](https://www.powershellgallery.com/packages/CredentialManager/2.0)
  * [VCF.PowerCLI 9.1.1.25718932](https://www.powershellgallery.com/packages/VCF.PowerCLI/9.1.1.25718932)
* コネクタをインストールするサーバーから到達可能で、各環境の ESXi ホストを管理する vCenter Server。
* [Nexthink Connector for VMware vSphere をダウンロード済み](https://download.nexthink.com/integrations/vSphere+onPrem+Connector/0.0.21/vSphereConnector-0.0.21.zip)。

### ハードウェア要件

| コンポーネント      | 最小人数                     | 推奨人数                     |
| ------------ | ------------------------ | ------------------------ |
| CPU          | 2 コア x64                 | 4 コア x64                 |
| RAM          | 2 GB                     | 4～8 GB                   |
| ディスクの空き容量    | 2 GB                     | 5 GB                     |
| オペレーティングシステム | Windows 10 / Server 2016 | Windows 11 / Server 2022 |

### ネットワーキング <a href="#connectorforcitrixvirtualappsanddesktops-networking" id="connectorforcitrixvirtualappsanddesktops-networking"></a>

VMware vSphere 用 Nexthink Connector は、各 vSphere 環境の vCenter Server および Nexthink インスタンスに接続します。

* コネクタは TCP ポート 443 経由で Nexthink インスタンスと通信します。
* コネクタは、設定ファイルで環境に設定したアドレスで、VMware PowerCLI を介して vCenter Server に接続します。

#### PowerShell `Install-Module` 用にファイアウォールまたはプロキシで許可する URL

<table><thead><tr><th width="319">目的</th><th>URL</th></tr></thead><tbody><tr><td>PowerShell ギャラリー</td><td><code>https://www.powershellgallery.com</code></td></tr><tr><td>NuGet プロバイダー</td><td><code>https://www.nuget.org</code></td></tr><tr><td>NuGet API</td><td><code>https://api.nuget.org</code></td></tr><tr><td>パッケージ用 CDN</td><td><code>https://www.powershellgallery.com/api/v2/を参照してください</code></td></tr><tr><td>代替 NuGet V2 API</td><td><code>https://www.nuget.org/api/v2/を参照してください</code></td></tr><tr><td>証明書失効</td><td><code>http://crl.microsoft.com</code><br>（通常は任意ですが、必要となる場合があります）</td></tr></tbody></table>

#### その他の考慮事項

* サポートされる vSphere コネクタは単一です。複数のサーバーにコネクタをセットアップしないでください。イベントが重複する可能性があります。
* Omnissa Horizon オンプレミス コネクターなど、他の Nexthink コネクターを使用している場合、必要な API にアクセスできる環境であれば、それらを同じ VM 上で実行できます。
* プロキシで SSL インスペクションが有効になっている場合、TLS ハンドシェイクを妨害しないようにしてください。
* プロキシを使用している場合は、次のコマンドを実行して、`PowerShell` がそのプロキシを使用するように構成されていることを確認してください。

{% code overflow="wrap" %}

```powershell
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
```

{% endcode %}

#### 接続をテスト

PowerShell ターミナルを使用して、次のコマンドを実行し、アクセスをテストします:

```powershell
Invoke-WebRequest https://www.powershellgallery.com
```

### スケジュールされたタスク用のローカルユーザーアカウント

VMware vSphere 用 Nexthink Connector は、vSphere 環境ごとにスケジュールされたタスクとして実行され、vSphere API にアクセスする必要があります。セキュリティ上の懸念を最小限に抑えるため、コネクタをインストールするサーバーではローカルユーザーアカウント、またはドメインレベルで特別な権限を持たない通常のドメインユーザーアカウントを使用することを Nexthink は推奨します。

次のガイドでは、Nexthink コネクターサーバー上のローカルアカウントを使用します。

{% stepper %}
{% step %}
vSphere コネクタを実行するサーバーに管理者としてログオンします。
{% endstep %}

{% step %}
Start メニューから次のコマンドを実行して、ローカル ユーザーとグループのコンソールを起動します:

```powershell
lusrmgr.msc
```

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-e33a79105f0d5b3d5de897a63c6ac9bb729684d0%2Fcitr-1678980898.png?alt=media" alt="Run the lusrmgr.msc command"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**ローカル ユーザーとグループ (ローカル)** ディレクトリ内の **Users** フォルダーを右クリックし、**新しいユーザー…** を選択します。
{% endstep %}

{% step %}
組織の命名規則に従ってユーザーアカウントを作成します。例: `nxt-vsphere`。このガイドでは、以降のコマンドで `nxt-vsphere` を使用します。これをアカウント名に置き換えてください。認証情報の保存、コネクタのテスト、スケジュールされたタスクの作成に必要となるため、**User name** と **Password** を控えておいてください。コネクタを実行し続けるには、次のオプションを選択します:

* **ユーザーはパスワードを変更できません**
* **パスワードは有効期限がありません**

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-3aab1bf211a526e963b1c605e8f2ccb0b6d2e669%2F1E1W4Hsb5MgOQkYn.png?alt=media" alt="New user options" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
\*\*「作成」\*\*を選択します。
{% endstep %}

{% step %}
スタート メニューから次のコマンドを実行して、ローカル グループ ポリシー エディターを開きます。

```powershell
gpedit.msc
```

{% endstep %}

{% step %}
*Computer Configuration > Windows Settings > Security Settings > Local Policies > User Rights Assignment* に移動し、**Log on as a batch job** ポリシーを開きます。
{% endstep %}

{% step %}
ポリシーを開き、**Add User or Group** を選択して、先ほど作成したユーザーを一覧に追加します。

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-59659e2b8d682540279a509256cb893943733b59%2FUGKyDsGsFjGy527X.png?alt=media" alt="Add user or group" width="416"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

### コネクタのインストール <a href="#connectorforcitrixvirtualappsanddesktops-installingtheconnector" id="connectorforcitrixvirtualappsanddesktops-installingtheconnector"></a>

{% stepper %}
{% step %}
[Nexthink Connector for VMware vSphere](https://download.nexthink.com/integrations/vSphere+onPrem+Connector/0.0.21/vSphereConnector-0.0.21.zip) をダウンロードします。
{% endstep %}

{% step %}
zip ファイルを展開し、その `vSphereConnector-<version>` フォルダーの内容をシステム上のフォルダーにコピーします。 Nexthink では、次のフォルダーを推奨しています:

`C:\Program Files\Nexthink\Connectors\VSphere`
{% endstep %}

{% step %}
先ほど作成したローカルユーザーアカウントに、コネクタフォルダー（例: `C:\Program Files\Nexthink\Connectors\VSphere`）の **Modify** 権限を付与します。適用先は **This folder, subfolders and files** にします。これによりコネクタは、その内部に **Logs**、**Spool**、**State**、**Storage** フォルダーを作成し、書き込めるようになります。

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-a1422fb03804ca3777c6e830e6fcbb2a363bbaf3%2FCy7AitaCPGynmNPv.png?alt=media" alt="Folder properties, Security tab, with Modify permission granted to the local user account" width="364"><figcaption></figcaption></figure>

{% hint style="info" %}
コネクタは、コネクタフォルダー内の **Spool**、**State**、**Storage** フォルダーも使用します。各フォルダーには環境ごとのサブフォルダーが含まれます。これらは初回実行時に作成されます。
{% endhint %}
{% endstep %}
{% endstepper %}

### Nexthink API の認証情報

vSphere コネクタが Nexthink Hypervisor API に接続するには、適切な認証情報が必要です。 Nexthink は、先ほど作成したローカルユーザーアカウントの資格情報を、資格情報ストア内に安全に保存します。 [API認証情報](https://docs.nexthink.com/platform/ja/user-guide/administration/account-management/api-credentials.md) のドキュメントを参照してください。

資格情報を設定するには：

{% stepper %}
{% step %}
**API credentials** ページに移動し、新しい OAuth クライアント資格情報を作成するか、既存の資格情報を編集します。
{% endstep %}

{% step %}
**Hypervisor API** 権限を有効にします。

{% hint style="warning" %}
新しい資格情報を作成し、**Save and generate credentials** を選択すると、**Client ID** と **Secret key** を含む新しいウィンドウが表示されます。両方を控えておいてください。ウィンドウを閉じると再度表示されません。
{% endhint %}

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-3676141ead644fa390ecfefb8bc2c0b280b124bc%2Fvdi-tvMRbaSntGvVcEyS.png?alt=media" alt="Hypervisor API permission in the API credentials settings"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
vSphere コネクターを実行するサーバーで、先ほど作成したローカルユーザーの資格情報を使用し、CLI で次のコマンドを実行して PowerShell を開きます：

{% code overflow="wrap" %}

```powershell
runas /user:nxt-vsphere powershell.exe
```

{% endcode %}

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

{% step %}
新しく開いた PowerShell ウィンドウで、次のコマンドを実行して、先ほど作成した API 資格情報を追加します：

{% code overflow="wrap" %}

```powershell
New-StoredCredential -Target "nxt-vsphere-credentials" -UserName "<nexthink-hypervisor-api-client-id>" -Password "<nexthink-hypervisor-api-secret>" -Persist LocalMachine
```

{% endcode %}

API 資格情報を作成した際に控えた値で、`<nexthink-hypervisor-api-client-id>` と `<nexthink-hypervisor-api-secret>` を置き換えてください。

設定ファイルで必要になるため、使用した `TargetName` を控えておいてください。

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-56d124f949c6f8c806f9bd56823de098322ac700%2F3OQP0vkLtXw8d1wI.png?alt=media" alt="PowerShell window"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

### 構成ファイルの更新 <a href="#connectorforcitrixvirtualappsanddesktops-updatingtheconfigurationfile" id="connectorforcitrixvirtualappsanddesktops-updatingtheconfigurationfile"></a>

構成ファイルを更新するには、Nexthink Cloud API インスタンスの URL が必要です。 URL パターンは次のとおりです。

`<instance>.api.<region>.nexthink.cloud`

{% hint style="warning" %}
URL に先頭の `https://` を含めないでください。
{% endhint %}

詳細については、以下の手順をご覧ください。

{% hint style="info" %}
ご自身の地域が不明な場合は、この情報を入手するために Nexthink の担当者にお問い合わせください。
{% endhint %}

{% stepper %}
{% step %}
vSphere コネクターを展開したフォルダーを見つけます。
{% endstep %}

{% step %}
`Config` フォルダーに移動し、テキストエディターを使用して `config.json` ファイルを開きます。
{% endstep %}

{% step %}
ファイルの構造は次のとおりです。この手順では、`"NexthinkAPI"` セクションを編集します。 vSphere 認証情報を保存した後、[VMware vSphere 環境への接続の設定](#setting-up-a-connection-to-a-vmware-vsphere-environment)で `"vSphereEnvironments"` セクションを編集します。

```json
{
    "_Info": "This is the JSON based configuration for vSphere Hypervisor connector",
    "Info": {
        "Project": "vsphere-hypervisor-on-prem-connector",
        "ConfigVersion": "1.0.0"
    },
    "Logging": {
        "LogRetentionDays": 7,
        "LogLevel": "INFO"
    },
    "vSphereEnvironments": [
        {
            "Name": "<vsphere-environment-name>",
            "vCenterFQDN": "<vcenter_host>",
            "WindowsCredentialEntry": "<vsphere-user-credentials>"
        },
        {
            "Name": "<vsphere-environment-name2>",
            "vCenterFQDN": "<vcenter_host2>",
            "WindowsCredentialEntry": "<vsphere-user-credentials2>"
        }
    ],
    "NexthinkAPI": {
        "HostFQDN": "<nexthink_api_host>",
        "LoginFQDN": "<nexthink_login_host>",
        "WindowsCredentialEntry": "<nxt-vsphere-credentials>",
        "RequestBatchSize": "1000"
    }
}
```

{% endstep %}

{% step %}
`"NexthinkAPI"` セクションの以下の値を変更します:

* `"HostFQDN"` の値を、`<instance>.api.<region>` 形式を使用して、お使いの Nexthink クラウド API インスタンスの URL に置き換えます。.nexthink.cloud `で、と`\` はプレースホルダーです。
  * `<instance>` をインスタンス名に置き換えます
  * 次のいずれかのリージョン名で `<region>` を置き換えます。
    * `us` はアメリカ合衆国を指します
    * 欧州連合を表す `eu`
    * `pac` はアジア太平洋地域を表します
    * 中東、トルコ、アフリカ向けの `meta`
  * 必要に応じて、次の URL の例を参照してください:\
    `gwy-eu-west-3-fuji-rest.api.eu.nexthink.cloud`

{% hint style="warning" %}
URL に先頭の `https://` を含めないでください。
{% endhint %}

* `"LoginFQDN"` の値を、`<instance>-login.<region>` 形式を使用して、お使いの Nexthink クラウド API インスタンスの URL に置き換えます。.nexthink.cloud `で、と`\` はプレースホルダーです。
  * `<instance>` をインスタンス名に置き換えます
  * 次のいずれかのリージョン名で `<region>` を置き換えます。
    * `us` はアメリカ合衆国を指します
    * 欧州連合を表す `eu`
    * `pac` はアジア太平洋地域を表します
    * 中東、トルコ、アフリカ向けの `meta`
* 先ほど PowerShell ウィンドウで確認した資格情報の `TargetName` を使用して、`"WindowsCredentialEntry"` を置き換えてください。例：\
  `"WindowsCredentialEntry": "nxt-vsphere-credentials",`

{% hint style="warning" %}
設定ファイルで vSphere 環境を設定する方法については、[VMware vSphere 環境への接続の設定](#setting-up-a-connection-to-a-vmware-vsphere-environment)を参照してください。
{% endhint %}
{% endstep %}
{% endstepper %}

## VMware vSphere 環境への接続の設定

前のセクションでは、VMware vSphere 用 Nexthink Connector の基本設定について説明しました。このセクションでは、VMware vSphere 環境への接続を設定する方法を説明します。接続する vSphere 環境ごとに、このセクションの手順を繰り返します。

### vCenter Server の準備

コネクタは、各 vSphere 環境の vCenter Server から、ESXi ホスト、クラスター、リソースプール、電源がオンになっている仮想マシン、およびホストのパフォーマンスカウンターを読み取ります。データを読み取るだけのため、**Read-only** ロールのみを持つ vCenter ユーザーアカウントが必要です。

{% stepper %}
{% step %}
環境を管理する vCenter Server の完全修飾ドメイン名（FQDN）を控えます。例: `vcenter.example.local`。設定ファイルで必要になります。
{% endstep %}

{% step %}
vSphere Client で、vCenter Server オブジェクト上の vCenter ユーザーアカウントに **Read-only** ロールを割り当てます。アカウントがすべてのホストと仮想マシンを読み取れるように、**Propagate to children** を選択します。
{% endstep %}
{% endstepper %}

### 保存済みの認証情報の設定 <0>\</0>

vSphere コネクタを実行するサーバー上で、コマンドラインで `runas` を実行し、先ほど作成したローカルユーザーの資格情報を使用して PowerShell を開きます:

```powershell
runas /user:nxt-vsphere powershell.exe
```

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

新しい PowerShell ウィンドウで、次のコマンドを実行して **Read-only** ロールを持つ vCenter ユーザーアカウントの認証情報を保存します:

{% code overflow="wrap" %}

```powershell
New-StoredCredential -Target "vsphere-user-credentials" -UserName "<domain\username>" -Password "<password>" -Persist LocalMachine
```

{% endcode %}

`<domain\username>` を `DOMAIN\username` 形式の vCenter ユーザーアカウントに、`<password>` をそのパスワードに置き換えます。

設定ファイルで必要になるため、使用した `TargetName` を控えておいてください。

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

### 構成ファイルの更新 <a href="#connectorforcitrixvirtualappsanddesktops-updatingtheconfigurationfile.1" id="connectorforcitrixvirtualappsanddesktops-updatingtheconfigurationfile.1"></a>

各 vSphere 環境には、設定ファイルの `"vSphereEnvironments"` セクション内にそれぞれエントリがあります。コネクタに付属する設定ファイルには、複数の環境を構成する方法の例が含まれています。必要に応じて、元の `config.json` ファイルのコピーを作成して、将来参照できるようにしてください。

{% stepper %}
{% step %}
vSphere コネクタを解凍したフォルダーを見つけます。
{% endstep %}

{% step %}
**`Config`** フォルダーに移動し、テキストエディターを使用して `config.json` ファイルを開きます。
{% endstep %}

{% step %}
`"vSphereEnvironments"` セクションまでスクロールします。接続する vSphere 環境ごとにエントリを保持します。単一の環境に接続する場合は、後方のエントリを削除します。各エントリは次のようになります:

```json
{
    "Name": "<vsphere-environment-name>",
    "vCenterFQDN": "<vcenter_host>",
    "WindowsCredentialEntry": "<vsphere-user-credentials>"
}
```

`"vSphereEnvironments"` セクションで次の値を変更します:

* `"Name"` のプレースホルダーを、この vSphere 環境の名前に置き換えます。例: `vSphere Prod`。この名前を引用符で囲み、`-vSphereEnvironment` を使用してコネクタに渡します。
* `"vCenterFQDN"` のプレースホルダーを、この環境を管理する vCenter Server の FQDN に置き換えます。`https://` は含めません。例: `vcenter.example.local`。
* `"WindowsCredentialEntry"` のプレースホルダーを、先ほど作成した保存済み認証情報のターゲット名に置き換えます。例: `vsphere-user-credentials`。
  {% endstep %}
  {% endstepper %}

### コネクターのテスト <0>\</0>

テストは実際の実行です。vSphere 環境を読み取り、そのデータを Nexthink に送信します。

{% stepper %}
{% step %}
VSphere コネクターを実行するサーバーで、先ほど作成したローカルユーザーの資格情報を使用し、`runas` コマンドを使って PowerShell を開きます。

```powershell
runas /user:nxt-vsphere powershell.exe
```

{% endstep %}

{% step %}
コネクタをインストールしたディレクトリに移動します。例:

```powershell
cd 'C:\Program Files\Nexthink\Connectors\VSphere\'
```

{% endstep %}

{% step %}
ローカルユーザーアカウント用のコネクタモジュールをインストールする Auto-Updater を実行します:

```powershell
.\vSphere-Connector-Auto-Updater.ps1
```

{% endstep %}

{% step %}
環境用の Runner を実行します:

```powershell
.\vSphere-Connector-Runner.ps1 -vSphereEnvironment "<environment name>"
```

`<environment name>` を `config.json` 内の環境の `Name` に置き換えます。

コネクタフォルダー内の実行ログファイル `Logs\<environment name>\vSphereConnector-<yyyyMMdd>.log` を開き、エラーがないか確認します。
{% endstep %}
{% endstepper %}

### スケジュールされたタスクの設定

vSphere 環境ごとに Runner 用のスケジュールされたタスクを作成し、Auto-Updater 用にもスケジュールされたタスクを作成します。

タスク スケジューラを開き、**タスクの作成…** を選択します。

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

**General** タブでタスクに名前を付けます。例: `Nexthink vSphere connector - vSphere Prod`。ユーザーを先ほど作成したローカルユーザーアカウントに変更します。例: `nxt-vsphere`。**ユーザーがログオンしているかどうかに関係なく実行する** を選択します。

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-c77661389eb2b58ada9ec8c2230ca961cdc33e2e%2F8Q0x4sTBG1oCqciC.png?alt=media" alt="Task properties, General tab" width="375"><figcaption></figcaption></figure>

**Triggers** タブで、**New…** をクリックします。 *Advanced settings > Repeat task every* で **5 minutes** を選択し、**for a duration of** を **Indefinitely** に設定します。 **OK** をクリックします。各実行では、前回の実行以降のホストメトリクスを読み取ります。 1 時間を超えて中断した後は、直近 55 分間のみを読み取ります。そのため、タスクをそれ以上停止したままにしないでください。

<figure><img src="https://3549141153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeLm8O7QKZDn6z806e7Sv%2Fuploads%2Fgit-blob-e56d8be2536d58b3ca33aeefe69cc60a6573ee90%2F0rwTa5Bi73lon3S0.png?alt=media" alt="New trigger with a repeat interval" width="375"><figcaption></figcaption></figure>

**Actions** タブで **New…** をクリックし、次の値を入力します。 **OK** をクリックします。

* **Program/script**: `powershell.exe`
* **Add arguments (optional)**: `-ExecutionPolicy Bypass -File "C:\Program Files\Nexthink\Connectors\VSphere\vSphere-Connector-Runner.ps1" -vSphereEnvironment "vSphere Prod"`。環境名には `config.json` の名前を使用します
* **Start in (optional)**: コネクタフォルダー。例: `C:\Program Files\Nexthink\Connectors\VSphere`

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

**OK** をクリックしてタスクを保存します。メッセージが表示されたら、ローカルユーザーアカウントのパスワードを入力して **OK** をクリックします。

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

他の vSphere 環境ごとに、タスク名と `-vSphereEnvironment` の値のみを変更して、これらの手順を繰り返します。

ローカルユーザーアカウント用のコネクタモジュールをインストールする Auto-Updater に対して、次の違いを除き、これらの手順を一度繰り返します:

* タスク名: 例: `Nexthink vSphere connector - Auto-Updater`
* トリガー: Runner と同じですが、15 分ごとに繰り返します。これにより、新しいコネクタバージョンが 15 分以内に使用されます。
* **Add arguments (optional)**: `-ExecutionPolicy Bypass -File "C:\Program Files\Nexthink\Connectors\VSphere\vSphere-Connector-Auto-Updater.ps1"`

***

## Nexthink でのデータの確認

Runner のスケジュールされたタスクの初回実行後、Nexthink で **Investigations** を開き、次のクエリを実行します。

最初のクエリは、`device_performance.hypervisor_host_events` テーブルのフィールドを一覧表示します:

```
device_performance.hypervisor_host_events during past 1h
| list hostname, cluster, number_of_vms, hyperthreading, power_policy, cpu.normalized_usage, cpu.ready, cpu.time, cpu.number_of_logical_processors, cpu.number_of_vcpus, disk.latency, disk.read_throughput, disk.write_throughput, memory.ballooning, memory.committed, memory.installed, memory.state, memory.swap_in_throughput, memory.swap_out_throughput, memory.swap_size, memory.usage
```

各行は ESXi ホストを表します。

2 番目のクエリでは、`devices` テーブルのフィールドを一覧表示します。対象のデバイスをフィルタリングします。たとえば、名前でフィルタリングできます。

```
devices
| where device.name == "<virtual machine name>"
| list device.name, device.virtualization.resource_pool, device.virtualization.cpu_limit, device.virtualization.cpu_shares, device.virtualization.iops_limit_source, device.virtualization.guest_driver
```

各行は、コネクタによって拡張された仮想マシンです。

***

関連トピック

* [API Credentials](https://developer.nexthink.com/docs/api/api-credentials)
* [VM 向け Collector の構成と展開](https://docs.nexthink.com/platform/ja/configuring_nexthink/bringing-data-into-your-nexthink-instance/deploying-nexthink-in-non-vdi-environment/installing-collector/installing-collector-on-windows/configuring-and-deploying-collector-for-vms.md)


---

# 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/configuring_nexthink/bringing-data-into-your-nexthink-instance/integrating-nexthink-with-third-party-tools/inbound-connectors/connector-for-vmware-vsphere-hypervisor.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.
