System Operations on AWS - Lab 4W - Monitoring (Windows)

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

1. 创建Web Server

1.1 创建一个IAM策略

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

1.2 创建一个IAM角色

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

1.3 创建一个安全组

System Operations on AWS - Lab 4W - Monitoring (Windows)

1.4 创建Web Server

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

2. 定义CloudWatch Logs阈值

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

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

2.2 创建CloudWatch Logs指标筛选器

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

2.3 定义一个CloudWatch报警

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

System Operations on AWS - Lab 4W - Monitoring (Windows)

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

System Operations on AWS - Lab 4W - Monitoring (Windows)

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

3.1 登陆到WebServer

System Operations on AWS - Lab 4W - Monitoring (Windows)

3.2 配置AWS CLI

System Operations on AWS - Lab 4W - Monitoring (Windows)

3.3 生成IIS内存使用量

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

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

$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

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

3.3.3 创建CloudWatch自定义指标

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

3.3.4 检查CloudWatch的自定义指标

System Operations on AWS - Lab 4W - Monitoring (Windows)

相关文章:

  • 2021-07-02
  • 2021-07-01
  • 2021-12-27
  • 2021-10-27
  • 2021-11-04
  • 2021-10-22
  • 2022-02-14
猜你喜欢
  • 2021-09-17
  • 2021-08-30
  • 2021-10-16
  • 2022-02-24
  • 2022-01-17
  • 2021-10-24
  • 2021-11-11
相关资源
相似解决方案