

如需與 Amazon Timestream for LiveAnalytics 類似的功能，請考慮使用 Amazon Timestream for InfluxDB。它提供簡化的資料擷取和單一位數毫秒查詢回應時間，以進行即時分析。[在這裡](https://docs.aws.amazon.com//timestream/latest/developerguide/timestream-for-influxdb.html)進一步了解。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 Timestream for LiveAnalytics 輸出外掛程式執行 Telegraf
<a name="Telegraf.running-output-plugin.title"></a>

您可以依照下列指示，使用 Timestream for LiveAnalytics 外掛程式執行 Telegraf。

1. 使用 Telegraf 產生範例組態。

   ```
   telegraf --section-filter agent:inputs:outputs --input-filter cpu:mem --output-filter timestream config > example.config
   ```

1. [使用管理主控台](console_timestream.md#console_timestream.db.using-console)、[CLI](https://docs.aws.amazon.com/cli/latest/reference/timestream-write/create-database.html) 或 [SDKs](getting-started-sdks.md) 在 Timestream 中建立資料庫。

1. 在 `example.config` 檔案中，透過編輯 `[[outputs.timestream]] `區段下的下列索引鍵來新增資料庫名稱。

   ```
   database_name = "yourDatabaseNameHere"
   ```

1. 根據預設，Telegraf 會建立資料表。如果您想要手動建立資料表，`create_table_if_not_exists`請將 設定為 `false`，並依照指示[使用管理主控台](console_timestream.md#console_timestream.table.using-console)、[CLI](https://docs.aws.amazon.com/cli/latest/reference/timestream-write/create-table.html) 或 [SDKs](getting-started-sdks.md) 建立資料表。

1. 在 *example.config* 檔案中，於 `[[outputs.timestream]] `區段下設定登入資料。登入資料應允許下列操作。

   ```
   timestream:DescribeEndpoints
   timestream:WriteRecords
   ```
**注意**  
如果您將 `create_table_if_not_exists` 設定為 `true`，請包含：  

   ```
   timestream:CreateTable
   ```
**注意**  
如果您將 `describe_database_on_start`設定為 `true`，請包含下列項目。  

   ```
   timestream:DescribeDatabase
   ```

1. 您可以根據您的偏好設定編輯其餘組態。

1. 完成組態檔案的編輯後，請使用下列命令執行 Telegraf。

   ```
   ./telegraf --config example.config
   ```

1. 指標應該會在幾秒鐘內顯示，視您的代理程式組態而定。您也應該會在 Timestream 主控台中看到新的資料表、*cpu* 和 *mem*。