您可以使用範例指令碼監控實體伺服器中的作業系統。

範例指令碼僅在 Windows Server 2012、2012 R2、2016、2019 和 2022 上進行了測試。

必要條件

如果使用範例指令碼且已升級,並且您要檢視作業系統物件的內容,必須重新執行以下步驟以監控作業系統。您必須再次下載協助程式指令碼,重新執行該指令碼,然後重新啟動自訂 Telegraf。

  • 確認 PowerShell 為 4.0 或更新版本。若要檢查 PowerShell 版本,請在 PowerShell 中執行以下命令:

    $PSVERSIONTable

  • 確認 OpenSSL 為 1.1.1 或更新版本。從 https://slproweb.com/products/Win32OpenSSL.html 下載。若要檢查 OpenSSL 版本,請在 PowerShell 中執行以下命令:

    openssl.exe version

  • 確保雲端 Proxy 已在 vRealize Operations 中啟動並處於線上狀態。
  • 確保可從實體伺服器連線到雲端 Proxy。
  • 確保可從實體伺服器連線到 vRealize Operations 的連接埠 443。

程序

  1. 從以下位置下載範例指令碼:https://<cloudproxy_ip>/downloads/salt/unmanagedagent_setup_sample.ps1
    您可以在 PowerShell 終端機中執行以下命令之一:
    Invoke-WebRequest https://<cloudproxy_ip>/downloads/salt/unmanagedagent_setup_sample.ps1 -OutFile unmanagedagent_setup_sample.ps1
    
    wget --no-check-certificate https://<cloudproxy_ip>/downloads/salt/unmanagedagent_setup_sample.ps1
    

    如果指令碼下載失敗並顯示以下訊息:請求已中止: 無法建立 SSL/TLS 安全通道,請按照Windows 平台指令碼下載失敗中所述的步驟進行操作。

    備註: 在上述指定的位置中,針對 <cloud-proxy> 使用相關的雲端 Proxy IP 位址。
  2. 執行範例指令碼以從雲端 Proxy下載 Telegraf 二進位檔案,建立與 vRealize Operations 進行安全連線所需的憑證,並在 Telegraf 組態檔中進行必要的更新。
    unmanagedagent_setup_sample.ps1 -v <vrops_ip_or_fqdn> -a <vrops_user> -b <vrops_password> -c <cloudproxy_ip> -d <Telegraf_Download_Directory> 
    範例:
    unmanagedagent_setup_sample.ps1 -v 10.192.0.189 -a admin -b Password!23 -c 10.192.0.158 -d C:/TelegrafDownloadDirectory 
    如果環境位於企業 Proxy 後方,則指令碼會明確地將 Proxy 視為外部連線。
    備註: 確保用於 Proxy 驗證的使用者名稱和密碼中的特殊字元已正確編碼或逸出。
    unmanagedagent_setup_sample.ps1 -v <vrops_ip_or_fqdn> -a <vrops_user> -b <vrops_password> -c <cloudproxy_ip> -d <Telegraf_Download_Directory> -x <[protocol://]proxyhost[:proxyport]> -u <proxyUser> -p <proxyPassword>
    引數說明:

    vrops_ip_or_fqdn:vRealize Operations 的 IP 或 FQDN。必要參數。

    vrops_user:進行 suite-api 呼叫的 vRealize Operations 的使用者名稱。必要參數。

    vrops_password:進行 suite-api 呼叫的 vRealize Operations 的密碼。必要參數。

    cloudproxy_ip:雲端 Proxy 的 IP。必要參數。

    Telegraf_Download_Directory:代理程式的安裝位置。選擇性參數。預設值:目前目錄。

    Proxy:Proxy 伺服器 URL。選擇性參數。

    備註: 如果協助程式指令碼第一次執行因引數錯誤而失敗,請清除 Telegraf 資料夾,然後使用正確的引數重新執行該指令碼。
  3. 執行 Telegraf。
    telegraf.exe --config telegraf.conf --config-directory telegraf.d
    或者您可以讓 Telegraf 成為 Windows 服務。
    <Telegraf_executable_path> --config <Telegraf_config_file_path> --config-directory <Telegraf_config_directory_path> --service install
    net start telegraf
    
    例如:
    C:\VMware\UnManagedTelegraf\telegraf\telegraf.exe --config C:\VMware\UnManagedTelegraf\telegraf\telegraf.conf --config-directory C:\VMware\UnManagedTelegraf\telegraf\telegraf.d --service install
    net start telegraf
    

下一步

您可以從 vRealize Operations 使用者介面選取 相關物件 > 度量索引標籤,以檢視度量。
  1. 從左側面板中,導覽至環境 > 自訂群組
  2. 按一下右窗格中的作業系統環境物件。
  3. 導覽至度量索引標籤,然後選取對應的作業系統物件。