使用命令列安裝、設定及管理應用程式以進行監控 - 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 若要為 OpsCenter 已啟用的資源群組新增應my-resource-group用程式,以將建立的應用程式傳遞 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

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

我們建議將類似的資源分組,例如. NETWeb 伺服器執行個體轉換為自訂元件,以便輕鬆上線,並提供更完善的監控和深入 目前, CloudWatch 應用程式洞察支援EC2執行個體的自訂群組。

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

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

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-22222、和arn: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 用程序檢測到的問題,並使用以下命令創建 OpsItems 的SNS主題arn:aws:sns:us-east-1:123456789012:MyTopic相關聯。

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 視窗工具 PowerShell

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

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

更新自訂元件

使用更新自訂元件 AWS CLI

您可以使用 AWS CLI ,my-new-component以使用下列指令來更新使my-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 視窗工具 PowerShell

您可以使用 AWS Tools for Windows PowerShell ,my-new-component以使用下列指令來更新使my-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 視窗工具 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 視窗工具 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 視窗工具 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 視窗工具 PowerShell

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

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

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

描述元件的建議監控組態

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

當元件是. NET工作者應用程式,您可以使用 AWS CLI my-resource-group,使用下列命令,說明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工作者應用程式,您可以使用 AWS Tools for Windows PowerShell my-resource-group,使用下列命令,說明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 監控移除指定的資源群組

使用從「應用程式見解」監視中移除指定的資源群組 AWS CLI

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

aws application-insights delete-application --resource-group-name my-resource-group
使用從「應用程式見解」監視中移除指定的資源群組 AWS Tools for Windows PowerShell

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

Remove-CWAIApplication -ResourceGroupName my-resource-group

設定SQL一律開啟可用性群組的監視

  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 必須導入應用程式事件日誌 (資訊層級),才能偵測叢集活動,例如容錯移轉。

設定 [我的] 的監視 SQL RDS

  1. 使用 [我的資SQL料庫執行個體] 建立資源群組RDS的應用程式。

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

    • set slow_query_log = 1

    • set log_output = FILE

  3. 將要監視的記錄檔匯出至 CloudWatch 記錄檔。如需詳細資訊,請參閱將我的SQL記錄發佈至 CloudWatch 記錄檔

  4. 設定我的SQLRDS元件。

    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}]}"

設定 [我的] 的監視 SQL EC2

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

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

    • set slow_query_log = 1

    • set log_output = FILE

  3. 設定我的SQLEC2元件。

    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\"}]}"

配置監控郵件 SQL RDS

  1. 使用 Postgre 資SQLRDS料庫執行處理建立資源群組的應用程式。

    aws application-insights create-application ‐-region <REGION> ‐-resource-group-name <RESOURCE_GROUP_NAME>
  2. 根據預設,不會啟用將 CloudWatch Postgre SQL 記錄發佈到。若要啟用監視,請開啟主RDS控台並選取要監視的資料庫。選擇右上角的 [修改],然選取標示為 [編輯SQL記錄] 的核取方塊。選擇 Continue (繼續) 以儲存此設定。

  3. 您的郵件記SQL錄會匯出至 CloudWatch。

  4. 設定後置SQLRDS元件。

    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 } ] }"

配置監控郵件 SQL EC2

  1. 使用 Postgre SQL EC2 實例為資源群組建立應用程式。

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

    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. 依預設,不會啟用將 CloudWatch Oracle 記錄檔發佈至。若要啟用監視,請開啟主RDS控台並選取要監視的資料庫。選擇右上角的 Modify (修改),然後選取標示為 Alert (提醒) 日誌和 Listener (接聽程式) 日誌的核取方塊。選擇 Continue (繼續) 以儲存此設定。

  3. 您的 Oracle 記錄檔會匯出至 CloudWatch。

  4. 設定甲骨文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. 設定甲骨文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, } ] }"