본문 바로가기

Management/CloudWatch

AWS CloudWatch

이번 블로깅은 CloudWatch


1. Preview

CloudWatch는 AWS에서 제공하는 모니터링 서비스입니다. CloudWatch를 이용하여 EC2를 비롯하여 AWS 대부분의 서비스를 모니터링할 수 있습니다. 요금이 복잡하게 설명이 되어 있습니다만, 1분 주기가 아닌 5분 주기의 경우 미비한 요금이 발생됩니다.


2. Getting Started

2-1. CPU/Disk/Network/StatusCheckFailed_Instacne, System(AWS H/W Failure) 및 기타 Customer 메트릭 추가

2-2. 해당 항목에 대한 CloudWatch Alarm 설정

Notification - Mail 및 기타 통지 설정

EC2 Action - 장애 발생 시 자동 대처 방법 설정

Recover this Instance - Instance가 자동적으로 Stop/Start 됩니다. (Status Check Failed_System)

Stop this Instance - Instance가 자동적으로 Stop

Terminate this Instance - Instacne가 자동적으로 Terminate

Reboot this Instance - Instance가 자동적으로 Reboot(Stop&Start 와는 다른 프로세스 EIP가 아닌 경우 Public IP가 변경)


2-4. AWS 장애 대응 가이드 라인에 따라 대처

장애가 발생된 Instance stop->start / Instance Settings -> Get System Log 확인

기본적으로 OS EBS를 detach하고 새로운 인스턴스에 attach 한 뒤 로그 분석

(http://docs.aws.amazon.com/ko_kr/AWSEC2/latest/UserGuide/TroubleshootingInstances.html#TroubleshootingLinux)



2-4. CloudWatch Status Check Failed(Any/Instance/System) Error(1) 시 CaseOpen을 합니다.

그렇지만 AWS에서는 H/W Failure에 대한 상세 이유는 제공하지 않습니다만... 걍 해봅니다.

Case Open 예시 - 

I have a problem of EC2 Instance(i-axxxx9) included an error(1) in cloudwatch metric's values(status check failed instance / status check failed system) which ocurred at October 23, 2015 at 11:00:00 AM.

Could you check this problem?

AWS Support 답변 예시 -

Sorry to hear that you are experiencing issues with your instance i-axxxxxx9. I have checked the underlying host where your instance (i-axxxxxx9) was running and I found there was an unexpected failure on the hardware.


3. Result

이상으로 간단하게 CloudWatch에 대한 블로깅을 해봤습니다. 최근 DashBoard 서비스 등 AWS 모니터링 서비스를 강화하고 있습니다. 현재 시작을 하려는 Start up이나 신규 프로젝트의 경우 3rd party solution을 이용하기 보다 CloudWatch 서비스 이용을 권장드립니다. 다만 모니터링 결과 데이터가 2주동안 밖에 제공이 안 되는 점은 감안하셔야 합니다. API 제공하고 있으니 해당 API를 이용해서 CloudWatch 로그 보관은 가능합니다. API로 S3에 CloudWatch Log를 보관하면 되겠네요.


다음은 CloudWatch와 SNS 서비스를 연동해서 장애 발생 시, Slack이나 기타 메신저, SMS를 이용한 알람 수신에 대해서 작성하도록 하겠습니다.