Is Orion compatible with AWS DocumentDB - fiware

I am trying to connect Orion with AWS DocumentDB but it's not getting connected. However I tried two other FIWARE components IoTAgent and Sth-Comet with DocumentDB and both are working fine.
Same hostname and credential are working for IoTAgent and Sth-Comet. I also checked for the connectivity, which is fine, as IoTAgent and Sth-Comet are in same network. I also checked from a different mongo host in same network and this also worked. Below is the error that I am getting for Orion.
time=2021-02-18T07:03:46.293Z | lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=mongoConnectionPool.cpp[180]:mongoConnect | msg=Database Startup Error (cannot connect to mongo - doing 100 retries with a 1000 millisecond interval)
Is there any possibility that Orion is not compatible with AWS DocumentDB?
Update1:
bash-4.2$ ps ax | grep contextBroker
1 ? Ss 0:00 /usr/bin/contextBroker -fg -multiservice -ngsiv1Autocast -disableFileLog -dbhost xxxxxxxxxxxxxxxxxx.docdb.amazonaws.com -db admin -dbuser test -dbpwd xxxxxxxxxx
Update2:
Earlier, I was using Orion docker images by pulling directly from dockerhub and that was not working. So this time, I build two docker images by building source code of version 2.4.2 and 2.5.2. Now, I was able to connect with AWS DocuemntDB with these docker images but getting a different error as below.
time=2021-02-23T06:10:41.982Z | lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=safeMongo.cpp[360]:getField | msg=Runtime Error (field '_id' is missing in BSONObj <{ ok: 0.0, code: 303, errmsg: "Legacy opcodes are not supported" }> from caller mongoSubCacheItemInsert:83)
time=2021-02-23T06:10:41.982Z | lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=AlarmManager.cpp[211]:dbError | msg=Raising alarm DatabaseError: error retrieving _id field in doc: '{ ok: 0.0, code: 303, errmsg: "Legacy opcodes are not supported" }'
Below is the Orion version
contextBroker --version
2.5.0-next (git version: 3984f9fc30e90fa04682131ca4516b4d277eb27e)
curl -X GET 'http://localhost:1026/version'
{
"orion" : {
"version" : "2.5.0-next",
"uptime" : "0 d, 0 h, 4 m, 56 s",
"git_hash" : "3984f9fc30e90fa04682131ca4516b4d277eb27e",
"compile_time" : "Mon Feb 22 17:39:30 UTC 2021",
"compiled_by" : "root",
"compiled_in" : "4c7575c7c27f",
"release_date" : "Mon Feb 22 17:39:30 UTC 2021",
"doc" : "https://fiware-orion.rtfd.io/",
"libversions": {
"boost": "1_53",
"libcurl": "libcurl/7.29.0 NSS/3.53.1 zlib/1.2.7 libidn/1.28 libssh2/1.8.0",
"libmicrohttpd": "0.9.70",
"openssl": "1.0.2k",
"rapidjson": "1.1.0",
"mongodriver": "legacy-1.1.2"
}
}
}
I am also able to connect to DocumentDB from Orion Pod using Mongo Shell.
mongo --host xxxxxxxxxxxxxxxxxx.docdb.amazonaws.com:27017 --username xxxx --password xxxx
rs0:PRIMARY> show dbs;
rs0:PRIMARY>
I am also able to create entries using below command and it creates a DB and collection in DocumentDB:
curl localhost:1026/v2/entities -s -S --header 'Content-Type: application/json' \
> -X POST -d #- <<EOF
> {
> "id": "Room2",
> "type": "Room",
> "temperature": {
> "value": 23,
> "type": "Number"
> },
> "pressure": {
> "value": 720,
> "type": "Number"
> }
> }
> EOF
rs0:PRIMARY> show dbs;
orion 0.000GB
But I am not able to get that data using orion API and after executing this command it getting exited from container with a empty response. I have checked the same with Orion version 2.4.2 and 2.5.2 with DocumentDB 4.0 and 3.6.
[root#orion-docdb-7748fd9c85-gbjz7 /]# curl localhost:1026/v2/entities/Room2 -s -S --header 'Accept: application/json' | python -mjson.tool
curl: (52) Empty reply from server
command terminated with exit code 137
At the end, still getting same error in logs.
time=2021-02-23T06:16:04.564Z | lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=safeMongo.cpp[360]:getField | msg=Runtime Error (field '_id' is missing in BSONObj <{ ok: 0.0, code: 303, errmsg: "Legacy opcodes are not supported" }> from caller mongoSubCacheItemInsert:83)
time=2021-02-23T06:16:04.564Z | lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=AlarmManager.cpp[211]:dbError | msg=Raising alarm DatabaseError: error retrieving _id field in doc: '{ ok: 0.0, code: 303, errmsg: "Legacy opcodes are not supported" }'
Update3:
I have added -noCache and deployed again. Below are the commands output and logs for your reference.
Process check:
#ps ax | grep contextBroker
1 ? Ssl 0:00 /usr/bin/contextBroker -fg -multiservice -ngsiv1Autocast -disableFileLog -dbhost xxxxxxxxxxxxxxxxxx.docdb.amazonaws.com -dbuser xxxxxxxx -dbpwd xxxxxxxx -logLevel DEBUG -noCache
Entries in DB:
rs0:PRIMARY> show dbs
orion 0.000GB
rs0:PRIMARY> use orion
switched to db orion
rs0:PRIMARY> show collections
entities
rs0:PRIMARY> db.entities.find()
{ "_id" : { "id" : "Room2", "type" : "Room", "servicePath" : "/" }, "attrNames" : [ "temperature", "pressure" ], "attrs" : { "temperature" : { "type" : "Number", "creDate" : 1614323032.671698, "modDate" : 1614323032.671698, "value" : 23, "mdNames" : [ ] }, "pressure" : { "type" : "Number", "creDate" : 1614323032.671698, "modDate" : 1614323032.671698, "value" : 720, "mdNames" : [ ] } }, "creDate" : 1614323032.671698, "modDate" : 1614323032.671698, "lastCorrelator" : "c8a73f40-7800-11eb-bd9b-bea9c419835d" }
Orion Pod Logs:
time=2021-02-26T06:46:33.966Z | lvl=INFO | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=contextBroker.cpp[1008]:main | msg=start command line </usr/bin/contextBroker -fg -multiservice -ngsiv1Autocast -disableFileLog -dbhost -dbhost xxxxxxxxxxxxxxxxxx.docdb.amazonaws.com -dbuser xxxxxxxx -dbpwd xxxxxxxx -logLevel DEBUG -noCache>
time=2021-02-26T06:46:33.966Z | lvl=INFO | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=contextBroker.cpp[1076]:main | msg=Orion Context Broker is running
time=2021-02-26T06:46:34.280Z | lvl=INFO | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=MongoGlobal.cpp[243]:mongoInit | msg=Connected to mongo at xxxxxxxxxxxxxxxxxx.docdb.amazonaws.com/orion, as user 'xxxxxxx' (poolsize: 10)
time=2021-02-26T06:46:34.282Z | lvl=INFO | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=contextBroker.cpp[1202]:main | msg=Startup completed
time=2021-02-26T07:03:24.546Z | lvl=INFO | corr=b7e44e5a-7800-11eb-9531-bea9c419835d | trans=1614321993-966-00000000001 | from=127.0.0.1 | srv=<none> | subsrv=<none> | comp=Orion | op=logTracing.cpp[79]:logInfoRequestWithoutPayload | msg=Request received: GET /version, response code: 200
time=2021-02-26T07:03:52.672Z | lvl=ERROR | corr=c8a73f40-7800-11eb-bd9b-bea9c419835d | trans=1614321993-966-00000000002 | from=127.0.0.1 | srv=<none> | subsrv=<none> | comp=Orion | op=safeMongo.cpp[360]:getField | msg=Runtime Error (field '_id' is missing in BSONObj <{ ok: 0.0, code: 303, errmsg: "Legacy opcodes are not supported", operationTime: Timestamp 1614323032|1 }> from caller processContextElement:3493)
time=2021-02-26T07:03:52.672Z | lvl=ERROR | corr=c8a73f40-7800-11eb-bd9b-bea9c419835d | trans=1614321993-966-00000000002 | from=127.0.0.1 | srv=<none> | subsrv=<none> | comp=Orion | op=AlarmManager.cpp[211]:dbError | msg=Raising alarm DatabaseError: error retrieving _id field in doc: '{ ok: 0.0, code: 303, errmsg: "Legacy opcodes are not supported", operationTime: Timestamp 1614323032|1 }'
time=2021-02-26T07:03:52.782Z | lvl=ERROR | corr=c8a73f40-7800-11eb-bd9b-bea9c419835d | trans=1614321993-966-00000000002 | from=127.0.0.1 | srv=<none> | subsrv=<none> | comp=Orion | op=AlarmManager.cpp[235]:dbErrorReset | msg=Releasing alarm DatabaseError
time=2021-02-26T07:03:52.790Z | lvl=ERROR | corr=c8a73f40-7800-11eb-bd9b-bea9c419835d | trans=1614321993-966-00000000002 | from=127.0.0.1 | srv=<none> | subsrv=<none> | comp=Orion | op=safeMongo.cpp[360]:getField | msg=Runtime Error (field '_id' is missing in BSONObj <{ ok: 0.0, code: 303, errmsg: "Legacy opcodes are not supported", operationTime: Timestamp 1614323032|1 }> from caller addTriggeredSubscriptions_noCache:1408)
time=2021-02-26T07:03:52.790Z | lvl=ERROR | corr=c8a73f40-7800-11eb-bd9b-bea9c419835d | trans=1614321993-966-00000000002 | from=127.0.0.1 | srv=<none> | subsrv=<none> | comp=Orion | op=AlarmManager.cpp[211]:dbError | msg=Raising alarm DatabaseError: error retrieving _id field in doc: '{ ok: 0.0, code: 303, errmsg: "Legacy opcodes are not supported", operationTime: Timestamp 1614323032|1 }'
time=2021-02-26T07:03:52.791Z | lvl=INFO | corr=c8a73f40-7800-11eb-bd9b-bea9c419835d | trans=1614321993-966-00000000002 | from=127.0.0.1 | srv=<none> | subsrv=<none> | comp=Orion | op=logTracing.cpp[130]:logInfoRequestWithPayload | msg=Request received: POST /v2/entities, request payload (148 bytes): { "id": "Room2", "type": "Room", "temperature": { "value": 23, "type": "Number" }, "pressure": { "value": 720, "type": "Number" }}, response code: 201
time=2021-02-26T07:03:58.479Z | lvl=ERROR | corr=cc1d5934-7800-11eb-a28d-bea9c419835d | trans=1614321993-966-00000000003 | from=127.0.0.1 | srv=<none> | subsrv=<none> | comp=Orion | op=AlarmManager.cpp[235]:dbErrorReset | msg=Releasing alarm DatabaseError
time=2021-02-26T07:03:58.479Z | lvl=ERROR | corr=cc1d5934-7800-11eb-a28d-bea9c419835d | trans=1614321993-966-00000000003 | from=127.0.0.1 | srv=<none> | subsrv=<none> | comp=Orion | op=safeMongo.cpp[360]:getField | msg=Runtime Error (field '_id' is missing in BSONObj <{ ok: 0.0, code: 303, errmsg: "Legacy opcodes are not supported", operationTime: Timestamp 1614323038|1 }> from caller ContextElementResponse:109)
terminate called after throwing an instance of 'mongo::AssertionException'
what(): assertion src/mongo/bson/bsonelement.cpp:392
Pod exited and restarted during API call:
curl localhost:1026/v2/entities/Room2 -s -S --header 'Accept: application/json' | python -mjson.tool
command terminated with exit code 137

The following message shown in log traces is pretty significant
"Legacy opcodes are not supported"
Although the MongoDB driver used by Orion 2.5.2 and before works with official MongoDB version up to 4.4, probably it is not the case with MongoDB "clones" like AWS DocumentDB.
We are in the process to change the legacy driver used by Orion to a new one. Once this change lands in Orion master branch, I'd suggest to test it (using :latest dockerhub tag). In the meanwhile, as a workaround, I'd suggest to use a official MongoDB database.
EDIT: the process to change the MongoDB driver has finished and Orion is using the new driver since version 3.0.0. I think it would be a good idea to test with this new version and see how it goes. I can help with the test if you provide me with the access information (see here).

Related

Agent Orion JSON MQTT

I have been able to send JSON format measures via MQTT publisher to the mosquitto docker container ( that is a broker ), also i have been able to pass that data to the IOT-Agent, these are curl commands that i used to create a service-path and to register a device on the IOT-Agent:
curl -iX POST 'http://localhost:4041/iot/services' -H 'Content-Type: application/json' -H 'Fiware-Service: myClassRoom' -H 'Fiware-ServicePath: /' -d '{ "services": [ { "apikey": "12345", "cbroker": "http://localhost:1026", "entity_type": "Device", "resource": /iot/d" } ] }
This is how i registered the device in the IOT-Agent:
curl -iX POST 'http://localhost:4041/iot/devices' -H 'Content-Type: application/json' -H 'Fiware-Service: myClassRoom' -H 'Fiware-ServicePath: /' -d '{ "devices": [ { "device_id": "SensTemp", "entity_name": "urn:ngsi-ld:temperature-sensor:001", "entity_type": "Device", "protocol": "PDI-IoTA-UltraLight", "transport": "MQTT", "timezone": "Europe/Madrid", "attributes":[ { "object_id": "temperature", "name": "temperature", "type": "Integer"} ] } ] }'
And this is the error that is giving me in the Agent, can someone help me to solve this issue?
fiware-agent | time=2022-07-25T08:19:11.562Z | lvl=FATAL | corr=n/a | trans=n/a | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=An unexpected exception has been raised. Ignoring: TypeError: parsedMessage.reduce is not a function
And here is the evidence of connecting, Service Path, information about the device etc...
fiware-agent | time=2022-07-25T08:20:11.931Z | lvl=DEBUG | corr=785bb065-6c0a-41ba-96d2-182f0040ea93 | trans=785bb065-6c0a-41ba-96d2-182f0040ea93 | op=IOTAUL.IoTUtils | from=n/a | srv=n/a | subsrv=n/a | msg=deviceData after merge with conf: {"_id":"62d931f861815b54e26fa2b2","active":[{"object_id":"temperature","name":"temperature","type":"Integer"}],"commands":[],"staticAttributes":[],"subscriptions":[],"creationDate":"2022-07-21T11:01:12.968Z","id":"SensTemp","type":"Device","name":"urn:ngsi-ld:temperature-sensor:001","service":"myclassroom","subservice":"/","internalId":null,"protocol":"PDI-IoTA-UltraLight","transport":"MQTT","explicitAttrs":false,"lazy":null,"internalAttributes":null} | comp=IoTAgent
And here is what i dont understand, why is giving me that error, parsed message error?
fiware-agent | time=2022-07-25T08:20:11.932Z | lvl=DEBUG | corr=785bb065-6c0a-41ba-96d2-182f0040ea93 | trans=785bb065-6c0a-41ba-96d2-182f0040ea93 | op=IOTAUL.Common.Binding | from=n/a | srv=n/a | subsrv=n/a | msg=Processing multiple measures for device [SensTemp] with apiKey [12345] | comp=IoTAgent
fiware-agent | time=2022-07-25T08:20:11.932Z | lvl=DEBUG | corr=785bb065-6c0a-41ba-96d2-182f0040ea93 | trans=785bb065-6c0a-41ba-96d2-182f0040ea93 | op=IOTAUL.Common.Binding | from=n/a | srv=n/a | subsrv=n/a | msg=Parse error parsing incoming message [%]. Forcing to hex string | comp=IoTAgent {"temperature": 47}
fiware-agent | time=2022-07-25T08:20:11.932Z | lvl=DEBUG | corr=785bb065-6c0a-41ba-96d2-182f0040ea93 | trans=785bb065-6c0a-41ba-96d2-182f0040ea93 | op=IOTAUL.Common.Binding | from=n/a | srv=n/a | subsrv=n/a | msg=stringMessage: [7b2274656d7065726174757265223a2034377d] parsedMessage: [7b2274656d7065726174757265223a2034377d] | comp=IoTAgent
And Why cant i see the Temperature change in the MongoDB depository?
Thank you !!!
Problem solved! The error was in the Agent, I was using Ultralight IOT Agent. The solution is simple, when i used IOT JSON agent the problem was solved!
Now the Agent tells me that the measures are updated successfully!

How to change values from writable basic Datatypes on an OPC UA Server with FIWARE OPC UA AGENT

GOAL
Change writable values on the OPC UA Server by using the Fiware OPC UA Agent.
My test implementation
Adding the NodeId "7:PLC1_7:G_Communication_7:fi_heartbeat_i" to the "command" and "contextSubscription" sections in the config.json file. The value data type of the NodeId is Int16, but because this value is supposed to be written, I assume that "command" must be used as the type. Unfortunately, more detailed information cannot be found in the manual fiware opcua agent.
Start a new test environment with OpcUa Agent, Orion Context broker and mongodb.
Expectet behavior
The value on the server is updated when a request is sent to the Context Broker.
Current behaviour
The value of the parameter is read out correctly but with an incorrect data type (string instead of integer).
The value of the parameter is not updated when a request is sent to the Orion Context Broker.
additional informations
config.json
{
"logLevel" : "DEBUG",
"contextBroker" : {
"host" : "orion",
"port" : 1026
},
"server" : {
"port" : 4001,
"baseRoot" : "/"
},
"deviceRegistry" : {
"type" : "memory"
},
"mongodb" : {
"host" : "iotmongo",
"port" : "27017",
"db" : "iotagent",
"retries" : 5,
"retryTime" : 5
},
"providerUrl" : "http://iotopcua:4001",
"pollingExpiration" : "200000",
"pollingDaemonFrequency" : "20000",
"deviceRegistrationDuration" : "P1M",
"defaultType" : null,
"browseServerOptions" : null,
"service" : "test",
"subservice" : "/test",
"types" : {
"g_communication" : {
"service" : "test",
"subservice" : "/test",
"active" : [{
"name" : "7:PLC1_7:G_Communication_7:fo_smartControllerActive_b",
"type" : "Boolean"
} ],
"lazy" : [ ],
"commands" : [{
"name" : "7:PLC1_7:G_Communication_7:fi_heartbeat_i",
"type" : "Command"
}]
}
},
"contexts" : [ {
"id" : "plant",
"type" : "g_communication",
"service" : "test",
"subservice" : "/test",
"polling" : null,
"mappings" : [{
"ocb_id" : "7:PLC1_7:G_Communication_7:fo_smartControllerActive_b",
"opcua_id" : "ns=7;s=G_Communication.fo_smartControllerActive_b",
"object_id" : null,
"inputArguments" : []
} ]
}],
"contextSubscriptions" : [{
"id" : "plant",
"type" : "g_communication",
"mappings" : [{
"ocb_id" : "7:PLC1_7:G_Communication_7:fi_heartbeat_i",
"opcua_id" : "ns=7;s=G_Communication.fi_heartbeat_i",
"object_id" : "ns=7;s=G_Communication",
"inputArguments" : [{
"type": "Number"
}]
}]
}]
}
List Entities
curl 'http://localhost:1026/v2/entities/plant/' -H 'fiware-service: test' -H 'fiwate-servicepath: /test' | python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 684 100 684 0 0 13751 0 --:--:-- --:--:-- --:--:-- 13959
{
"7:PLC1_7:G_Communication_7:fi_heartbeat_i": {
"metadata": {
"ServerTimestamp": {
"type": "ISO8601",
"value": "null"
},
"SourceTimestamp": {
"type": "ISO8601",
"value": "null"
}
},
"type": "string",
"value": "4"
},
"7:PLC1_7:G_Communication_7:fi_heartbeat_i_info": {
"metadata": {},
"type": "commandResult",
"value": " "
},
"7:PLC1_7:G_Communication_7:fi_heartbeat_i_status": {
"metadata": {},
"type": "commandStatus",
"value": "UNKNOWN"
},
"7:PLC1_7:G_Communication_7:fo_smartControllerActive_b": {
"metadata": {
"ServerTimestamp": {
"type": "ISO8601",
"value": "2021-05-04T07:38:01.150Z"
},
"SourceTimestamp": {
"type": "ISO8601",
"value": "2021-05-04T07:37:59.934Z"
}
},
"type": "Boolean",
"value": false
},
"id": "plant",
"type": "g_communication"
}
Registrations
curl 'http://localhost:1026/v2/registrations' -H 'fiware-service: test' -H 'fiwate-servicepath: /test' | python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 320 100 320 0 0 46049 0 --:--:-- --:--:-- --:--:-- 53333
[
{
"dataProvided": {
"attrs": [
"7:PLC1_7:G_Communication_7:fi_heartbeat_i"
],
"entities": [
{
"id": "plant",
"type": "g_communication"
}
]
},
"expires": "2021-06-03T07:37:38.00Z",
"id": "6090f9c254b918756abf1a7d",
"provider": {
"http": {
"url": "http://iotopcua:4001"
},
"legacyForwarding": true,
"supportedForwardingMode": "all"
},
"status": "active"
}
]
Test communication with iotopcua
curl "http://iotopcua:4001/version"
{"libVersion":"2.12.0-next","port":4001,"baseRoot":"/"}
Request for update
curl -X PUT \
'http://localhost:1026/v2/entities/plant/attrs/7:PLC1_7:G_Communication_7:fi_heartbeat_i?type=g_communication' \
-H 'content-type: application/json' \
-H 'fiware-service: test' \
-H 'fiware-servicepath: /test' \
-d '{
"value": 2
}'
Log OCB
from=0.0.0.0 | srv=test | subsrv=/test | comp=Orion | op=logMsg.h[1844]:lmTransactionStart | msg=Starting transaction from 0.0.0.0:54232/v2/entities/plant/attrs/7:PLC1_7:G_Communication_7:fi_heartbeat_i
from=0.0.0.0 | srv=test | subsrv=/test | comp=Orion | op=rest.cpp[874]:servicePathSplit | msg=Service Path 0: '/test'
from=0.0.0.0 | srv=test | subsrv=/test | comp=Orion | op=connectionOperations.cpp[244]:collectionCount | msg=Database Operation Successful (count: { _id.id: "plant", _id.type: "g_communication", _id.servicePath: "/test" })
from=0.0.0.0 | srv=test | subsrv=/test | comp=Orion | op=connectionOperations.cpp[94]:collectionQuery | msg=Database Operation Successful (query: { _id.id: "plant", _id.type: "g_communication", _id.servicePath: "/test" })
from=0.0.0.0 | srv=test | subsrv=/test | comp=Orion | op=connectionOperations.cpp[182]:collectionRangedQuery | msg=Database Operation Successful (query: { query: { $or: [ { contextRegistration.entities.id: "plant", contextRegistration.entities.type: "g_communication" }, { contextRegistration.entities.id: ".*", contextRegistration.entities.isPattern: "true", contextRegistration.entities.type: { $in: [ "g_communication" ] } }, { contextRegistration.entities.id: ".*", contextRegistration.entities.isPattern: "true", contextRegistration.entities.type: { $exists: false } } ], expiration: { $gt: 1620114947 }, contextRegistration.attrs.name: { $in: [ "7:PLC1_7:G_Communication_7:fi_heartbeat_i" ] }, servicePath: "/test" }, orderby: { _id: 1 } })
from=0.0.0.0 | srv=test | subsrv=/test | comp=Orion | op=logMsg.h[1844]:lmTransactionStart | msg=Starting transaction to http://iotopcua:4001//updateContext
from=0.0.0.0 | srv=test | subsrv=/test | comp=Orion | op=httpRequestSend.cpp[550]:httpRequestSendWithCurl | msg=Sending message 4 to HTTP server: sending message of 458 bytes to HTTP server
from=10.1.17.1 | srv=test | subsrv=/test | comp=Orion | op=logMsg.h[1844]:lmTransactionStart | msg=Starting transaction from 10.1.17.1:58162/v1/updateContext
from=10.1.17.1 | srv=test | subsrv=/test | comp=Orion | op=rest.cpp[874]:servicePathSplit | msg=Service Path 0: '/test'
from=10.1.17.1 | srv=test | subsrv=/test | comp=Orion | op=connectionOperations.cpp[94]:collectionQuery | msg=Database Operation Successful (query: { _id.id: "plant", _id.type: "g_communication", _id.servicePath: "/test" })
from=10.1.17.1 | srv=test | subsrv=/test | comp=Orion | op=connectionOperations.cpp[454]:collectionUpdate | msg=Database Operation Successful (update: <{ _id.id: "plant", _id.type: "g_communication", _id.servicePath: "/test" }, { $set: { attrs.7:PLC1_7:G_Communication_7:fi_heartbeat_i_status: { value: "PENDING", type: "commandStatus", mdNames: [], creDate: 1620113858, modDate: 1620114947 }, modDate: 1620114947, lastCorrelator: "2324ca1e-acae-11eb-a4f7-226cad26e2cc" }, $unset: { location: 1, expDate: 1 } }>)
from=10.1.17.1 | srv=test | subsrv=/test | comp=Orion | op=logMsg.h[1874]:lmTransactionEnd | msg=Transaction ended
from=0.0.0.0 | srv=test | subsrv=/test | comp=Orion | op=httpRequestSend.cpp[570]:httpRequestSendWithCurl | msg=Notification Successfully Sent to http://iotopcua:4001//updateContext
from=0.0.0.0 | srv=test | subsrv=/test | comp=Orion | op=httpRequestSend.cpp[579]:httpRequestSendWithCurl | msg=Notification response OK, http code: 200
from=0.0.0.0 | srv=test | subsrv=/test | comp=Orion | op=logMsg.h[1874]:lmTransactionEnd | msg=Transaction ended
Log OPCUA Client
time=2021-05-04T07:55:47.191Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.GenericMiddlewares | msg=Request for path [//updateContext] from [iotopcua:4001]
time=2021-05-04T07:55:47.191Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.GenericMiddlewares | msg=Body:
{
"contextElements": [
{
"type": "g_communication",
"isPattern": "false",
"id": "plant",
"attributes": [
{
"name": "7:PLC1_7:G_Communication_7:fi_heartbeat_i",
"type": "Number",
"value": 2
}
]
}
],
"updateAction": "UPDATE"
}
time=2021-05-04T07:55:47.193Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.ContextServer | msg=Handling update from [iotopcua:4001]
time=2021-05-04T07:55:47.193Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.ContextServer | msg=[object Object]
time=2021-05-04T07:55:47.194Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.InMemoryGroupRegister | msg=Looking for device params ["service","subservice","type"]
time=2021-05-04T07:55:47.194Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.DeviceService | msg=deviceData after merge with conf: {"id":"plant","name":"plant","type":"g_communication","active":[{"name":"7:PLC1_7:G_Communication_7:fo_smartControllerActive_b","type":"Boolean","object_id":"7:PLC1_7:G_Communication_7:fo_smartControllerActive_b"}],"service":"test","subservice":"/test","polling":null,"endpoint":"opc.tcp://109.68.106.155:48050","registrationId":"6090f9c254b918756abf1a7d","creationDate":1620113858802}
time=2021-05-04T07:55:47.194Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.DeviceService | msg=deviceData before merge with conf: {"id":"plant","name":"plant","type":"g_communication","active":[{"name":"7:PLC1_7:G_Communication_7:fo_smartControllerActive_b","type":"Boolean","object_id":"7:PLC1_7:G_Communication_7:fo_smartControllerActive_b"}],"lazy":[],"commands":[{"name":"7:PLC1_7:G_Communication_7:fi_heartbeat_i","type":"Command","object_id":"7:PLC1_7:G_Communication_7:fi_heartbeat_i"}],"service":"test","subservice":"/test","polling":null,"endpoint":"opc.tcp://109.68.106.155:48050","registrationId":"6090f9c254b918756abf1a7d","creationDate":1620113858802,"internalAttributes":null,"staticAttributes":[],"subscriptions":[]}
time=2021-05-04T07:55:47.195Z | lvl=INFO | corr=n/a | trans=n/a | op=Index.CommandContextHandler | comp=iotAgent-OPCUA | srv=test | subsrv=/test | msg=method to call =[{"objectId":"ns=7;s=G_Communication","methodId":"ns=7;s=G_Communication.fi_heartbeat_i","inputArguments":[{"type":"Number"}]}]
time=2021-05-04T07:55:47.879Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.NGSIService | msg=executeWithDeviceInfo entityName plant type undefined apikey undefined attributes [{"name":"7:PLC1_7:G_Communication_7:fi_heartbeat_i_status","type":"commandStatus","value":"PENDING"}] deviceInformation {"id":"plant","name":"plant","type":"g_communication","active":[{"name":"7:PLC1_7:G_Communication_7:fo_smartControllerActive_b","type":"Boolean","object_id":"7:PLC1_7:G_Communication_7:fo_smartControllerActive_b"}],"lazy":[],"commands":[{"name":"7:PLC1_7:G_Communication_7:fi_heartbeat_i","type":"Command","object_id":"7:PLC1_7:G_Communication_7:fi_heartbeat_i"}],"service":"test","subservice":"/test","polling":null,"endpoint":"opc.tcp://109.68.106.155:48050","registrationId":"6090f9c254b918756abf1a7d","creationDate":1620113858802,"internalAttributes":null,"staticAttributes":[],"subscriptions":[]}
time=2021-05-04T07:55:47.879Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.NGSIService | msg=error {"name":"DEVICE_GROUP_NOT_FOUND","message":"Couldn\t find device group","code":404} in get group device
time=2021-05-04T07:55:47.880Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.NGSIService | msg=typeInformation {"id":"plant","name":"plant","type":"g_communication","active":[{"name":"7:PLC1_7:G_Communication_7:fo_smartControllerActive_b","type":"Boolean","object_id":"7:PLC1_7:G_Communication_7:fo_smartControllerActive_b"}],"lazy":[],"commands":[{"name":"7:PLC1_7:G_Communication_7:fi_heartbeat_i","type":"Command","object_id":"7:PLC1_7:G_Communication_7:fi_heartbeat_i"}],"service":"test","subservice":"/test","polling":null,"endpoint":"opc.tcp://109.68.106.155:48050","registrationId":"6090f9c254b918756abf1a7d","creationDate":1620113858802,"internalAttributes":null,"staticAttributes":[],"subscriptions":[]}
time=2021-05-04T07:55:47.880Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.NGSIService | msg=Updating device value in the Context Broker at [http://orion:1026/v1/updateContext]
time=2021-05-04T07:55:47.880Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.NGSIService | msg=Using the following request:
{
"url": "http://orion:1026/v1/updateContext",
"method": "POST",
"headers": {
"fiware-service": "test",
"fiware-servicepath": "/test"
},
"json": {
"contextElements": [
{
"type": "g_communication",
"isPattern": "false",
"id": "plant",
"attributes": [
{
"name": "7:PLC1_7:G_Communication_7:fi_heartbeat_i_status",
"type": "commandStatus",
"value": "PENDING"
}
]
}
],
"updateAction": "UPDATE"
}
}
time=2021-05-04T07:55:47.886Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.NGSIService | msg=Received the following request from the CB:
{
"contextResponses": [
{
"contextElement": {
"type": "g_communication",
"isPattern": "false",
"id": "plant",
"attributes": [
{
"name": "7:PLC1_7:G_Communication_7:fi_heartbeat_i_status",
"type": "commandStatus",
"value": ""
}
]
},
"statusCode": {
"code": "200",
"reasonPhrase": "OK"
}
}
]
}
time=2021-05-04T07:55:47.886Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.NGSIService | msg=Value updated successfully
time=2021-05-04T07:55:47.886Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.ContextServer | msg=Update action from [iotopcua:4001] handled successfully.
time=2021-05-04T07:55:47.886Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.ContextServer | msg=Generated update response: {"contextResponses":[{"contextElement":{"attributes":[{"name":"7:PLC1_7:G_Communication_7:fi_heartbeat_i","type":"Number","value":""}],"id":"plant","isPattern":false,"type":"g_communication"},"statusCode":{"code":200,"reasonPhrase":"OK"}}]}
time=2021-05-04T07:55:47.887Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.DomainControl | msg=response-time: 697
as far as i can tell, i think the error resides in your contextSubscription snippet inside your config.json which should look like :
"contextSubscriptions": [{
"id": "plant",
"type": "g_communication",
"service": "test",
"subservice": "/test",
"mappings": [{
"ocb_id": "7:PLC1_7:G_Communication_7:fi_heartbeat_i",
"opcua_id": "ns=7;s=G_Communication.fi_heartbeat_i",
"object_id": "ns=7;s=G_Communication",
"inputArguments": [{
"dataType": 4,
"type": "Intensity"
}]
}]
}]
Could you please give it a try?

Perseo front end is showing this errors in the logs: msg=missing subservice header msg=missing service header

Using perseo cep, I set a rule to it. I get this message in the Perseo fron End's Log: http://perseo-core:8080/perseo-core/rules returns {"code":200,"body":{}}. Then when I modify an attribute, in the Perseo Core's Log I see this message: msg=Firing Rule: MapEventBean. So far, so good, but then again in the Perseo FE's log I get the message: msg=missing subservice header msg=missing service header, and it is not updating my entity.
This is the log:
time=2019-05-11T14:30:48.774Z | lvl=INFO | corr=n/a | trans=n/a | op=checkRequest | comp=perseo-fe | srv=n/a | subsrv=n/a | msg=missing subservice header
time=2019-05-11T14:30:48.774Z | lvl=INFO | corr=n/a | trans=n/a | op=checkRequest | comp=perseo-fe | srv=n/a | subsrv=n/a | msg=missing service header
time=2019-05-11T14:30:48.774Z | lvl=INFO | corr=5229c32c-362a-43f6-acda-11d6d8198261; perseocep=21 | trans=5229c32c-362a-43f6-acda-11d6d8198261 | op=/version | path=/version | comp=perseo-fe | srv=unknownt | subsrv=/ | from=::1 | msg=incoming request {"method":"GET","url":"/version","headers":{"host":"localhost:9090","user-agent":"curl/7.52.1","accept":"/"},"body":{},"subservice":"/","service":"unknownt"}
time=2019-05-11T14:30:48.774Z | lvl=INFO | corr=5229c32c-362a-43f6-acda-11d6d8198261; perseocep=21 | trans=5229c32c-362a-43f6-acda-11d6d8198261 | op=/version | path=/version | comp=perseo-fe | srv=unknownt | subsrv=/ | from=::1 | msg=sending
Mi Rule:
{
"name": "pruebaUpdate",
"text": "select ev.temperature? as temperature, ev.id? as id, \"pruebaUpdate\" as ruleName from pattern [every ev=iotEvent(cast(cast(temperature?,String),float) > 45 and type=\"AirQualityObserved\")]",
"action": [{
"type": "update",
"parameters": {
"id":"${id}",
"type":"AirQualityObserved",
"version": "2",
"attributes":[
{
"name": "abnormal",
"type": "boolean",
"value": "true"
}
]
}
}]
}
I want to update one attribute when other attribute is higher than a value, that attribute is in some entities but not in other of the same type. I am not getting to update that attribute.
msg=missing subservice header, msg=missing service header typically mean that the incoming request doesn't have the fiware-service and fiware-servicepath HTTP headers in which multitenancy is based. The FIWARE multitenancy model is described here.
Placing the rule in the correct place I didn't get the error of "missing service subservice". I registered the rule with http://perseo-fe-ip:9090/rules and I fixed the problems.

how to provision a datastore in ckan for connecting cygnus in column persistance mode?

I am having the same problem as here and try to solve it, but I do not know how to properly format the datastore so cygnus will not throw the persistence error.
My orion suscription is this one:
(curl localhost:1026/v1/subscribeContext -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' -d #- | python -mjson.tool) <<EOF
{
"entities": [
{
"type": "Event",
"isPattern": "false",
"id": "es-leon-0"
},
{
"type": "Event",
"isPattern": "false",
"id": "es-leon-1"
}
],
"attributes": [
"IdEvent", "IdUser", "Title"
],
"reference": "http://localhost:5050/notify",
"duration": "P1M",
"notifyConditions": [
{
"type": "ONCHANGE",
"condValues": [ ]
}
],
"throttling": "PT5S"
}
EOF
My cygnus config:
ygnusagent.sources = http-source
cygnusagent.sinks = ckan-sink
cygnusagent.channels = ckan-channel
cygnusagent.sources.http-source.channels = ckan-channel
cygnusagent.sources.http-source.type = org.apache.flume.source.http.HTTPSource
cygnusagent.sources.http-source.port = 5050
cygnusagent.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.OrionRestHandler
cygnusagent.sources.http-source.handler.notification_target = /notify
cygnusagent.sources.http-source.handler.default_service = Papel
cygnusagent.sources.http-source.handler.default_service_path = Test
cygnusagent.sources.http-source.handler.events_ttl = 5
cygnusagent.sources.http-source.interceptors = ts gi
cygnusagent.sources.http-source.interceptors.ts.type = timestamp
cygnusagent.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.GroupingInterceptor$Builder
cygnusagent.sources.http-source.interceptors.gi.gropuing_rules_conf_file = /Applications/apache-flume-1.4.0-bin/conf/grouping_rules.conf
cygnusagent.channels.ckan-channel.type = memory
cygnusagent.channels.ckan-channel.capacity = 1000
cygnusagent.channels.ckan-channel.transactionCapacity = 100
# ============================================
# OrionCKANSink configuration
# channel name from where to read notification events
cygnusagent.sinks.ckan-sink.channel = ckan-channel
# sink class, must not be changed
cygnusagent.sinks.ckan-sink.type = com.telefonica.iot.cygnus.sinks.OrionCKANSink
# true if the grouping feature is enabled for this sink, false otherwise
cygnusagent.sinks.ckan-sink.enable_grouping = false
# true if lower case is wanted to forced in all the element names, false otherwise
cygnusagent.sinks.hdfs-sink.enable_lowercase = false
# the CKAN API key to use
cygnusagent.sinks.ckan-sink.api_key = xxxxx
# the FQDN/IP address for the CKAN API endpoint
cygnusagent.sinks.ckan-sink.ckan_host = ckan-demo.ckan.io
# the port for the CKAN API endpoint
cygnusagent.sinks.ckan-sink.ckan_port = 80
# Orion URL used to compose the resource URL with the convenience operation URL to query it
cygnusagent.sinks.ckan-sink.orion_url = http://localhost:1026
# how the attributes are stored, either per row either per column (row, column)
cygnusagent.sinks.ckan-sink.attr_persistence = column
# enable SSL for secure Http transportation; 'true' or 'false'
cygnusagent.sinks.ckan-sink.ssl = false
# number of notifications to be included within a processing batch
cygnusagent.sinks.ckan-sink.batch_size = 100
# timeout for batch accumulation
cygnusagent.sinks.ckan-sink.batch_timeout = 60
# number of retries upon persistence error
cygnusagent.sinks.ckan-sink.batch_ttl = 10
Cygnus is receiving right it but then shows the following error:
time=2016-04-21T07:44:57.504CDT | lvl=INFO | trans=1461242686-614-0000000001 | srv=Papel | subsrv=Test | function=getEvents | comp=Cygnus | msg=com.telefonica.iot.cygnus.handlers.OrionRestHandler[231] : Starting transaction (1461242686-614-0000000001)
time=2016-04-21T07:44:57.528CDT | lvl=INFO | trans=1461242686-614-0000000001 | srv=Papel | subsrv=Test | function=getEvents | comp=Cygnus | msg=com.telefonica.iot.cygnus.handlers.OrionRestHandler[258] : Received data ({ "subscriptionId" : "571897360e94f9fa53829885", "originator" : "localhost", "contextResponses" : [ { "contextElement" : { "type" : "Event", "isPattern" : "false", "id" : "es-leon-0", "attributes" : [ { "name" : "IdEvent", "type" : "text", "value" : "1084" }, { "name" : "IdUser", "type" : "text", "value" : "18" }, { "name" : "Title", "type" : "text", "value" : "Papes" } ] }, "statusCode" : { "code" : "200", "reasonPhrase" : "OK" } } ]})
time=2016-04-21T07:44:57.528CDT | lvl=INFO | trans=1461242686-614-0000000001 | srv=Papel | subsrv=Test | function=getEvents | comp=Cygnus | msg=com.telefonica.iot.cygnus.handlers.OrionRestHandler[280] : Event put in the channel, id=2024732986
time=2016-04-21T07:45:50.771CDT | lvl=INFO | trans=1461242686-614-0000000001 | srv=Papel | subsrv=Test | function=persistAggregation | comp=Cygnus | msg=com.telefonica.iot.cygnus.sinks.OrionCKANSink[417] : [ckan-sink] Persisting data at OrionCKANSink (orgName=papel, pkgName=papel_test, resName=es-leon-0_event, data={"recvTime": "2016-04-21T12:44:57.497Z","fiwareServicePath": "Test","entityId": "es-leon-0","entityType": "Event","Title": "Papes"},{"recvTime": "2016-04-21T12:44:57.528Z","fiwareServicePath": "Test","entityId": "es-leon-0","entityType": "Event","IdEvent": "1084","IdUser": "18","Title": "Papes"})
time=2016-04-21T07:45:51.875CDT | lvl=ERROR | trans=1461242686-614-0000000001 | srv=Papel | subsrv=Test | function=processNewBatches | comp=Cygnus | msg=com.telefonica.iot.cygnus.sinks.OrionSink[426] : Runtime error (Cannot persist the data (orgName=papel, pkgName=papel_test, resName=es-leon-0_event))
As said in here, I created the corresponding datastore: http://ckan-demo.ckan.io/dataset/papel-test/resource/8d7cb489-878e-465e-8c8c-60ea537411e0
But don't know how to format it or if the csv is the correct format.
Thanks
*Note: I tried in row mode and all works, but it's not what I want.
**Note: I also found an error in the previewer software changing the title of my column "Title" to the title of the page "CKAN Demo".
EDITED:
I have done what is said in the documentation:
Column: A single row is upserted for all the notified context attributes. This kind of row will contain two fields per each entity's attribute (one for the value, called <attrName>, and other for the metadata, called <attrName>_md), plus four additional fields:
recvTime: UTC timestamp in human-redable format (ISO 8601).
fiwareServicePath: The notified one or the default one.
entityId: Notified entity identifier.
entityType: Notified entity type.
But still have the same error:
time=2016-04-25T05:17:48.790CDT | lvl=ERROR | trans=1461579403-571-0000000000 | srv=Papel | subsrv=Test | function=processNewBatches | comp=Cygnus | msg=com.telefonica.iot.cygnus.sinks.OrionSink[426] : Runtime error (Cannot persist the data (orgName=papel, pkgName=papel_test, resName=es-leon-0_event))
First of all, you'll need a CKAN organization and package/dataset before creating a resource and an associated datastore in order to persist the data.
Creating an organization, let's say in demo.ckan.org; the organization name is frb, because our entity will be in that FIWARE service:
$ curl -X POST "http://demo.ckan.org/api/3/action/organization_create" -d '{"name":"frb"}' -H "Authorization: xxxxxxxx"
Creating a package/dataset within the above organization; the package name is frb_test, because our entity will be in the FIWARE service frb and in the FIWARE service path test:
$ curl -X POST "http://demo.ckan.org/api/3/action/package_create" -d '{"name":"frb_test","owner_org":"frb"}' -H "Authorization: xxxxxxxx"
Creating a resource within the above package/dataset (the package ID is given in the response to the above package creation request); the name of the resource is room1_room because the entity ID will be room1 and its type room:
$ curl -X POST "http://demo.ckan.org/api/3/action/resource_create" -d '{"name":"room1_room","url":"none","format":"","package_id":"d35fca28-732f-4096-8376-944563f175ba"}' -H "Authorization: xxxxxxxx"
Finally, and answering to your question, creating a datastore associated to the above resource and suitable for receiving Cgynus data in column mode (the resource ID is given in the response to the above resource creation request):
$ curl -X POST "http://demo.ckan.org/api/3/action/datastore_create" -d '{"fields":[{"id":"recvTime","type":"text"}, {"id":"fiwareServicePath","type":"text"}, {"id":"entityId","type":"text"}, {"id":"entityType","type":"text"}, {"id":"temperature","type":"float"}, {"id":"temperature_md","type":"json"}],"resource_id":"48c120df-5bcd-48c7-81fa-8ecf4e4ef9d7","force":"true"}' -H "Authorization: xxxxxxxx"
Now, Cygnus is able to persist data for an entity with ID room1 of type room in the frb service, test service path:
time=2016-04-26T15:54:45.753CEST | lvl=INFO | corr=b465ffb8-710f-4cd3-9573-dc3799f774f9 | trans=b465ffb8-710f-4cd3-9573-dc3799f774f9 | svc=frb | subsvc=/test | function=getEvents | comp=cygnusagent | msg=com.telefonica.iot.cygnus.handlers.NGSIRestHandler[240] : Starting internal transaction (b465ffb8-710f-4cd3-9573-dc3799f774f9)
time=2016-04-26T15:54:45.754CEST | lvl=INFO | corr=b465ffb8-710f-4cd3-9573-dc3799f774f9 | trans=b465ffb8-710f-4cd3-9573-dc3799f774f9 | svc=frb | subsvc=/test | function=getEvents | comp=cygnusagent | msg=com.telefonica.iot.cygnus.handlers.NGSIRestHandler[256] : Received data ({ "subscriptionId" : "51c0ac9ed714fb3b37d7d5a8", "originator" : "localhost", "contextResponses" : [ { "contextElement" : { "attributes" : [ { "name" : "temperature", "type" : "centigrade", "value" : "26.5" } ], "type" : "room", "isPattern" : "false", "id" : "room1" }, "statusCode" : { "code" : "200", "reasonPhrase" : "OK" } } ]})
time=2016-04-26T15:55:07.843CEST | lvl=INFO | corr=b465ffb8-710f-4cd3-9573-dc3799f774f9 | trans=b465ffb8-710f-4cd3-9573-dc3799f774f9 | svc=frb | subsvc=/test | function=processNewBatches | comp=cygnusagent | msg=com.telefonica.iot.cygnus.sinks.NGSISink[342] : Batch accumulation time reached, the batch will be processed as it is
time=2016-04-26T15:55:07.844CEST | lvl=INFO | corr=b465ffb8-710f-4cd3-9573-dc3799f774f9 | trans=b465ffb8-710f-4cd3-9573-dc3799f774f9 | svc=frb | subsvc=/test | function=processNewBatches | comp=cygnusagent | msg=com.telefonica.iot.cygnus.sinks.NGSISink[396] : Batch completed, persisting it
time=2016-04-26T15:55:07.846CEST | lvl=INFO | corr=b465ffb8-710f-4cd3-9573-dc3799f774f9 | trans=b465ffb8-710f-4cd3-9573-dc3799f774f9 | svc=frb | subsvc=/test | function=persistAggregation | comp=cygnusagent | msg=com.telefonica.iot.cygnus.sinks.NGSICKANSink[419] : [ckan-sink] Persisting data at OrionCKANSink (orgName=frb, pkgName=frb_test, resName=room1_room, data={"recvTime": "2016-04-26T13:54:45.756Z","fiwareServicePath": "/test","entityId": "room1","entityType": "room","temperature": "26.5"})
time=2016-04-26T15:55:08.948CEST | lvl=INFO | corr=b465ffb8-710f-4cd3-9573-dc3799f774f9 | trans=b465ffb8-710f-4cd3-9573-dc3799f774f9 | svc=frb | subsvc=/test | function=processNewBatches | comp=cygnusagent | msg=com.telefonica.iot.cygnus.sinks.NGSISink[400] : Finishing internal transaction (b465ffb8-710f-4cd3-9573-dc3799f774f9)
The insertion can be checked through the CKAN API as well:
$ curl -X POST "http://demo.ckan.org/api/3/action/datastore_search" -d '{"resource_id":"48c120df-5bcd-48c7-81fa-8ecf4e4ef9d7"}' -H "Authorization: xxxxxxxx"

Warning on Cygnus avoids data persistence on Cosmos

This is a cygnus agent log:
16 Sep 2015 12:30:19,820 INFO [521330370#qtp-1739580287-1] (com.telefonica.iot.cygnus.handlers.OrionRestHandler.getEvents:236) - Received data (<notifyContextRequest><subscriptionId>55f932e6c06c4173451bbe1c</subscriptionId><originator>localhost</originator>...<contextAttribute><name>utctime</name><type>string</type><contextValue>2015-9-16 9:37:52</contextValue></contextAttribute></contextAttributeList></contextElement><statusCode><code>200</code><reasonPhrase>OK</reasonPhrase></statusCode></contextElementResponse></contextResponseList></notifyContextRequest>)
16 Sep 2015 12:30:19,820 INFO [521330370#qtp-1739580287-1] (com.telefonica.iot.cygnus.handlers.OrionRestHandler.getEvents:258) - Event put in the channel (id=1145647744, ttl=0)
16 Sep 2015 12:30:19,820 WARN [SinkRunner-PollingRunner-DefaultSinkProcessor] (com.telefonica.iot.cygnus.sinks.OrionSink.process:184) -
16 Sep 2015 12:30:19,820 INFO [SinkRunner-PollingRunner-DefaultSinkProcessor] (com.telefonica.iot.cygnus.sinks.OrionSink.process:193) - Finishing transaction (1442395508-572-0000013907)
We conserve the same configuration than this question:
Fiware Cygnus Error.
Although the Cygnus agent receives data correctly from the Context Broker suscription, Cosmos doesn't receive any data.
Thanks in advance, again :)
Independentely of the reason that leaded you to comment the grouing rules part (nevertheless, I think it was because my own wrong advice at https://jira.fiware.org/browse/HELC-986 :)), that part cannot be commented and must be added to the configuration:
# Source interceptors, do not change
cygnusagent.sources.http-source.interceptors = ts gi
# TimestampInterceptor, do not change
cygnusagent.sources.http-source.interceptors.ts.type = timestamp
# GroupinInterceptor, do not change
cygnusagent.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.GroupingInterceptor$Builder
# Grouping rules for the GroupingInterceptor, put the right absolute path to the file if necessary
# See the doc/design/interceptors document for more details
cygnusagent.sources.http-source.interceptors.gi.grouping_rules_conf_file = /usr/cygnus/conf/grouping_rules.conf
Once added that part, most probably another problem will arise: the performance of Cygnus will be very poor (that was the reason I wrongly adviced the user at https://jira.fiware.org/browse/HELC-986 to comment the grouping feature, in an attempt to increase the performance by removing processing steps). The reason is the latest version of Cygnus (0.8.2) is not ready to deal with the HiveServer2 running in the Cosmos side (this server was recently upgraded from old HiveServer1 to HiveServer2) and each persistence operation delays for a lot. For instance:
time=2015-09-21T12:42:30.405CEST | lvl=INFO | trans=1442832138-143-0000000000 | function=getEvents | comp=Cygnus | msg=com.telefonica.iot.cygnus.handlers.OrionRestHandler[150] : Starting transaction (1442832138-143-0000000000)
time=2015-09-21T12:42:30.407CEST | lvl=INFO | trans=1442832138-143-0000000000 | function=getEvents | comp=Cygnus | msg=com.telefonica.iot.cygnus.handlers.OrionRestHandler[236] : Received data ({ "subscriptionId" : "51c0ac9ed714fb3b37d7d5a8", "originator" : "localhost", "contextResponses" : [ { "contextElement" : { "attributes" : [ { "name" : "temperature", "type" : "centigrade", "value" : "26.5" } ], "type" : "Room", "isPattern" : "false", "id" : "Room1" }, "statusCode" : { "code" : "200", "reasonPhrase" : "OK" } } ]})
time=2015-09-21T12:42:30.409CEST | lvl=INFO | trans=1442832138-143-0000000000 | function=getEvents | comp=Cygnus | msg=com.telefonica.iot.cygnus.handlers.OrionRestHandler[258] : Event put in the channel (id=1966649489, ttl=10)
time=2015-09-21T12:42:30.462CEST | lvl=INFO | trans=1442832138-143-0000000000 | function=process | comp=Cygnus | msg=com.telefonica.iot.cygnus.sinks.OrionSink[128] : Event got from the channel (id=1966649489, headers={fiware-servicepath=rooms, destination=other_rooms, content-type=application/json, fiware-service=deleteme2, ttl=10, transactionId=1442832138-143-0000000000, timestamp=1442832150410}, bodyLength=460)
time=2015-09-21T12:42:30.847CEST | lvl=INFO | trans=1442832138-143-0000000000 | function=persist | comp=Cygnus | msg=com.telefonica.iot.cygnus.sinks.OrionHDFSSink[330] : [hdfs-sink] Persisting data at OrionHDFSSink. HDFS file (deleteme2/rooms/other_rooms/other_rooms.txt), Data ({"recvTimeTs":"1442832150","recvTime":"2015-09-21T10:42:30.410Z","entityId":"Room1","entityType":"Room","attrName":"temperature","attrType":"centigrade","attrValue":"26.5","attrMd":[]})
time=2015-09-21T12:42:31.529CEST | lvl=INFO | trans=1442832138-143-0000000000 | function=provisionHiveTable | comp=Cygnus | msg=com.telefonica.iot.cygnus.backends.hdfs.HDFSBackendImpl[185] : Creating Hive external table=frb_deleteme2_rooms_other_rooms_row
(a big timeout)
A workaround is to configure as hive_host an unreachable IP address such as fake.cosmos.lab.fiware.org:
time=2015-09-21T12:44:58.278CEST | lvl=INFO | trans=1442832280-746-0000000001 | function=getEvents | comp=Cygnus | msg=com.telefonica.iot.cygnus.handlers.OrionRestHandler[150] : Starting transaction (1442832280-746-0000000001)
time=2015-09-21T12:44:58.280CEST | lvl=INFO | trans=1442832280-746-0000000001 | function=getEvents | comp=Cygnus | msg=com.telefonica.iot.cygnus.handlers.OrionRestHandler[236] : Received data ({ "subscriptionId" : "51c0ac9ed714fb3b37d7d5a8", "originator" : "localhost", "contextResponses" : [ { "contextElement" : { "attributes" : [ { "name" : "temperature", "type" : "centigrade", "value" : "26.5" } ], "type" : "Room", "isPattern" : "false", "id" : "Room1" }, "statusCode" : { "code" : "200", "reasonPhrase" : "OK" } } ]})
time=2015-09-21T12:44:58.280CEST | lvl=INFO | trans=1442832280-746-0000000001 | function=getEvents | comp=Cygnus | msg=com.telefonica.iot.cygnus.handlers.OrionRestHandler[258] : Event put in the channel (id=1640732993, ttl=10)
time=2015-09-21T12:44:58.283CEST | lvl=INFO | trans=1442832280-746-0000000001 | function=process | comp=Cygnus | msg=com.telefonica.iot.cygnus.sinks.OrionSink[128] : Event got from the channel (id=1640732993, headers={fiware-servicepath=rooms, destination=other_rooms, content-type=application/json, fiware-service=deleteme3, ttl=10, transactionId=1442832280-746-0000000001, timestamp=1442832298280}, bodyLength=460)
time=2015-09-21T12:44:58.527CEST | lvl=INFO | trans=1442832280-746-0000000001 | function=persist | comp=Cygnus | msg=com.telefonica.iot.cygnus.sinks.OrionHDFSSink[330] : [hdfs-sink] Persisting data at OrionHDFSSink. HDFS file (deleteme3/rooms/other_rooms/other_rooms.txt), Data ({"recvTimeTs":"1442832298","recvTime":"2015-09-21T10:44:58.280Z","entityId":"Room1","entityType":"Room","attrName":"temperature","attrType":"centigrade","attrValue":"26.5","attrMd":[]})
time=2015-09-21T12:44:59.148CEST | lvl=INFO | trans=1442832280-746-0000000001 | function=provisionHiveTable | comp=Cygnus | msg=com.telefonica.iot.cygnus.backends.hdfs.HDFSBackendImpl[185] : Creating Hive external table=frb_deleteme3_rooms_other_rooms_row
time=2015-09-21T12:44:59.304CEST | lvl=ERROR | trans=1442832280-746-0000000001 | function=doCreateTable | comp=Cygnus | msg=com.telefonica.iot.cygnus.backends.hive.HiveBackend[77] : Runtime error (The Hive table cannot be created. Hive query='create external table frb_deleteme3_rooms_other_rooms_row (recvTimeTs bigint, recvTime string, entityId string, entityType string, attrName string, attrType string, attrValue string, attrMd array<string>) row format serde 'org.openx.data.jsonserde.JsonSerDe' location '/user/frb/deleteme3/rooms/other_rooms''. Details=Could not establish connection to fake.cosmos.lab.fiware.org:10000/default?user=frb&password=llBl3dQsMhX2sEPtPuf3izUGS92RZo: java.net.UnknownHostException: fake.cosmos.lab.fiware.org)
time=2015-09-21T12:44:59.305CEST | lvl=WARN | trans=1442832280-746-0000000001 | function=provisionHiveTable | comp=Cygnus | msg=com.telefonica.iot.cygnus.backends.hdfs.HDFSBackendImpl[210] : The HiveQL external table could not be created, but Cygnus can continue working... Check your Hive/Shark installation
time=2015-09-21T12:44:59.305CEST | lvl=INFO | trans=1442832280-746-0000000001 | function=process | comp=Cygnus | msg=com.telefonica.iot.cygnus.sinks.OrionSink[193] : Finishing transaction (1442832280-746-0000000001)
This will allow Cygnus to continue, despite the Hive tables are not automatically created, a minor problem (anyway, they would have never been created because of the current incompatibility with HiveServer2). Of course, this will be fixed in Cygnus 0.9.0 (it will be released at the end of September 2015).