감지기 모델 분석(AWS CLI) - AWS IoT Events

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

감지기 모델 분석(AWS CLI)

다음 단계에서는 AWS CLI를 사용하여 감지기 모델을 분석합니다.

  1. 다음 명령을 실행해 분석을 시작합니다.

    aws iotevents start-detector-model-analysis --cli-input-json file://file-name.json
    참고

    file-name을 감지기 모델 정의가 포함된 파일의 이름으로 대체합니다.

    예 감지기 모델 정의
    { "detectorModelDefinition": { "states": [ { "stateName": "TemperatureCheck", "onInput": { "events": [ { "eventName": "Temperature Received", "condition": "isNull($input.TemperatureInput.sensorData.temperature)==false", "actions": [ { "iotTopicPublish": { "mqttTopic": "IoTEvents/Output" } } ] } ], "transitionEvents": [] }, "onEnter": { "events": [ { "eventName": "Init", "condition": "true", "actions": [ { "setVariable": { "variableName": "temperatureChecked", "value": "0" } } ] } ] }, "onExit": { "events": [] } } ], "initialStateName": "TemperatureCheck" } }

    AWS CLI를 사용하여 기존 감지기 모델을 분석하는 경우, 다음 중 하나를 선택하여 감지기 모델 정의를 검색하세요.

    • AWS IoT Events 콘솔을 사용하려면 다음을 수행하세요.

      1. 탐색 창에서 감지기 모델을 선택합니다.

      2. 감지기 모델에서 대상 감지기 모델을 선택합니다.

      3. 작업에서 감지기 모델 내보내기를 선택하여 감지기 모델을 다운로드합니다. 감지기 모델은 JSON으로 저장됩니다.

      4. 감지기 모델 JSON 파일을 엽니다.

      5. detectorModelDefinition 객체만 있으면 됩니다. 다음을 제거하세요.

        • 페이지 상단의 첫 번째 중괄호({)

        • detectorModel 라인

        • detectorModelConfiguration 객체

        • 페이지 하단의 마지막 중괄호(})

      6. 파일을 저장합니다.

    • AWS CLI를 사용하고 싶다면, 다음을 수행하세요.

      1. 터미널에서 다음 명령을 실행하세요.

        aws iotevents describe-detector-model --detector-model-name detector-model-name
      2. detector-model-name을 감지기 모델 이름으로 바꾸세요.

      3. detectorModelDefinition 개체를 텍스트 편집기에 복사합니다.

      4. detectorModelDefinition 외부에 중괄호({})를 추가합니다.

      5. 파일을 JSON으로 저장합니다.

    예 응답의 예
    { "analysisId": "c1133390-14e3-4204-9a66-31efd92a4fed" }
  2. 출력에서 분석 ID를 복사합니다.

  3. 다음 명령을 실행하여 분석 상태를 검색합니다.

    aws iotevents describe-detector-model-analysis --analysis-id "analysis-id"
    참고

    analysis-id를 복사한 분석 ID로 바꾸세요.

    예 응답의 예
    { "status": "COMPLETE" }

    상태는 다음 값 중 하나일 수 있습니다.

    • RUNNING— AWS IoT Events는 감지기 모델을 분석하고 있습니다. 이 프로세스가 완료되는 데 최대 1분이 걸릴 수 있습니다.

    • COMPLETE— AWS IoT Events는 감지기 모델 분석을 마쳤습니다.

    • FAILED— AWS IoT Events는 감지기 모델을 분석할 수 없습니다. 나중에 다시 시도해 주세요.

  4. 다음 명령을 실행하여 감지기 모델의 분석 결과를 하나 이상 검색합니다.

    참고

    analysis-id를 복사한 분석 ID로 바꾸세요.

    aws iotevents get-detector-model-analysis-results --analysis-id "analysis-id"
    예 응답의 예
    { "analysisResults": [ { "type": "data-type", "level": "INFO", "message": "Inferred data types [Integer] for $variable.temperatureChecked", "locations": [] }, { "type": "referenced-resource", "level": "ERROR", "message": "Detector Model Definition contains reference to Input 'TemperatureInput' that does not exist.", "locations": [ { "path": "states[0].onInput.events[0]" } ] } ] }
참고

AWS IoT Events가 감지기 모델 분석을 시작한 후 최대 24시간까지 분석 결과를 불러올 수 있습니다.