Orion无法从IoTAgent接收上下文通知:响应不正确

时间:2019-02-28 14:34:34

标签: fiware-orion

难以理解IoTAgent-Orion订阅将问题信息发布到Orion时出了什么问题。 Orion服务运行状况检查正常,但无法通过响应“不正常”代码404接收上下文。Orion日志:

time=Thursday 28 Feb 14:25:57 2019.783Z | lvl=INFO | corr=c3b64466-3b64-11e9-b463-0242ac1d0005 | trans=1551363484-821-00000000032 | from=172.29.0.6 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=logMsg.h[1844]:lmTransactionStart | msg=Starting transaction to http://lightweightm2m-iotagent:4041/publish
time=Thursday 28 Feb 14:25:57 2019.783Z | lvl=INFO | corr=c3b64466-3b64-11e9-b463-0242ac1d0005 | trans=1551363484-821-00000000032 | from=172.29.0.6 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=httpRequestSend.cpp[592]:httpRequestSendWithCurl | msg=Sending message 3 to HTTP server: sending message of 576 bytes to HTTP server
time=Thursday 28 Feb 14:25:57 2019.791Z | lvl=INFO | corr=c3b64466-3b64-11e9-b463-0242ac1d0005 | trans=1551363484-821-00000000032 | from=172.29.0.6 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=httpRequestSend.cpp[612]:httpRequestSendWithCurl | msg=Notification Successfully Sent to http://lightweightm2m-iotagent:4041/publish
time=Thursday 28 Feb 14:25:57 2019.791Z | lvl=WARN | corr=c3b64466-3b64-11e9-b463-0242ac1d0005 | trans=1551363484-821-00000000032 | from=172.29.0.6 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=httpRequestSend.cpp[625]:httpRequestSendWithCurl | msg=Notification response NOT OK, http code: 404

编辑: 我再次编辑了问题,以重现产生错误的情况。以下是代理日志:

