Amazon Elastic Compute Cloud (EC2) 实例
以下示例演示适用于 Amazon EC2 实例的 JSON 格式组件配置。
重要
当 Amazon EC2 实例进入 stopped
状态时,表示已将它从监控中移除。当它恢复为 running
状态时,会将它添加到 CloudWatch Application Insights 控制台 Application details(应用程序详细信息)页面上的 Unmonitored components(未监控组件)列表中。如果为应用程序启用了自动监控新资源,则会将该实例添加到 Monitored components(已监控组件)列表中。但会将日志和指标设置为工作负载的默认值。不会保存之前的日志和指标配置。
{ "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" } ], "processes" : [ { "processName" : "my_process", "alarmMetrics" : [ { "alarmMetricName" : "procstat cpu_usage", "monitor" : true }, { "alarmMetricName" : "procstat memory_rss", "monitor" : true } ] } ], "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" } }] }