모니터링할 CloudWatch 알람 생성 AWS IoT - AWS IoT Core

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

모니터링할 CloudWatch 알람 생성 AWS IoT

CloudWatch 알람 상태가 변경될 때 Amazon SNS 메시지를 보내는 경보를 생성할 수 있습니다. 경보는 지정한 기간 동안 단일 지표를 감시합니다. 지표 값이 장기간 동안 지정된 임계값을 초과하면 하나 이상의 작업이 수행됩니다. 작업은 Amazon SNS 주제 또는 Auto Scaling 정책에 전송된 알림일 수 있습니다. 경보는 지속적인 상태 변경에 대해서만 작업을 트리거합니다. CloudWatch 경보가 특정 상태에 있다는 이유만으로 경보가 동작을 트리거하는 것은 아닙니다. 상태가 변경되고 지정된 기간 동안 유지되어야 합니다.

CloudWatch 경보가 모니터링할 수 있는 모든 지표를 볼 수 있습니다. AWS IoT 측정치 및 측정기준

내 사물이 매일 성공적으로 연결되지 않을 경우 어떻게 통보를 받을 수 있습니까?

  1. 라는 things-not-connecting-successfully Amazon SNS 주제를 생성하고 해당 Amazon 리소스 이름 (ARN) 을 기록합니다. 이 절차에서는 주제를 ARN 다음과 같이 sns-topic-arn 지칭합니다.

    Amazon SNS 알림을 생성하는 방법에 대한 자세한 내용은 Amazon 시작하기를 참조하십시오SNS.

  2. 경보를 만듭니다.

    aws cloudwatch put-metric-alarm \ --alarm-name ConnectSuccessAlarm \ --alarm-description "Alarm when my Things don't connect successfully" \ --namespace AWS/IoT \ --metric-name Connect.Success \ --dimensions Name=Protocol,Value=MQTT \ --statistic Sum \ --threshold 10 \ --comparison-operator LessThanThreshold \ --period 86400 \ --evaluation-periods 1 \ --alarm-actions sns-topic-arn
  3. 경보를 테스트합니다.

    aws cloudwatch set-alarm-state --alarm-name ConnectSuccessAlarm --state-reason "initializing" --state-value OK
    aws cloudwatch set-alarm-state --alarm-name ConnectSuccessAlarm --state-reason "initializing" --state-value ALARM
  4. CloudWatch 콘솔에 알람이 나타나는지 확인하십시오.

내 사물이 매일 데이터를 게시하지 않을 경우 어떻게 통보를 받을 수 있습니까?

  1. 라는 things-not-publishing-data Amazon SNS 주제를 생성하고 해당 Amazon 리소스 이름 (ARN) 을 기록합니다. 이 절차에서는 주제를 ARN 다음과 같이 sns-topic-arn 지칭합니다.

    Amazon SNS 알림을 생성하는 방법에 대한 자세한 내용은 Amazon 시작하기를 참조하십시오SNS.

  2. 경보를 만듭니다.

    aws cloudwatch put-metric-alarm \ --alarm-name PublishInSuccessAlarm\ --alarm-description "Alarm when my Things don't publish their data \ --namespace AWS/IoT \ --metric-name PublishIn.Success \ --dimensions Name=Protocol,Value=MQTT \ --statistic Sum \ --threshold 10 \ --comparison-operator LessThanThreshold \ --period 86400 \ --evaluation-periods 1 \ --alarm-actions sns-topic-arn
  3. 경보를 테스트합니다.

    aws cloudwatch set-alarm-state --alarm-name PublishInSuccessAlarm --state-reason "initializing" --state-value OK
    aws cloudwatch set-alarm-state --alarm-name PublishInSuccessAlarm --state-reason "initializing" --state-value ALARM
  4. CloudWatch 콘솔에 알람이 나타나는지 확인하십시오.

