

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

# 元件組態區段
<a name="component-config-sections"></a>

元件組態包含數個主要區段。元件組態中的區段可以任何順序列出。
+ **alarmMetrics (選用)**

  要針對元件監控的[指標](#component-config-metric)清單 。所有元件類型都可以有 alarmMetrics 區段。
+ **日誌 (選用)**

  要針對元件監控的[日誌](#component-configuration-log)清單 。只有 EC2 執行個體可以有日誌區段。
+ **processes (選用)**

  要針對元件監控的[程式](#component-configuration-process)清單。只有 EC2 執行個體可以有程式區段。
+ **subComponents (選用)**

  元件的巢狀執行個體和磁碟區子元件組態。下列類型的元件可以有巢狀執行個體和子元件區段：ELB、ASG、自訂分組的 EC2 執行個體和 EC2 執行個體。
+ **alarms (optional) (警示 (選用))**

  監控元件的[警示](#component-configuration-alarms)清單。所有元件類型都可以有 alarm (警示) 區段。
+ **windowsEvents (選用)**

  要監控元件的 [Windows 事件](#windows-events)清單。只有 EC2 執行個體上的 Windows 才有 `windowsEvents` 區段。
+ **JMXPrometheusExporter (選用)**

  JMXPrometheus Exporter 組態。
+ **hanaPrometheusExporter (選用)**

  SAP HANA Prometheus Exporter 組態。
+ **haClusterPrometheusExporter (選用)**

  HA Cluster Prometheus Exporter 組態。
+ **netWeaverPrometheusExporter (選用)**

  SAP NetWeaver Prometheus 匯出程式組態。
+ **sapAsePrometheusExporter (選用)**

  SAP ASE Prometheus Exporter 組態。

以下範例以 JSON 格式顯示**子元件區段片段**的語法。

```
[
  {
    "subComponentType" : "AWS::EC2::Instance",
    "alarmMetrics" : [
      list of alarm metrics
    ],
    "logs" : [
      list of logs
    ],
    "processes": [
      list of processes
    ],
    "windowsEvents" : [
      list of windows events channels configurations
    ]
  },
  {
    "subComponentType" : "AWS::EC2::Volume",
    "alarmMetrics" : [
      list of alarm metrics
    ]
  }
]
```

## 元件組態區段屬性
<a name="component-config-properties"></a>

本節提供了個元件組態區段的屬性。

**Topics**
+ [指標](#component-config-metric)
+ [Log](#component-configuration-log)
+ [流程](#component-configuration-process)
+ [JMX Prometheus Exporter](#component-configuration-prometheus)
+ [HANA Prometheus Exporter](#component-configuration-hana-prometheus)
+ [HA Cluster Prometheus Exporter](#component-configuration-ha-cluster-prometheus)
+ [NetWeaver Prometheus 匯出程式](#component-configuration-netweaver-prometheus)
+ [SAP ASE Prometheus Exporter](#component-configuration-sap-ase-prometheus)
+ [Windows 事件](#windows-events)
+ [警示](#component-configuration-alarms)

### 指標
<a name="component-config-metric"></a>

定義要針對元件監控的指標。

**JSON** 

```
{
  "alarmMetricName" : "monitoredMetricName",
  "monitor" : true/false
}
```

**屬性**
+ **alarmMetricName (必要)**

  要針對元件監控的指標名稱。如需 Application Insights 支援的指標，請參閱 [Amazon CloudWatch Application Insights 支援的日誌和指標](appinsights-logs-and-metrics.md)。
+ **monitor (選用)**

  布林值，指出是否要監控該指標。預設值為 `true`。

### Log
<a name="component-configuration-log"></a>

定義要針對元件監控的日誌。

**JSON** 

```
{
  "logGroupName" : "logGroupName",
  "logPath" : "logPath",
  "logType" : "logType",
  "encoding" : "encodingType",
  "monitor" : true/false
}
```

**屬性**
+ **logGroupName (必要)**

  要與受監控日誌關聯的 CloudWatch 日誌群組名稱。如需日誌群組名稱限制條件，請參閱 [CreateLogGroup](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateLogGroup.html)。
+ **logPath (若為 EC2 執行個體元件則為必要；若為未使用 CloudWatch Agent 的元件 (例如 AWS Lambda) 則不需要)**

  要監控的日誌路徑。日誌路徑必須是 Windows 系統的檔案絕對路徑。如需詳細資訊，請參閱 [CloudWatch 代理程式組態檔案：日誌區段](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html#CloudWatch-Agent-Configuration-File-Logssection)。
+ **logType (必要)**

  日誌類型會決定 Application Insights 用來分析日誌的日誌模式。日誌類型可從下列選項中選取：
  + `SQL_SERVER`
  + `MYSQL`
  + `MYSQL_SLOW_QUERY`
  + `POSTGRESQL`
  + `ORACLE_ALERT`
  + `ORACLE_LISTENER`
  + `IIS`
  + `APPLICATION`
  + `WINDOWS_EVENTS`
  + `WINDOWS_EVENTS_ACTIVE_DIRECTORY`
  + `WINDOWS_EVENTS_DNS`
  + `WINDOWS_EVENTS_IIS`
  + `WINDOWS_EVENTS_SHAREPOINT`
  + `SQL_SERVER_ALWAYSON_AVAILABILITY_GROUP`
  + `SQL_SERVER_FAILOVER_CLUSTER_INSTANCE`
  + `DEFAULT`
  + `CUSTOM`
  + `STEP_FUNCTION`
  + `API_GATEWAY_ACCESS`
  + `API_GATEWAY_EXECUTION`
  + `SAP_HANA_LOGS`
  + `SAP_HANA_TRACE`
  + `SAP_HANA_HIGH_AVAILABILITY`
  + `SAP_NETWEAVER_DEV_TRACE_LOGS`
  + `PACEMAKER_HIGH_AVAILABILITY`
+ **encoding (選用)**

  要監控的日誌編碼類型。指定的編碼應包含在 [CloudWatch 代理程式支援的編碼](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AgentReference.html)清單中。若未提供，CloudWatch Application Insights 會使用 utf-8 類型的預設編碼，但下列狀況除外：
  +  `SQL_SERVER`：utf-16 編碼
  +  `IIS`：ascii 編碼
+ **monitor (選用)**

  布林值，指出是否監控日誌。預設值為 `true`。

### 流程
<a name="component-configuration-process"></a>

定義要針對元件監控的程式。

**JSON** 

```
{
  "processName" : "monitoredProcessName",
  "alarmMetrics" : [
      list of alarm metrics
  ] 
}
```

**屬性**
+ **processName (必填)**

  要針對元件監控的程式名稱。程式名稱不得包含程式主體，例如 `sqlservr` 或者 `sqlservr.exe`。
+ **alarmMetrics (必填)**

  針對此程式要監控的[指標](#component-config-metric)清單。若要檢視 CloudWatch Application Insights 支援的程式指標，請參閱 [Amazon Elastic Compute Cloud (EC2)](appinsights-metrics-ec2.md)。

### JMX Prometheus Exporter
<a name="component-configuration-prometheus"></a>

定義 JMX Prometheus Exporter 設定。

**JSON** 

```
"JMXPrometheusExporter": {
  "jmxURL" : "JMX URL",
  "hostPort" : "The host and port",
  "prometheusPort" : "Target port to emit Prometheus metrics"
}
```

**屬性**
+ **jmxURL (選用)**

  要連線的完整 JMX URL。
+ **hostPort (選用)**

  透過遠端 JMX 連線的主機和連接埠。只能指定其中一個 `hostPort` 和 `jmxURL`。
+ **prometheusPort (選用)**

  要傳送 Prometheus 指標的目標連接埠。如果未指定，則會使用預設連接埠 9404。

### HANA Prometheus Exporter
<a name="component-configuration-hana-prometheus"></a>

定義 HANA Prometheus Exporter 設定。

**JSON** 

```
"hanaPrometheusExporter": {
    "hanaSid": "SAP HANA  SID",
    "hanaPort": "HANA database port",
    "hanaSecretName": "HANA secret name",
    "prometheusPort": "Target port to emit Prometheus metrics"
}
```

**屬性**
+ **hanaSid**

  SAP HANA 系統的三個字元 SAP 系統 ID (SID)。
+ **hanaPort**

  匯出工具會用來查詢 HANA 指標的 HANA 資料庫連接埠。
+ **hanaSecretName**

  存放 HANA 監控使用者登入資料的 AWS Secrets Manager 秘密。HANA Prometheus 匯出工具會使用這些憑證來連線至資料庫並查詢 HANA 指標。
+ **prometheusPort (選用)**

  要 Prometheus 要傳送指標的目標連接埠。如果未指定，則會使用預設連接埠 9668。

### HA Cluster Prometheus Exporter
<a name="component-configuration-ha-cluster-prometheus"></a>

定義 HA Cluster Prometheus Exporter 設定。

**JSON** 

```
"haClusterPrometheusExporter": {
    "prometheusPort": "Target port to emit Prometheus metrics"
}
```

**屬性**
+ **prometheusPort (選用)**

  要 Prometheus 要傳送指標的目標連接埠。如果未指定，則會使用預設連接埠 9664。

### NetWeaver Prometheus 匯出程式
<a name="component-configuration-netweaver-prometheus"></a>

定義 NetWeaver Prometheus 匯出程式設定。

**JSON** 

```
"netWeaverPrometheusExporter": {
    "sapSid": "SAP NetWeaver  SID",
    "instanceNumbers": [ "Array of instance Numbers of SAP NetWeaver system "],
"prometheusPort": "Target port to emit Prometheus metrics"
}
```

**屬性**
+ **sapSid**

  SAP NetWeaver 系統的三個字元 SAP 系統 ID (SID)。
+ **instanceNumbers**

  SAP NetWeaver 系統的執行個體編號陣列。

  **範例：**`"instanceNumbers": [ "00", "01"]`
+ **prometheusPort (選用)**

  將 Prometheus 指標傳送到的目標連接埠。如果未指定，則會使用預設連接埠 `9680`。

### SAP ASE Prometheus Exporter
<a name="component-configuration-sap-ase-prometheus"></a>

定義 SAP ASE Prometheus Exporter 設定。

**JSON** 

```
"sapASEPrometheusExporter": {
    "sapAseSid": "SAP ASE SID",
    "sapAsePort": "SAP ASE database port",
    "sapAseSecretName": "SAP ASE secret name",
    "prometheusPort": "Target port to emit Prometheus metrics",
    "agreeToEnableASEMonitoring": true
}
```

**屬性**
+ **sapAseSid**

  SAP ASE 系統的三個字元 SAP 系統 ID (SID)。
+ **sapAsePort**

  匯出工具會用來查詢 ASE 指標的 SAP ASE 資料庫連接埠。
+ **sapAseSecretName**

  存放 ASE 監控使用者登入資料的 AWS Secrets Manager 秘密。SAP ASE Prometheus 匯出工具會使用這些憑證來連線至資料庫並查詢 ASE 指標。
+ **prometheusPort (選用)**

  要 Prometheus 要傳送指標的目標連接埠。如果未指定，則會使用預設連接埠 9399。如果有另一個使用預設連接埠的 ASE 資料庫，則我們將使用 9499。

### Windows 事件
<a name="windows-events"></a>

定義欲記錄的 Windows 事件。

**JSON** 

```
{
  "logGroupName" : "logGroupName",
  "eventName" : "eventName",
  "eventLevels" : ["ERROR","WARNING","CRITICAL","INFORMATION","VERBOSE"],
  "monitor" : true/false
}
```

**屬性**
+ **logGroupName (必要)**

  要與受監控日誌關聯的 CloudWatch 日誌群組名稱。如需日誌群組名稱限制條件，請參閱 [CreateLogGroup](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateLogGroup.html)。
+ **eventName (必要)**

  欲記錄的 Windows 事件類型。這和 Windows 事件日誌頻道名稱相同，例如 System、Security、CustomEventName 等。要記錄的每個 Windows 事件類型都需要此欄位。
+ **eventLevels (必要)**

  欲記錄的事件層級。您必須指定要記錄的每個層級。可能的值包括 `INFORMATION`、`WARNING`、`ERROR`、`CRITICAL` 及 `VERBOSE`。要記錄的每個 Windows 事件類型都需要此欄位。
+ **monitor (選用)**

  布林值，指出是否監控日誌。預設值為 `true`。

### 警示
<a name="component-configuration-alarms"></a>

定義要監控的元件 CloudWatch 警示。

**JSON** 

```
{
  "alarmName" : "monitoredAlarmName",
  "severity" : HIGH/MEDIUM/LOW
}
```

**屬性**
+ **警示名稱 (必填)**

  要監控的元件 CloudWatch 警示名稱。
+ **嚴重性 (選用)**

  指示警示影響的範圍程度。