使用命令列安裝、設定及管理應用程式以進行監控 - Amazon CloudWatch

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

使用命令列安裝、設定及管理應用程式以進行監控

本節提供使用 和 設定、設定和管理應用程式以進行監控的步驟 AWS CLI AWS Tools for Windows PowerShell。

新增及管理應用程式

您可以使用命令列新增、取得相關資訊、管理和設定您的 Application Insights 應用程式。

新增應用程式

使用 新增應用程式 AWS CLI

若要使用 AWS CLI 為名為 的資源群組新增應用程式my-resource-group,並啟用 OpsCenter 將建立的 opsItem 交付至 SNS 主題 ARN arn:aws:sns:us-east-1:123456789012:MyTopic,請使用下列命令。

aws application-insights create-application --resource-group-name my-resource-group --ops-center-enabled --ops-item-sns-topic-arn arn:aws:sns:us-east-1:123456789012:MyTopic
使用 新增應用程式 AWS Tools for Windows PowerShell

若要使用 AWS Tools for Windows PowerShell 為已啟用 my-resource-group OpsCenter 的 資源群組新增應用程式,以將建立的 opsItem 交付至 SNS 主題 ARN arn:aws:sns:us-east-1:123456789012:MyTopic,請使用下列命令。

New-CWAIApplication -ResourceGroupName my-resource-group -OpsCenterEnabled true -OpsItemSNSTopicArn arn:aws:sns:us-east-1:123456789012:MyTopic

描述應用程式

使用 描述應用程式 AWS CLI

若要使用 AWS CLI 描述在名為 的資源群組上建立的應用程式my-resource-group,請使用下列命令。

aws application-insights describe-application --resource-group-name my-resource-group
使用 描述應用程式 AWS Tools for Windows PowerShell

若要使用 AWS Tools for Windows PowerShell 描述在名為 的資源群組上建立的應用程式my-resource-group,請使用下列命令。

Get-CWAIApplication -ResourceGroupName my-resource-group

列出應用程式中的元件

使用 列出應用程式中的元件 AWS CLI

若要使用 AWS CLI 列出在名為 的資源群組上建立的元件my-resource-group,請使用下列命令。

aws application-insights list-components --resource-group-name my-resource-group
使用 列出應用程式中的元件 AWS Tools for Windows PowerShell

若要使用 AWS Tools for Windows PowerShell 列出在名為 的資源群組上建立的元件my-resource-group,請使用下列命令。

Get-CWAIComponentList -ResourceGroupName my-resource-group

描述元件

使用 描述元件 AWS CLI

您可以使用下列 AWS CLI 命令來描述名為 的元件my-component,該元件屬於在名為 的資源群組上建立的應用程式my-resource-group

aws application-insights describe-component --resource-group-name my-resource-group --component-name my-component
使用 描述元件 AWS Tools for Windows PowerShell

您可以使用下列 AWS Tools for Windows PowerShell 命令來描述名為 的元件my-component,該元件屬於在名為 的資源群組上建立的應用程式my-resource-group

Get-CWAIComponent -ComponentName my-component -ResourceGroupName my-resource-group

將類似資源分組到自訂元件

建議您將類似的資源 (例如 .NET Web 伺服器執行個體) 分組到自訂元件,以更輕鬆採用及利於監控和洞見。目前,CloudWatch Application Insights 支援 EC2 執行個體的自訂群組。

若要使用 AWS CLI將資源分組到自訂元件

若要使用 AWS CLI 將三個執行個體 (arn:aws:ec2:us-east-1:123456789012:instance/i-11111arn:aws:ec2:us-east-1:123456789012:instance/i-22222arn:aws:ec2:us-east-1:123456789012:instance/i-33333) 分組到名為 的自訂元件中my-resource-group,該元件my-component針對名為 的資源群組建立的應用程式,請使用下列命令。

aws application-insights create-component --resource-group-name my-resource-group --component-name my-component --resource-list arn:aws:ec2:us-east-1:123456789012:instance/i-11111 arn:aws:ec2:us-east-1:123456789012:instance/i-22222 arn:aws:ec2:us-east-1:123456789012:instance/i-33333
若要使用 AWS Tools for Windows PowerShell將資源分組到自訂元件

若要使用 AWS Tools for Windows PowerShell 將三個執行個體 (arn:aws:ec2:us-east-1:123456789012:instance/i-11111arn:aws:ec2:us-east-1:123456789012:instance/i-22222arn:aws:ec2:us-east-1:123456789012:instance/i-33333) 分組為名為 的自訂元件my-component,對於為名為 的資源群組建立的應用程式my-resource-group,請使用下列命令。

