+86 13541016684Mon. - Fri. 10:00-22:00

System Operations on AWS – Monitoring (Windows)教程

System Operations on AWS - Monitoring (Windows)教程

System Operations on AWS – Monitoring (Windows)教程

582266-20160305230624190-916598542

创建Web Server实例,配置CloudWatch来收集Web Server的系统日志,当错误登录次数达到设定值时触发报警

1. 创建Web Server

1.1 创建一个IAM策略

582266-20160305231813299-985784475

582266-20160305231850830-1908178366

582266-20160305232012549-713828808

1.2 创建一个IAM角色

582266-20160305232140534-961739738

582266-20160305232218315-1248364264

582266-20160305232332284-2028364794

582266-20160305232427096-1097867317

582266-20160305232507830-863433120

1.3 创建一个安全组

582266-20160305232747002-694101929

1.4 创建Web Server

582266-20160305233300705-985878057

582266-20160305233329674-1705348600

582266-20160305233422737-1256128633

582266-20160305233731065-2142616726

582266-20160305233819018-1377478430

582266-20160305233857596-1795224427

582266-20160305233942987-1380946882

582266-20160305234032971-634932867

2. 定义CloudWatch Logs阈值

2.1 确认CloudWatch Logs agent是否正在运行

582266-20160305234509721-309240525

582266-20160305234657346-1929527309

2.2 创建CloudWatch Logs指标筛选器

582266-20160305235013299-1822764578

582266-20160305235150002-534729897

582266-20160305235524205-1999773150

2.3 定义一个CloudWatch报警

582266-20160306000037815-1080353026

582266-20160306000621924-1552859777

582266-20160306000742002-827928172

用错误的密码尝试登陆WebServer实例多次,触发警报

582266-20160306001541596-1270022968

3. 给EC2实例生成一个CloudWatch自定义指标

3.1 登陆到WebServer

582266-20160306002016580-1290833983

3.2 配置AWS CLI

582266-20160306002206330-336832539

3.3 生成IIS内存使用量

3.3.1 获得当前为w3wp.exe进程内存使用情况

在WebServer上的浏览器中访问 http://localhost/

1
2
$memUsed = Get-WmiObject Win32_process -ComputerName $env:COMPUTERNAME | where CommandLine -Match "w3wp" | ForEach { "{0}" -f $_.VM } | Measure-Object -Sum | Select -ExpandProperty Sum
$memUsed

3.3.2 获得当前实例的InstanceId

1
$instanceId = (new-object net.webclient).DownloadString('http://169.254.169.254/latest/meta-data/instance-id')

3.3.3 创建CloudWatch自定义指标

1
aws cloudwatch put-metric-data --namespace HttpServerMetrics --metric-name HttpServerMemUtilization --dimension InstanceId=$instanceId --value $memUsed --unit "Kilobytes"

3.3.4 检查CloudWatch的自定义指标

582266-20160306003557518-77699039