用於起重機監控的 AWS IoT Events 偵測器模型 - AWS IoT Events

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

用於起重機監控的 AWS IoT Events 偵測器模型

監控您的設備或裝置機群操作是否失敗或變更,並在發生此類事件時觸發動作。您可以定義偵測器模型,JSON在其中指定狀態、規則和動作。這可讓您監控輸入,例如溫度和壓力、追蹤閾值違規,以及傳送警示。這些範例顯示起重機和馬達的偵測器模型、偵測過熱問題,以及 Amazon 在超過閾值SNS時發出通知。您可以更新模型來改進行為,而不會中斷監控。

檔案: craneDetectorModel.json

{ "detectorModelName": "craneDetectorModel", "detectorModelDefinition": { "states": [ { "stateName": "Running", "onEnter": { "events": [ { "eventName": "init", "condition": "true", "actions": [ { "setVariable": { "variableName": "craneThresholdBreached", "value": "0" } } ] } ] }, "onInput": { "events": [ { "eventName": "Overheated", "condition": "$input.TemperatureInput.temperature > 35", "actions": [ { "setVariable": { "variableName": "craneThresholdBreached", "value": "$variable.craneThresholdBreached + 1" } } ] }, { "eventName": "Crane Threshold Breached", "condition": "$variable.craneThresholdBreached > 5", "actions": [ { "sns": { "targetArn": "arn:aws:sns:us-east-1:123456789012:CraneSNSTopic" } } ] }, { "eventName": "Underheated", "condition": "$input.TemperatureInput.temperature < 25", "actions": [ { "setVariable": { "variableName": "craneThresholdBreached", "value": "0" } } ] } ] } } ], "initialStateName": "Running" }, "key": "craneid", "roleArn": "arn:aws:iam::123456789012:role/columboSNSRole" }

更新現有的偵測器模型。檔案: updateCraneDetectorModel.json

{ "detectorModelName": "craneDetectorModel", "detectorModelDefinition": { "states": [ { "stateName": "Running", "onEnter": { "events": [ { "eventName": "init", "condition": "true", "actions": [ { "setVariable": { "variableName": "craneThresholdBreached", "value": "0" } }, { "setVariable": { "variableName": "alarmRaised", "value": "'false'" } } ] } ] }, "onInput": { "events": [ { "eventName": "Overheated", "condition": "$input.TemperatureInput.temperature > 30", "actions": [ { "setVariable": { "variableName": "craneThresholdBreached", "value": "$variable.craneThresholdBreached + 1" } } ] }, { "eventName": "Crane Threshold Breached", "condition": "$variable.craneThresholdBreached > 5 && $variable.alarmRaised == 'false'", "actions": [ { "sns": { "targetArn": "arn:aws:sns:us-east-1:123456789012:CraneSNSTopic" } }, { "setVariable": { "variableName": "alarmRaised", "value": "'true'" } } ] }, { "eventName": "Underheated", "condition": "$input.TemperatureInput.temperature < 10", "actions": [ { "setVariable": { "variableName": "craneThresholdBreached", "value": "0" } } ] } ] } } ], "initialStateName": "Running" }, "roleArn": "arn:aws:iam::123456789012:role/columboSNSRole" }

檔案: motorDetectorModel.json

{ "detectorModelName": "motorDetectorModel", "detectorModelDefinition": { "states": [ { "stateName": "Running", "onEnter": { "events": [ { "eventName": "init", "condition": "true", "actions": [ { "setVariable": { "variableName": "motorThresholdBreached", "value": "0" } } ] } ] }, "onInput": { "events": [ { "eventName": "Overheated And Overpressurized", "condition": "$input.PressureInput.pressure > 70 && $input.TemperatureInput.temperature > 30", "actions": [ { "setVariable": { "variableName": "motorThresholdBreached", "value": "$variable.motorThresholdBreached + 1" } } ] }, { "eventName": "Motor Threshold Breached", "condition": "$variable.motorThresholdBreached > 5", "actions": [ { "sns": { "targetArn": "arn:aws:sns:us-east-1:123456789012:MotorSNSTopic" } } ] } ] } } ], "initialStateName": "Running" }, "key": "motorId", "roleArn": "arn:aws:iam::123456789012:role/columboSNSRole" }

更新現有的偵測器模型。檔案: updateMotorDetectorModel.json

{ "detectorModelName": "motorDetectorModel", "detectorModelDefinition": { "states": [ { "stateName": "Running", "onEnter": { "events": [ { "eventName": "init", "condition": "true", "actions": [ { "setVariable": { "variableName": "motorThresholdBreached", "value": "0" } } ] } ] }, "onInput": { "events": [ { "eventName": "Overheated And Overpressurized", "condition": "$input.PressureInput.pressure > 70 && $input.TemperatureInput.temperature > 30", "actions": [ { "setVariable": { "variableName": "motorThresholdBreached", "value": "$variable.motorThresholdBreached + 1" } } ] }, { "eventName": "Motor Threshold Breached", "condition": "$variable.motorThresholdBreached > 5", "actions": [ { "sns": { "targetArn": "arn:aws:sns:us-east-1:123456789012:MotorSNSTopic" } } ] } ] } } ], "initialStateName": "Running" }, "roleArn": "arn:aws:iam::123456789012:role/columboSNSRole" }