New-CWAIComponent -ResourceGroupName my-resource-group -ComponentName my-component -ResourceList arn:aws:ec2:us-east-1:123456789012:instance/i-11111,arn:aws:ec2:us-east-1:123456789012:instance/i-22222,arn:aws:ec2:us-east-1:123456789012:instance/i-33333

取消群組自訂元件

使用 取消自訂元件的群組 AWS CLI

若要使用 AWS CLI 在資源群組my-component上建立的應用程式中取消群組名為 的自訂元件,my-resource-group請使用下列命令。

aws application-insights delete-component --resource-group-name my-resource-group --component-name my-new-component
使用 取消自訂元件的群組 AWS Tools for Windows PowerShell

若要使用 AWS Tools for Windows PowerShell 在資源群組my-component上建立的應用程式中取消群組名為 的自訂元件,my-resource-group請使用下列命令。

Remove-CWAIComponent -ComponentName my-component -ResourceGroupName my-resource-group

更新應用程式

使用 更新應用程式 AWS CLI

您可以使用 AWS CLI 來更新應用程式,針對偵測到的應用程式問題產生 AWS Systems Manager OpsCenter OpsItems,並使用arn:aws:sns:us-east-1:123456789012:MyTopic下列命令將建立的 OpsItems 與 SNS 主題 建立關聯。

aws application-insights update-application --resource-group-name my-resource-group --ops-center-enabled --ops-item-sns-topic-arn arn:aws:sns:us-east-1:123456789012:MyTopic
使用 AWS Tools for Windows PowerShell 更新應用程式

您可以使用 AWS Tools for Windows PowerShell 來更新應用程式,針對偵測到的應用程式問題產生 AWS SSM OpsCenter OpsItems,並使用下列命令將建立的 OpsItems 與 SNS arn:aws:sns:us-east-1:123456789012:MyTopic 主題 建立關聯。

Update-CWAIApplication -ResourceGroupName my-resource-group -OpsCenterEnabled true -OpsItemSNSTopicArn arn:aws:sns:us-east-1:123456789012:MyTopic

更新自訂元件

使用 更新自訂元件 AWS CLI

您可以使用下列命令,使用 AWS CLI 更新my-component名為新元件名稱 的自訂元件my-new-component,以及已更新的執行個體群組。

aws application-insights update-component --resource-group-name my-resource-group --component-name my-component --new-component-name my-new-component --resource-list arn:aws:ec2:us-east-1:123456789012:instance/i-44444 arn:aws:ec2:us-east-1:123456789012:instance/i-55555
使用 AWS Tools for Windows PowerShell 更新自訂元件

您可以使用下列命令,使用 AWS Tools for Windows PowerShell 更新my-component名為新元件名稱 的自訂元件my-new-component,以及已更新的執行個體群組。

Update-CWAIComponent -ComponentName my-component -NewComponentName my-new-component -ResourceGroupName my-resource-group -ResourceList arn:aws:ec2:us-east-1:123456789012:instance/i-44444,arn:aws:ec2:us-east-1:123456789012:instance/i-55555

管理和更新監控

您可以使用命令列來管理和更新您 Application Insights 應用程式的監控。

列出您應用程式的問題

使用 列出應用程式的問題 AWS CLI

若要使用 AWS CLI 來列出自 Unix Epoch 起 1,000 到 10,000 毫秒之間,在名為 的資源群組上建立的應用程式所偵測到的問題my-resource-group,請使用下列命令。

aws application-insights list-problems --resource-group-name my-resource-group --start-time 1000 --end-time 10000
使用 AWS Tools for Windows PowerShell 列出應用程式的問題

若要使用 AWS Tools for Windows PowerShell 來列出自 Unix Epoch 起,在名為 的資源群組上建立的應用程式偵測到 1,000 到 10,000 毫秒之間的應用程式問題my-resource-group,請使用下列命令。

$startDate = "8/6/2019 3:33:00" $endDate = "8/6/2019 3:34:00" Get-CWAIProblemList -ResourceGroupName my-resource-group -StartTime $startDate -EndTime $endDate

描述應用程式問題

使用 描述應用程式問題 AWS CLI

若要使用 AWS CLI 描述問題 ID 的問題p-1234567890,請使用下列命令。

aws application-insights describe-problem —problem-id p-1234567890
使用 AWS Tools for Windows PowerShell 描述應用程式問題

