使用 Amazon CloudWatch 进行监控 - Amazon IoT Events
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 Amazon Web Services 服务入门

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用 Amazon CloudWatch 进行监控

当您开发或调试Amazon IoT Events探测器模型,你需要知道Amazon IoT Events正在执行,以及遇到的任何错误。Amazon CloudWatch 监控您的 Amazon Web Services (Amazon) 资源以及您在上运行的应用程序Amazon实时。使用 CloudWatch,您可以在系统范围内获得资源使用情况、应用程序性能和运行状况的可视性。在开发时启用 Amazon CloudWatch 日志记录Amazon IoT Events探测器模型提供了有关如何启用Amazon IoT Events。要生成如下所示的日志,您必须将详细程度级别设置为 “调试” 并提供一个或多个调试目标这是一个探测器模型名称和可选项KeyValue

以下示例显示了一个 CloudWatch 调试级别日志条目,由Amazon IoT Events。

{ "timestamp": "2019-03-15T15:56:29.412Z", "level": "DEBUG", "logMessage": "Summary of message evaluation", "context": "MessageEvaluation", "status": "Success", "messageId": "SensorAggregate_2th846h", "keyValue": "boiler_1", "detectorModelName": "BoilerAlarmDetector", "initialState": "high_temp_alarm", "initialVariables": { "high_temp_count": 1, "high_pressure_count": 1 }, "finalState": "no_alarm", "finalVariables": { "high_temp_count": 0, "high_pressure_count": 0 }, "message": "{ \"temp\": 34.9, \"pressure\": 84.5}", "messageType": "CUSTOMER_MESSAGE", "conditionEvaluationResults": [ { "result": "True", "eventName": "alarm_cleared", "state": "high_temp_alarm", "lifeCycle": "OnInput", "hasTransition": true }, { "result": "Skipped", "eventName": "alarm_escalated", "state": "high_temp_alarm", "lifeCycle": "OnInput", "hasTransition": true, "resultDetails": "Skipped due to transition from alarm_cleared event" }, { "result": "True", "eventName": "should_recall_technician", "state": "no_alarm", "lifeCycle": "OnEnter", "hasTransition": true } ] }