time=2019-02-28T15:15:53.810Z | lvl=DEBUG | corr=bd797a30-3b6b-11e9-98a6-0242c0a85005 | trans=b725da6c-8917-4dde-9d29-defa97970b1a | op=IoTAgentNGSI.DomainControl | srv=smartgondor | subsrv=/gardens | msg=response-time: 8 | comp=IoTAgent
time=2019-02-28T15:16:00.398Z | lvl=DEBUG | corr=05d60d9d-dd2e-4d0e-b80f-ad1c384431d7 | trans=05d60d9d-dd2e-4d0e-b80f-ad1c384431d7 | op=IoTAgentNGSI.GenericMiddlewares | srv=n/a | subsrv=n/a | msg=Request for path [/iot/about] from [localhost:4041] | comp=IoTAgent
time=2019-02-28T15:16:00.399Z | lvl=DEBUG | corr=05d60d9d-dd2e-4d0e-b80f-ad1c384431d7 | trans=05d60d9d-dd2e-4d0e-b80f-ad1c384431d7 | op=IoTAgentNGSI.DomainControl | srv=n/a | subsrv=n/a | msg=response-time: 1 | comp=IoTAgent
time=2019-02-28T15:16:13.255Z | lvl=DEBUG | corr=e4633c8b-1db7-4207-b307-3e419f78223f | trans=e4633c8b-1db7-4207-b307-3e419f78223f | op=LWM2MLib.InformationReporting | srv=n/a | subsrv=n/a | msg=New data on resource /3303/0/5700 in device [1] | comp=IoTAgent
time=2019-02-28T15:16:13.255Z | lvl=DEBUG | corr=e4633c8b-1db7-4207-b307-3e419f78223f | trans=e4633c8b-1db7-4207-b307-3e419f78223f | op=IOTAgent.LWM2MHandlers | srv=n/a | subsrv=n/a | msg=Handling data from device [raspiSensorTV] | comp=IoTAgent
.
.
time=2019-02-28T15:16:13.256Z | lvl=DEBUG | corr=e4633c8b-1db7-4207-b307-3e419f78223f | trans=e4633c8b-1db7-4207-b307-3e419f78223f | op=IoTAgentNGSI.MongoDBGroupRegister | srv=n/a | subsrv=n/a | msg=Looking for group params ["type"] with queryObj {"type":"Device"} | comp=IoTAgent
time=2019-02-28T15:16:13.260Z | lvl=DEBUG | corr=e4633c8b-1db7-4207-b307-3e419f78223f | trans=e4633c8b-1db7-4207-b307-3e419f78223f | op=IoTAgentNGSI.MongoDBGroupRegister | srv=n/a | subsrv=n/a | msg=Device group for fields [["type"]] not found: [{"type":"Device"}] | comp=IoTAgent
time=2019-02-28T15:16:13.260Z | lvl=DEBUG | corr=e4633c8b-1db7-4207-b307-3e419f78223f | trans=e4633c8b-1db7-4207-b307-3e419f78223f | op=IoTAgentNGSI.NGSIService | srv=n/a | subsrv=n/a | msg=error {"name":"DEVICE_GROUP_NOT_FOUND","message":"Couldn\t find device group","code":404} in get group device | comp=IoTAgent
.
.
time=2019-02-28T15:16:13.261Z | lvl=DEBUG | corr=e4633c8b-1db7-4207-b307-3e419f78223f | trans=e4633c8b-1db7-4207-b307-3e419f78223f | op=IoTAgentNGSI.NGSIService | srv=n/a | subsrv=n/a | msg=Updating device value in the Context Broker at [http://orion:1026/v1/updateContext] | comp=IoTAgent
time=2019-02-28T15:16:13.261Z | lvl=DEBUG | corr=e4633c8b-1db7-4207-b307-3e419f78223f | trans=e4633c8b-1db7-4207-b307-3e419f78223f | op=IoTAgentNGSI.NGSIService | srv=n/a | subsrv=n/a | msg=Using the following request:
{
    "url": "http://orion:1026/v1/updateContext",
    "method": "POST",
    "headers": {
        "fiware-service": "smartGondor",
        "fiware-servicepath": "/gardens"
    },
    "json": {
        "contextElements": [
            {
                "type": "Device",
                "isPattern": "false",
                "id": "Device:raspiSensorTV",
                "attributes": [
                    {
                        "name": "Temperature Sensor#0",
                        "type": "string",
                        "value": "�\u0016DA�\u0000\u0000",
                        "metadatas": [
                            {
                                "name": "TimeInstant",
                                "type": "ISO8601",
                                "value": "2019-02-28T15:16:13.261Z"
                            }
                        ]
                    },
                    {
                        "name": "TimeInstant",
                        "type": "ISO8601",
                        "value": "2019-02-28T15:16:13.261Z"
                    }
                ]
            }
        ],
        "updateAction": "UPDATE"
    }
}
 | comp=IoTAgent
time=2019-02-28T15:16:13.274Z | lvl=DEBUG | corr=e4633c8b-1db7-4207-b307-3e419f78223f | trans=e4633c8b-1db7-4207-b307-3e419f78223f | op=IoTAgentNGSI.NGSIService | srv=n/a | subsrv=n/a | msg=Received the following request from the CB:
{
    "contextResponses": [
        {
            "contextElement": {
                "type": "Device",
                "isPattern": "false",
                "id": "Device:raspiSensorTV",
                "attributes": [
                    {
                        "name": "Temperature Sensor#0",
                        "type": "string",
                        "value": "",
                        "metadatas": [
                            {
                                "name": "TimeInstant",
                                "type": "ISO8601",
                                "value": "2019-02-28T15:16:13.261Z"
                            }
                        ]
                    },
                    {
                        "name": "TimeInstant",
                        "type": "ISO8601",
                        "value": ""
                    }
                ]
            },
            "statusCode": {
                "code": "200",
                "reasonPhrase": "OK"
            }
        }
    ]
}
 | comp=IoTAgent
time=2019-02-28T15:16:13.274Z | lvl=DEBUG | corr=e4633c8b-1db7-4207-b307-3e419f78223f | trans=e4633c8b-1db7-4207-b307-3e419f78223f | op=IoTAgentNGSI.NGSIService | srv=n/a | subsrv=n/a | msg=Value updated successfully | comp=IoTAgent
time=2019-02-28T15:16:13.274Z | lvl=DEBUG | corr=e4633c8b-1db7-4207-b307-3e419f78223f | trans=e4633c8b-1db7-4207-b307-3e419f78223f | op=IOTAgent.LWM2MHandlers | srv=n/a | subsrv=n/a | msg=Data handled successfully | comp=IoTAgent
time=2019-02-28T15:16:13.282Z | lvl=DEBUG | corr=c915945a-3b6b-11e9-b854-0242c0a85005 | trans=e822ce3a-f639-4257-8179-a40804eb1ba7 | op=IoTAgentNGSI.GenericMiddlewares | srv=smartgondor | subsrv=/gardens | msg=Request for path [/publish] from [lightweightm2m-iotagent:4041] | comp=IoTAgent
time=2019-02-28T15:16:13.282Z | lvl=DEBUG | corr=c915945a-3b6b-11e9-b854-0242c0a85005 | trans=e822ce3a-f639-4257-8179-a40804eb1ba7 | op=IoTAgentNGSI.GenericMiddlewares | srv=smartgondor | subsrv=/gardens | msg=Body:
{
    "subscriptionId": "5c77fb29a23ec2205a00b013",
    "data": [
        {
            "id": "Device:raspiSensorTV",
            "type": "Device",
            "Temperature Sensor#0": {
                "type": "string",
                "value": "�\u0016DA�\u0000\u0000",
                "metadata": {
                    "TimeInstant": {
                        "type": "ISO8601",
                        "value": "2019-02-28T15:16:13.261Z"
                    }
                }
            }
        }
    ]
}
 | comp=IoTAgent
time=2019-02-28T15:16:13.283Z | lvl=DEBUG | corr=c915945a-3b6b-11e9-b854-0242c0a85005 | trans=e822ce3a-f639-4257-8179-a40804eb1ba7 | op=IoTAgentNGSI.DomainControl | srv=smartgondor | subsrv=/gardens | msg=response-time: 4 | comp=IoTAgent

这种情况是在代理日志中报告的,而Orion日志则显示以下内容:

time=Thursday 28 Feb 15:16:13 2019.269Z | lvl=INFO | corr=c915945a-3b6b-11e9-b854-0242c0a85005 | trans=1551366811-541-00000000018 | from=192.168.80.4 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=logMsg.h[1844]:lmTransactionStart | msg=Starting transaction from 192.168.80.4:52068/v1/updateContext
time=Thursday 28 Feb 15:16:13 2019.269Z | lvl=INFO | corr=c915945a-3b6b-11e9-b854-0242c0a85005 | trans=1551366811-541-00000000018 | from=192.168.80.4 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=rest.cpp[885]:servicePathSplit | msg=Service Path 0: '/gardens'
time=Thursday 28 Feb 15:16:13 2019.271Z | lvl=INFO | corr=c915945a-3b6b-11e9-b854-0242c0a85005 | trans=1551366811-541-00000000018 | from=192.168.80.4 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=connectionOperations.cpp[94]:collectionQuery | msg=Database Operation Successful (query: { _id.id: "Device:raspiSensorTV", _id.type: "Device", _id.servicePath: { $in: [ /^/gardens$/ ] } })
time=Thursday 28 Feb 15:16:13 2019.272Z | lvl=INFO | corr=c915945a-3b6b-11e9-b854-0242c0a85005 | trans=1551366811-541-00000000018 | from=192.168.80.4 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=connectionOperations.cpp[449]:collectionUpdate | msg=Database Operation Successful (update: <{ _id.id: "Device:raspiSensorTV", _id.type: "Device", _id.servicePath: { $in: [ /^/gardens$/ ] } }, { $set: { attrs.Temperature Sensor#0: { value: "�DA�>)
time=Thursday 28 Feb 15:16:13 2019.273Z | lvl=INFO | corr=c915945a-3b6b-11e9-b854-0242c0a85005 | trans=1551366811-541-00000000019 | from=192.168.80.4 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=logMsg.h[1844]:lmTransactionStart | msg=Starting transaction to http://lightweightm2m-iotagent:4041/publish
time=Thursday 28 Feb 15:16:13 2019.273Z | lvl=INFO | corr=c915945a-3b6b-11e9-b854-0242c0a85005 | trans=1551366811-541-00000000018 | from=192.168.80.4 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=logMsg.h[1874]:lmTransactionEnd | msg=Transaction ended
time=Thursday 28 Feb 15:16:13 2019.274Z | lvl=INFO | corr=c915945a-3b6b-11e9-b854-0242c0a85005 | trans=1551366811-541-00000000019 | from=192.168.80.4 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=httpRequestSend.cpp[592]:httpRequestSendWithCurl | msg=Sending message 2 to HTTP server: sending message of 573 bytes to HTTP server
time=Thursday 28 Feb 15:16:13 2019.284Z | lvl=INFO | corr=c915945a-3b6b-11e9-b854-0242c0a85005 | trans=1551366811-541-00000000019 | from=192.168.80.4 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=httpRequestSend.cpp[612]:httpRequestSendWithCurl | msg=Notification Successfully Sent to http://lightweightm2m-iotagent:4041/publish
time=Thursday 28 Feb 15:16:13 2019.284Z | lvl=WARN | corr=c915945a-3b6b-11e9-b854-0242c0a85005 | trans=1551366811-541-00000000019 | from=192.168.80.4 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=httpRequestSend.cpp[625]:httpRequestSendWithCurl | msg=Notification response NOT OK, http code: 404
time=Thursday 28 Feb 15:16:13 2019.285Z | lvl=INFO | corr=c915945a-3b6b-11e9-b854-0242c0a85005 | trans=1551366811-541-00000000019 | from=192.168.80.4 | srv=smartgondor | subsrv=/gardens | comp=Orion | op=logMsg.h[1874]:lmTransactionEnd | msg=Transaction ended

我提交了以下IoTAgent-Orion订阅请求:

$curl -iX POST localhost:1026/v2/subscriptions -s -S --header 'Content-Type: application/json' \
    --header 'Accept: application/json' --header 'fiware-service: smartGondor' --header 'fiware-servicepath: /gardens' -d'
{
  "subject": {
    "entities": [
    {
        "idPattern": ".*",
        "type": "Device"
    }
    ],
    "condition": {
        "attrs": [ "Temperature Sensor#0" ]
    }
  },
  "notification": {
    "http": {
        "url": "http://lightweightm2m-iotagent:4041/publish"
    },
    "attrs": [ "Temperature Sensor#0" ]
  }
}'

1 个答案:

答案 0 :(得分:0)

幸运的是,尽管仍然出现此错误,它现在仍在工作。至少它正在运行,没有什么可担心的。