若要使用 AWS Tools for Windows PowerShell 描述問題 ID 的問題p-1234567890,請使用下列命令。

Get-CWAIProblem -ProblemId p-1234567890

描述與問題相關聯的異常或錯誤

使用 描述與問題相關的異常或錯誤 AWS CLI

若要使用 AWS CLI 來描述與問題 ID 為 的問題相關的異常或錯誤p-1234567890,請使用下列命令。

aws application-insights describe-problem-observations --problem-id -1234567890
使用 AWS Tools for Windows PowerShell描述與問題相關聯的異常或錯誤

若要使用 AWS Tools for Windows PowerShell 來描述與問題 ID 為 的問題相關的異常或錯誤p-1234567890,請使用下列命令。

Get-CWAIProblemObservation -ProblemId p-1234567890

描述應用程式的異常或錯誤

使用 AWS CLI 描述應用程式的異常或錯誤

若要使用 AWS CLI 來描述具有觀察 ID 的應用程式異常或錯誤o-1234567890,請使用下列命令。

aws application-insights describe-observation —observation-id o-1234567890
使用 AWS Tools for Windows PowerShell 描述應用程式的異常或錯誤

若要使用 AWS Tools for Windows PowerShell 來描述具有觀察 ID 的應用程式異常或錯誤o-1234567890,請使用下列命令。

Get-CWAIObservation -ObservationId o-1234567890

描述元件的監控組態

使用 AWS CLI描述元件的監控組態

若要使用 AWS CLI 描述my-component在資源群組 上建立的應用程式中呼叫的元件的監控組態my-resource-group,請使用下列命令。

aws application-insights describe-component-configuration —resource-group-name my-resource-group —component-name my-component
使用 AWS Tools for Windows PowerShell 描述元件的監控組態

若要使用 AWS Tools for Windows PowerShell 來描述名為 之元件的監控組態my-component,請在資源群組 上建立的應用程式中my-resource-group,使用下列命令。

Get-CWAIComponentConfiguration -ComponentName my-component -ResourceGroupName my-resource-group

如需元件組態的詳細資訊和範例 JSON 檔案,請參閱 使用元件組態

描述元件的建議監控組態

使用 描述元件的建議監控組態 AWS CLI

當元件是 .NET Worker 應用程式的一部分時,您可以使用下列命令my-resource-group, AWS CLI 描述在資源群組 上建立的應用程式my-component中所呼叫元件的建議監控組態。

aws application-insights describe-component-configuration-recommendation --resource-group-name my-resource-group --component-name my-component --tier DOT_NET_WORKER
使用 描述元件的建議監控組態 AWS Tools for Windows PowerShell

當元件是 .NET Worker 應用程式的一部分時,您可以使用下列命令my-resource-group, AWS Tools for Windows PowerShell 描述在資源群組 上建立的應用程式my-component中所呼叫元件的建議監控組態。

Get-CWAIComponentConfigurationRecommendation -ComponentName my-component -ResourceGroupName my-resource-group -Tier DOT_NET_WORKER

如需元件組態的詳細資訊和範例 JSON 檔案,請參閱 使用元件組態

更新元件的監控組態

使用 AWS CLI更新元件的監控組態

若要使用 AWS CLI 在名為 的資源群組上建立my-component的應用程式中,更新名為 的元件my-resource-group,請使用下列命令。命令包含這些動作:

  1. 啟用元件的監控。

  2. 將元件的層設為 .NET Worker

  3. 將元件的 JSON 組態更新為從本機檔案 configuration.txt 讀取。

aws application-insights update-component-configuration --resource-group-name my-resource-group --component-name my-component --tier DOT_NET_WORKER --monitor --component-configuration "file://configuration.txt"
使用 AWS Tools for Windows PowerShell更新元件的監控組態

若要使用 AWS Tools for Windows PowerShell 在名為 的資源群組上建立my-component的應用程式中,更新名為 的元件my-resource-group,請使用下列命令。命令包含這些動作:

  1. 啟用元件的監控。

  2. 將元件的層設為 .NET Worker

  3. 將元件的 JSON 組態更新為從本機檔案 configuration.txt 讀取。

[string]$config = Get-Content -Path configuration.txt Update-CWAIComponentConfiguration -ComponentName my-component -ResourceGroupName my-resource-group -Tier DOT_NET_WORKER -Monitor 1 -ComponentConfiguration $config

如需元件組態的詳細資訊和範例 JSON 檔案,請參閱 使用元件組態

從 Application Insights 監控移除指定的資源群組

