组件配置示例 - Amazon CloudWatch
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

组件配置示例

以下示例以 JSON 格式显示了相关服务的组件配置。

Amazon Elastic Compute Cloud (EC2) 实例

{ "alarmMetrics" : [ { "alarmMetricName" : "CPUUtilization", "monitor" : true }, { "alarmMetricName" : "StatusCheckFailed" } ], "logs" : [ { "logGroupName" : "my_log_group", "logPath" : "C:\\LogFolder\\*", "logType" : "APPLICATION", "monitor" : true }, { "logGroupName" : "my_log_group_2", "logPath" : "C:\\LogFolder2\\*", "logType" : "IIS", "encoding" : "utf-8" } ], "windowsEvents" : [ { "logGroupName" : "my_log_group_3", "eventName" : "Application", "eventLevels" : [ "ERROR", "WARNING", "CRITICAL" ], "monitor" : true }, { "logGroupName" : "my_log_group_4", "eventName" : "System", "eventLevels" : [ "ERROR", "WARNING", "CRITICAL" ], "monitor" : true }], "alarms" : [ { "alarmName" : "my_instance_alarm_1", "severity" : "HIGH" }, { "alarmName" : "my_instance_alarm_2", "severity" : "LOW" } ], "subComponents" : [ { "subComponentType" : "AWS::EC2::Volume", "alarmMetrics" : [ { "alarmMetricName" : "VolumeQueueLength", "monitor" : "true" }, { "alarmMetricName" : "VolumeThroughputPercentage", "monitor" : "true" }, { "alarmMetricName" : "BurstBalance", "monitor" : "true" } }] }

Amazon Relational Database Service 实例

{ "alarmMetrics" : [ { "alarmMetricName" : "BurstBalance", "monitor" : true }, { "alarmMetricName" : "WriteThroughput", "monitor" : false } ], "alarms" : [ { "alarmName" : "my_rds_instance_alarm", "severity" : "MEDIUM" } ] }

Amazon Relational Database Service (RDS) Aurora MySQL

{ "alarmMetrics": [ { "alarmMetricName": "CPUUtilization", "monitor": true }, { "alarmMetricName": "CommitLatency", "monitor": true } ], "logs": [ { "logType": "MYSQL", "monitor": true, }, { "logType": "MYSQL_SLOW_QUERY", "monitor": false } ] }

Elastic Load Balancing (ELB)

{ "alarmMetrics" : [ { "alarmMetricName" : "EstimatedALBActiveConnectionCount", }, { "alarmMetricName" : "HTTPCode_Backend_5XX" } ], "subComponents" : [ { "subComponentType" : "AWS::EC2::Instance", "alarmMetrics" : [ { "alarmMetricName" : "CPUUtilization", }, { "alarmMetricName" : "StatusCheckFailed" } ], "logs" : [ { "logGroupName" : "my_log_group", "logPath" : "C:\\LogFolder\\*", "logType" : "APPLICATION", } ], "windowsEvents" : [ { "logGroupName" : "my_log_group_2", "eventName" : "Application", "eventLevels" : [ "ERROR", "WARNING", "CRITICAL" ], "monitor" : true } ] }, { "subComponentType" : "AWS::EC2::Volume", "alarmMetrics" : [ { "alarmMetricName" : "VolumeQueueLength", }, { "alarmMetricName" : "BurstBalance" } ] } ], "alarms" : [ { "alarmName" : "my_elb_alarm", "severity" : "HIGH" } ] }

应用程序 Elastic Load Balancing

{ "alarmMetrics" : [ { "alarmMetricName" : "ActiveConnectionCount", }, { "alarmMetricName" : "TargetResponseTime" } ], "subComponents" : [ { "subComponentType" : "AWS::EC2::Instance", "alarmMetrics" : [ { "alarmMetricName" : "CPUUtilization", }, { "alarmMetricName" : "StatusCheckFailed" } ], "logs" : [ { "logGroupName" : "my_log_group", "logPath" : "C:\\LogFolder\\*", "logType" : "APPLICATION", } ], "windowsEvents" : [ { "logGroupName" : "my_log_group_2", "eventName" : "Application", "eventLevels" : [ "ERROR", "WARNING", "CRITICAL" ] } ] }, { "subComponentType" : "AWS::EC2::Volume", "alarmMetrics" : [ { "alarmMetricName" : "VolumeQueueLength", }, { "alarmMetricName" : "BurstBalance" } ] } ], "alarms" : [ { "alarmName" : "my_alb_alarm", "severity" : "LOW" } ] }

Amazon EC2 Auto Scaling (ASG)

{ "alarmMetrics" : [ { "alarmMetricName" : "CPUCreditBalance", }, { "alarmMetricName" : "EBSIOBalance%" } ], "subComponents" : [ { "subComponentType" : "AWS::EC2::Instance", "alarmMetrics" : [ { "alarmMetricName" : "CPUUtilization", }, { "alarmMetricName" : "StatusCheckFailed" } ], "logs" : [ { "logGroupName" : "my_log_group", "logPath" : "C:\\LogFolder\\*", "logType" : "APPLICATION", } ], "windowsEvents" : [ { "logGroupName" : "my_log_group_2", "eventName" : "Application", "eventLevels" : [ "ERROR", "WARNING", "CRITICAL" ] } ] }, { "subComponentType" : "AWS::EC2::Volume", "alarmMetrics" : [ { "alarmMetricName" : "VolumeQueueLength", }, { "alarmMetricName" : "BurstBalance" } ] } ], "alarms" : [ { "alarmName" : "my_asg_alarm", "severity" : "LOW" } ] }

Amazon Simple Queue Service (SQS)

{ "alarmMetrics" : [ { "alarmMetricName" : "ApproximateAgeOfOldestMessage" }, { "alarmMetricName" : "NumberOfEmptyReceives" } ], "alarms" : [ { "alarmName" : "my_sqs_alarm", "severity" : "MEDIUM" } ] }

客户分组的 EC2 实例

{ "subComponents" : [ { "subComponentType" : "AWS::EC2::Instance", "alarmMetrics" : [ { "alarmMetricName" : "CPUUtilization", }, { "alarmMetricName" : "StatusCheckFailed" } ], "logs" : [ { "logGroupName" : "my_log_group", "logPath" : "C:\\LogFolder\\*", "logType" : "APPLICATION", } ], "windowsEvents" : [ { "logGroupName" : "my_log_group_2", "eventName" : "Application", "eventLevels" : [ "ERROR", "WARNING", "CRITICAL" ] } ] }, { "subComponentType" : "AWS::EC2::Volume", "alarmMetrics" : [ { "alarmMetricName" : "VolumeQueueLength", }, { "alarmMetricName" : "BurstBalance" } ] } ], "alarms" : [ { "alarmName" : "my_alarm", "severity" : "MEDIUM" } ] }

AWS Lambda 函数

{ "alarmMetrics": [ { "alarmMetricName": "Errors", "monitor": true }, { "alarmMetricName": "Throttles", "monitor": true }, { "alarmMetricName": "IteratorAge", "monitor": true }, { "alarmMetricName": "Duration", "monitor": true } ], "logs": [ { "logType": "DEFAULT", "monitor": true } ] }

Amazon DynamoDB 表

{ "alarmMetrics": [ { "alarmMetricName": "SystemErrors", "monitor": false }, { "alarmMetricName": "UserErrors", "monitor": false }, { "alarmMetricName": "ConsumedReadCapacityUnits", "monitor": false }, { "alarmMetricName": "ConsumedWriteCapacityUnits", "monitor": false }, { "alarmMetricName": "ReadThrottleEvents", "monitor": false }, { "alarmMetricName": "WriteThrottleEvents", "monitor": false }, { "alarmMetricName": "ConditionalCheckFailedRequests", "monitor": false }, { "alarmMetricName": "TransactionConflict", "monitor": false } ], "logs": [] }

SQL Always On 可用性组

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

RDS MySQL

{ "alarmMetrics": [ { "alarmMetricName": "CPUUtilization", "monitor": true } ], "logs": [ { "logType": "MYSQL", "monitor": true, }, { "logType": "MYSQL_SLOW_QUERY", "monitor": false } ] }

RDS PostgreSQL

{ "alarmMetrics": [ { "alarmMetricName": "CPUUtilization", "monitor": true } ], "logs": [ { "logType": "POSTGRESQL", "monitor": true } ] }

Amazon S3 存储桶

{ "alarmMetrics" : [ { "alarmMetricName" : "ReplicationLatency", "monitor" : true }, { "alarmMetricName" : "5xxErrors", "monitor" : true }, { "alarmMetricName" : "BytesDownloaded" "monitor" : true } ] }

AWS Step Functions

{ "alarmMetrics": [ { "alarmMetricName": "ExecutionsFailed", "monitor": true }, { "alarmMetricName": "LambdaFunctionsFailed", "monitor": true }, { "alarmMetricName": "ProvisionedRefillRate", "monitor": true } ], "logs": [ { "logGroupName": "/aws/states/HelloWorld-Logs", "logType": "STEP_FUNCTION", "monitor": true, } ] }

API 网关 REST API 阶段

{ "alarmMetrics" : [ { "alarmMetricName" : "4XXError", "monitor" : true }, { "alarmMetricName" : "5XXError", "monitor" : true } ], "logs" : [ { "logType" : "API_GATEWAY_EXECUTION", "monitor" : true }, { "logType" : "API_GATEWAY_ACCESS", "monitor" : true }, ] }

Java

{ "alarmMetrics" : [ { "alarmMetricName" : "java_lang_threading_threadcount", "monitor" : true }, { "alarmMetricName" : "java_lang_memory_heapmemoryusage_used", "monitor" : true }, { "alarmMetricName" : "java_lang_memory_heapmemoryusage_committed", "monitor" : true }], "logs" : [ ], "JMXPrometheusExporter": { "hostPort":"8686", "prometheusPort":"9404" } }
注意

Application Insights 不支持为 Prometheus JMX 导出程序配置身份验证。有关如何设置身份验证的信息,请参阅 Prometheus JMX 导出程序示例配置