내 사물 섀도우 업데이트가 매일 거부될 경우 어떻게 통보를 받을 수 있습니까?

  1. 라는 things-shadow-updates-rejected Amazon SNS 주제를 생성하고 해당 Amazon 리소스 이름 (ARN) 을 기록합니다. 이 절차에서는 주제를 ARN 다음과 같이 sns-topic-arn 지칭합니다.

    Amazon SNS 알림을 생성하는 방법에 대한 자세한 내용은 Amazon 시작하기를 참조하십시오SNS.

  2. 경보를 만듭니다.

    aws cloudwatch put-metric-alarm \ --alarm-name UpdateThingShadowSuccessAlarm \ --alarm-description "Alarm when my Things Shadow updates are getting rejected" \ --namespace AWS/IoT \ --metric-name UpdateThingShadow.Success \ --dimensions Name=Protocol,Value=MQTT \ --statistic Sum \ --threshold 10 \ --comparison-operator LessThanThreshold \ --period 86400 \ --unit Count \ --evaluation-periods 1 \ --alarm-actions sns-topic-arn
  3. 경보를 테스트합니다.

    aws cloudwatch set-alarm-state --alarm-name UpdateThingShadowSuccessAlarm --state-reason "initializing" --state-value OK
    aws cloudwatch set-alarm-state --alarm-name UpdateThingShadowSuccessAlarm --state-reason "initializing" --state-value ALARM
  4. CloudWatch 콘솔에 알람이 나타나는지 확인하십시오.

작업에 대한 CloudWatch 경보를 만들려면 어떻게 해야 합니까?

Jobs 서비스는 작업을 모니터링하는 데 필요한 CloudWatch 지표를 제공합니다. CloudWatch 경보를 생성하여 모든 Jobs 지표 항목을 모니터링할 수 있습니다.

다음 명령은 Job에 대해 실패한 총 작업 실행 수를 모니터링하는 CloudWatch 경보를 생성합니다.SampleOTAJob 20개 이상의 작업 실행이 실패하면 알려줍니다. 경보는 보고된 값을 300초마다 확인하여 작업 지표 FailedJobExecutionTotalCount을 모니터링합니다. 보고된 단일 값이 20보다 클 때, 즉 작업이 시작된 이후 20개 이상의 작업 실행이 실패했을 때 활성화합니다. 알람이 울리면 제공된 Amazon SNS 주제로 알림이 전송됩니다.

aws cloudwatch put-metric-alarm \ --alarm-name TotalFailedJobExecution-SampleOTAJob \ --alarm-description "Alarm when total number of failed job execution exceeds the threshold for SampleOTAJob" \ --namespace AWS/IoT \ --metric-name FailedJobExecutionTotalCount \ --dimensions Name=JobId,Value=SampleOTAJob \ --statistic Sum \ --threshold 20 \ --comparison-operator GreaterThanThreshold \ --period 300 \ --unit Count \ --evaluation-periods 1 \ --alarm-actions arn:aws:sns:<AWS_REGION>:<AWS_ACCOUNT_ID>:SampleOTAJob-has-too-many-failed-job-ececutions

다음 명령은 Job의 실패한 작업 실행 수를 모니터링하는 CloudWatch 경보를 생성합니다.SampleOTAJob 지정된 기간 동안 그런 다음 해당 기간 동안 5회 이상 작업 실행이 실패한 경우 이를 알립니다. 경보는 3600초마다 보고된 값을 확인하여 작업 지표 FailedJobExecutionCount을 모니터링합니다. 보고된 단일 값이 5보다 클 때, 즉 작업이 시작된 이후 5개 이상의 작업 실행이 실패했을 때 활성화합니다. 알람이 울리면 제공된 Amazon SNS 주제로 알림이 전송됩니다.

aws cloudwatch put-metric-alarm \ --alarm-name FailedJobExecution-SampleOTAJob \ --alarm-description "Alarm when number of failed job execution per hour exceeds the threshold for SampleOTAJob" \ --namespace AWS/IoT \ --metric-name FailedJobExecutionCount \ --dimensions Name=JobId,Value=SampleOTAJob \ --statistic Sum \ --threshold 5 \ --comparison-operator GreaterThanThreshold \ --period 3600 \ --unit Count \ --evaluation-periods 1 \ --alarm-actions arn:aws:sns:<AWS_REGION>:<AWS_ACCOUNT_ID>:SampleOTAJob-has-too-many-failed-job-ececutions-per-hour