使用 從 Application Insights 監控中移除指定的資源群組 AWS CLI

若要使用 AWS CLI 從my-resource-group監控中移除在名為 的資源群組上建立的應用程式,請使用下列命令。

aws application-insights delete-application --resource-group-name my-resource-group
使用 從 Application Insights 監控中移除指定的資源群組 AWS Tools for Windows PowerShell

若要使用 AWS Tools for Windows PowerShell 從my-resource-group監控中移除在名為 的資源群組上建立的應用程式,請使用下列命令。

Remove-CWAIApplication -ResourceGroupName my-resource-group

設定 SQL Always On 可用性群組的監控

  1. 為資源群組建立具有 SQL HA EC2 執行個體的應用程式。

    aws application-insights create-application ‐-region <REGION> ‐-resource-group-name <RESOURCE_GROUP_NAME>
  2. 透過建立新的應用程式元件,來定義代表 SQL HA 叢集的 EC2 執行個體。

    aws application-insights create-component ‐-resource-group-name "<RESOURCE_GROUP_NAME>" ‐-component-name SQL_HA_CLUSTER ‐-resource-list "arn:aws:ec2:<REGION>:<ACCOUNT_ID>:instance/<CLUSTER_INSTANCE_1_ID>" "arn:aws:ec2:<REGION>:<ACCOUNT_ID>:instance/<CLUSTER_INSTANCE_2_ID>
  3. 設定 SQL HA 元件。

    aws application-insights update-component-configuration ‐-resource-group-name "<RESOURCE_GROUP_NAME>" ‐-region <REGION> ‐-component-name "SQL_HA_CLUSTER" ‐-monitor ‐-tier SQL_SERVER_ALWAYSON_AVAILABILITY_GROUP ‐-monitor ‐-component-configuration '{ "subComponents" : [ { "subComponentType" : "AWS::EC2::Instance", "alarmMetrics" : [ { "alarmMetricName" : "CPUUtilization", "monitor" : true }, { "alarmMetricName" : "StatusCheckFailed", "monitor" : true }, { "alarmMetricName" : "Processor % Processor Time", "monitor" : true }, { "alarmMetricName" : "Memory % Committed Bytes In Use", "monitor" : true }, { "alarmMetricName" : "Memory Available Mbytes", "monitor" : true }, { "alarmMetricName" : "Paging File % Usage", "monitor" : true }, { "alarmMetricName" : "System Processor Queue Length", "monitor" : true }, { "alarmMetricName" : "Network Interface Bytes Total/sec", "monitor" : true }, { "alarmMetricName" : "PhysicalDisk % Disk Time", "monitor" : true }, { "alarmMetricName" : "SQLServer:Buffer Manager Buffer cache hit ratio", "monitor" : true }, { "alarmMetricName" : "SQLServer:Buffer Manager Page life expectancy", "monitor" : true }, { "alarmMetricName" : "SQLServer:General Statistics Processes blocked", "monitor" : true }, { "alarmMetricName" : "SQLServer:General Statistics User Connections", "monitor" : true }, { "alarmMetricName" : "SQLServer:Locks Number of Deadlocks/sec", "monitor" : true }, { "alarmMetricName" : "SQLServer:SQL Statistics Batch Requests/sec", "monitor" : true }, { "alarmMetricName" : "SQLServer:Database Replica File Bytes Received/sec", "monitor" : true }, { "alarmMetricName" : "SQLServer:Database Replica Log Bytes Received/sec", "monitor" : true }, { "alarmMetricName" : "SQLServer:Database Replica Log remaining for undo", "monitor" : true }, { "alarmMetricName" : "SQLServer:Database Replica Log Send Queue", "monitor" : true }, { "alarmMetricName" : "SQLServer:Database Replica Mirrored Write Transaction/sec", "monitor" : true }, { "alarmMetricName" : "SQLServer:Database Replica Recovery Queue", "monitor" : true }, { "alarmMetricName" : "SQLServer:Database Replica Redo Bytes Remaining", "monitor" : true }, { "alarmMetricName" : "SQLServer:Database Replica Redone Bytes/sec", "monitor" : true }, { "alarmMetricName" : "SQLServer:Database Replica Total Log requiring undo", "monitor" : true }, { "alarmMetricName" : "SQLServer:Database Replica Transaction Delay", "monitor" : true } ], "windowsEvents" : [ { "logGroupName" : "WINDOWS_EVENTS-Application-<RESOURCE_GROUP_NAME>", "eventName" : "Application", "eventLevels" : [ "WARNING", "ERROR", "CRITICAL", "INFORMATION" ], "monitor" : true }, { "logGroupName" : "WINDOWS_EVENTS-System-<RESOURCE_GROUP_NAME>", "eventName" : "System", "eventLevels" : [ "WARNING", "ERROR", "CRITICAL" ], "monitor" : true }, { "logGroupName" : "WINDOWS_EVENTS-Security-<RESOURCE_GROUP_NAME>", "eventName" : "Security", "eventLevels" : [ "WARNING", "ERROR", "CRITICAL" ], "monitor" : true } ], "logs" : [ { "logGroupName" : "SQL_SERVER_ALWAYSON_AVAILABILITY_GROUP-<RESOURCE_GROUP_NAME>", "logPath" : "C:\\Program Files\\Microsoft SQL Server\\MSSQL**.MSSQLSERVER\\MSSQL\\Log\\ERRORLOG", "logType" : "SQL_SERVER", "monitor" : true, "encoding" : "utf-8" } ] }, { "subComponentType" : "AWS::EC2::Volume", "alarmMetrics" : [ { "alarmMetricName" : "VolumeReadBytes", "monitor" : true }, { "alarmMetricName" : "VolumeWriteBytes", "monitor" : true }, { "alarmMetricName" : "VolumeReadOps", "monitor" : true }, { "alarmMetricName" : "VolumeWriteOps", "monitor" : true }, { "alarmMetricName" : "VolumeQueueLength", "monitor" : true }, { "alarmMetricName" : "VolumeThroughputPercentage", "monitor" : true }, { "alarmMetricName" : "BurstBalance", "monitor" : true } ] } ] }'
注意

Application Insights 必須導入應用程式事件日誌 (資訊層級),才能偵測叢集活動,例如容錯移轉。

設定監控 MySQL RDS

  1. 為資源群組建立具有 RDS MySQL 資料庫執行個體的應用程式。

    aws application-insights create-application ‐-region <REGION> ‐-resource-group-name <RESOURCE_GROUP_NAME>
  2. 錯誤日誌預設為啟用。使用資料參數群組可啟用慢查詢日誌。如需詳細資訊,請參閱存取 MySQL 慢查詢日誌及一般日誌

    • set slow_query_log = 1

    • set log_output = FILE

  3. 將要監控的日誌匯出至 CloudWatch Logs。如需詳細資訊,請參閱將 MySQL 日誌發佈到 CloudWatch Logs

  4. 設定 MySQL RDS 元件。

    aws application-insights update-component-configuration ‐-resource-group-name "<RESOURCE_GROUP_NAME>" ‐-region <REGION> ‐-component-name "<DB_COMPONENT_NAME>" ‐-monitor ‐-tier DEFAULT ‐-monitor ‐-component-configuration "{\"alarmMetrics\":[{\"alarmMetricName\":\"CPUUtilization\",\"monitor\":true}],\"logs\":[{\"logType\":\"MYSQL\",\"monitor\":true},{\"logType\": \"MYSQL_SLOW_QUERY\",\"monitor\":false}]}"

設定監控 MySQL EC2

  1. 為資源群組建立具有 SQL HA EC2 執行個體的應用程式。

    aws application-insights create-application ‐-region <REGION> ‐-resource-group-name <RESOURCE_GROUP_NAME>
  2. 錯誤日誌預設為啟用。使用資料參數群組可啟用慢查詢日誌。如需詳細資訊,請參閱存取 MySQL 慢查詢日誌及一般日誌

    • set slow_query_log = 1

    • set log_output = FILE

  3. 設定 MySQL EC2 元件。

    aws application-insights update-component-configuration ‐-resource-group-name "<RESOURCE_GROUP_NAME>" ‐-region <REGION> ‐-component-name "<DB_COMPONENT_NAME>" ‐-monitor ‐-tier MYSQL ‐-monitor ‐-component-configuration "{\"alarmMetrics\":[{\"alarmMetricName\":\"CPUUtilization\",\"monitor\":true}],\"logs\":[{\"logGroupName\":\"<UNIQUE_LOG_GROUP_NAME>\",\"logPath\":\"C:\\\\ProgramData\\\\MySQL\\\\MySQL Server **\\\\Data\\\\<FILE_NAME>.err\",\"logType\":\"MYSQL\",\"monitor\":true,\"encoding\":\"utf-8\"}]}"

設定 PostgreSQL RDS 的監控

  1. 為資源群組建立具有 PostgreSQL RDS 資料庫執行個體的應用程式。

    aws application-insights create-application ‐-region <REGION> ‐-resource-group-name <RESOURCE_GROUP_NAME>
  2. 預設不會將 PostgreSQL 日誌發佈至 CloudWatch。若要啟用監控,請開啟 RDS 主控台,然後選取要監控的資料庫。選擇右上角的 Modify (修改),然後選取標示為 PostgreSQL 日誌的核取方塊。選擇 Continue (繼續) 以儲存此設定。

  3. 您的 PostgreSQL 日誌會匯出至 CloudWatch。

  4. 設定 PostgreSQL RDS 元件。

    aws application-insights update-component-configuration --region <REGION> --resource-group-name <RESOURCE_GROUP_NAME> --component-name <DB_COMPONENT_NAME> --monitor --tier DEFAULT --component-configuration "{ \"alarmMetrics\":[ { \"alarmMetricName\": \"CPUUtilization\", \"monitor\": true } ], \"logs\":[ { \"logType\": \"POSTGRESQL\", \"monitor\": true } ] }"

設定 PostgreSQL EC2 的監控

  1. 為資源群組建立具有 PostgreSQL EC2 執行個體的應用程式。

    aws application-insights create-application ‐-region <REGION> ‐-resource-group-name <RESOURCE_GROUP_NAME>
  2. 設定 PostgreSQL EC2 元件。

    aws application-insights update-component-configuration ‐-region <REGION> ‐-resource-group-name <RESOURCE_GROUP_NAME> ‐-component-name <DB_COMPONENT_NAME> ‐-monitor ‐-tier POSTGRESQL ‐-component-configuration "{ \"alarmMetrics\":[ { \"alarmMetricName\":\"CPUUtilization\", \"monitor\":true } ], \"logs\":[ { \"logGroupName\":\"<UNIQUE_LOG_GROUP_NAME>\", \"logPath\":\"/var/lib/pgsql/data/log/\", \"logType\":\"POSTGRESQL\", \"monitor\":true, \"encoding\":\"utf-8\" } ] }"

設定 Oracle RDS 的監控

  1. 為資源群組建立具有 Oracle RDS 資料庫執行個體的應用程式。

    aws application-insights create-application ‐-region <REGION> ‐-resource-group-name <RESOURCE_GROUP_NAME>
  2. 預設不會將 Oracle 日誌發佈至 CloudWatch。若要啟用監控,請開啟 RDS 主控台,然後選取要監控的資料庫。選擇右上角的 Modify (修改),然後選取標示為 Alert (提醒) 日誌和 Listener (接聽程式) 日誌的核取方塊。選擇 Continue (繼續) 以儲存此設定。

  3. 您的 Oracle 日誌會匯出至 CloudWatch。

  4. 設定 Oracle RDS 元件。

    aws application-insights update-component-configuration --region <REGION> --resource-group-name <RESOURCE_GROUP_NAME> --component-name <DB_COMPONENT_NAME> --monitor --tier DEFAULT --component-configuration "{ \"alarmMetrics\":[ { \"alarmMetricName\": \"CPUUtilization\", \"monitor\": true } ], \"logs\":[ { \"logType\": \"ORACLE_ALERT\", \"monitor\": true }, { \"logType\": \"ORACLE_LISTENER\", \"monitor\": true } ] }"

設定 Oracle EC2 的監控

  1. 為資源群組建立具有 Oracle EC2 執行個體的應用程式。

    aws application-insights create-application ‐-region <REGION> ‐-resource-group-name <RESOURCE_GROUP_NAME>
  2. 設定 Oracle EC2 元件。

    aws application-insights update-component-configuration ‐-region <REGION> ‐-resource-group-name <RESOURCE_GROUP_NAME> ‐-component-name <DB_COMPONENT_NAME> ‐-monitor ‐-tier ORACLE ‐-component-configuration "{ \"alarmMetrics\":[ { \"alarmMetricName\":\"CPUUtilization\", \"monitor\":true } ], \"logs\":[ { \"logGroupName\":\"<UNIQUE_LOG_GROUP_NAME>\", \"logPath\":\"/opt/oracle/diag/rdbms/*/*/trace\", \"logType\":\"ORACLE_ALERT\", \"monitor\":true, }, { \"logGroupName\":\"<UNIQUE_LOG_GROUP_NAME>\", \"logPath\":\"/opt/oracle/diag/tnslsnr/$HOSTNAME/listener/trace/\", \"logType\":\"ORACLE_ALERT\", \"monitor\":true, } ] }"