Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configured Cygnus with STH-comet, but unable to retrieve data from Mongo DB #519

Open
Saadiatalkpool opened this issue Aug 30, 2019 · 18 comments
Labels

Comments

@Saadiatalkpool
Copy link

I have configured Cygnus and STH
Cygnus is getting subscribed data from orion and storing it in mongo DB
But I am unable to fetch data from STH

When I try to get data, it returns response with empty values array.
However I can see the data in Mongo DB

@fgalan
Copy link
Member

fgalan commented Aug 30, 2019

We would need more detail about your case, please. In particular:

  • Which exact request are you using to fetch data (verb + URL + headers)
  • Which response (payload + headers) do you get to that request
  • A sample of the documents you see in Mongo DB

Thanks!

@Saadiatalkpool
Copy link
Author

  • The DB snapshot:

2019-08-30 12_58_54-Start

  • This is the request I am using to get data:

curl --location --request GET "http://localhost:8666/STH/v1/contextEntities/type/multiSensor/id/urn:ngsi-ld:70-B3-D5-D7-20-1C-01-A7/attributes/Temperature?lastN=10"
--header "fiware-service: myHome"
--header "fiware-servicepath: /building7"

  • The response I am getting:
    {"contextResponses":[{"contextElement":{"attributes":[{"name":"Temperature","values":[]}],"id":"urn:ngsi-ld:70-B3-D5-D7-20-1C-01-A7","isPattern":false,"type":"multiSensor"},"statusCode":{"code":"200","reasonPhrase":"OK"}}]}r

@fgalan
Copy link
Member

fgalan commented Aug 30, 2019

Could you also include the fragment of the log that you get in STH when you run that GET request, please? (only the fragment, not the full log).

Thanks!

@Saadiatalkpool
Copy link
Author

2019-08-30 17_42_41-Start
Log file showing logs for Manual as well as Wirecloud Hist Module (http://124.109.46.189:8666/STH/v1/contextEntities/type/multiSensor/id/urn:ngsi-ld:70-B3-D5-D7-20-1C-01-A7/attributes/Temperature?lastN=10) GET Requests

@fgalan
Copy link
Member

fgalan commented Aug 30, 2019

This seems to be the root cause of the problem:

imagen

Could you re-do the test but this time with STH running in DEBUG log level? Let's try to find to which collection is STH trying to acces...

@Saadiatalkpool
Copy link
Author

But as you can see, the collection exists in Mongo DB with latest data

@fgalan
Copy link
Member

fgalan commented Aug 30, 2019

Well... in Mongo DB exists a collection with data but we don't know the collection to which STH is trying to access (or at least I haven't seen in the log fragment you sent... maybe I missed?).

Thus, let's try to find the collection to which STH is trying to access, in order to ensure is the same exists in MongoDB. Not sure but maybe log traces in DEBUG level could provide that information.

In addition, the config.js file used by STH should be useful.

@Saadiatalkpool
Copy link
Author

  • Response on STH Startup:
    3

  • Response on GET:
    4

@Saadiatalkpool
Copy link
Author

  • Subscription logs:
    5

@fgalan
Copy link
Member

fgalan commented Aug 30, 2019

How are you feeding STH? Notifications are sents to Cygnus or to STH directly?

In the issue body you say you are using Cygnus and in that case Cygnus writes directly to MongoDB. However I see a POST /notify in the STH traces:

imagen

Could you clarify the situation, pls?

@Saadiatalkpool
Copy link
Author

That could be the problem
I am notifying to "url": "http://sth-comet:8666/notify"

@fgalan
Copy link
Member

fgalan commented Sep 2, 2019

The recommended way of storing data in STH in production is through Cygnus (see https://stackoverflow.com/questions/56461642/sth-comet-raw-insert-in-mongo-database). However, for testing is fine using the /notify endpoint (in fact, in this situation is is even better, to reduce complexity).

Thus, let's focus in that case (i.e. using the /notify endpoint). I'd recommend to do a full clean up before continue debugging, I mean to drop all the STH-related databases.

Which configuration is STH using (i.e. the content of the config.js file)? As far as I remember there are different ways of structuring collections in STH (specified in the config.js file) and there could be some mismatch in the way data is inserted and retrieved.

@Saadiatalkpool
Copy link
Author

Now I am facing Connection issues:
2019-09-03 16_37_06-Start
2019-09-03 16_38_05-Start
2019-09-03 16_48_47-Start

@Saadiatalkpool
Copy link
Author

Now seems like cygnus is working properly and persisting data to mongoDB.
But still when I query sth:
curl -G -X GET 'http://124.109.46.189:8666/STH/v1/contextEntities/type/multiSensor/id/urn:ngsi-ld:70-B3-D5-D7-20-1C-01-A7/attributes/Temperature'
-d 'lastN=3'
-H 'fiware-service: myHome'
-H 'fiware-servicepath: /building7'

It returns empty array.

@fgalan
Copy link
Member

fgalan commented Sep 12, 2019

Ok, let's start from your last comment and forget all the previous history (Cygnus vs. direct notification confusion, connections, problems, etc.) :)

Which config.js configuration are you using for STH? Could you post the content of that file in a new comment?

In addition, do the following to ensure we start from a clean situation:

  1. Stop Cygnus
  2. Remove all DB in MongoDB
  3. Start Cygnus
  4. Send several notifications to Cygnus so new database is created. Which DB and which collections inside it are created?

@Rosiberto
Copy link

@Saadiatalkpool

Were you able to solve this problem with STH-Comet?

I have the same problem and I have not found a solution.

@fgalan
Copy link
Member

fgalan commented Jul 10, 2020

@Saadiatalkpool

Were you able to solve this problem with STH-Comet?

I have the same problem and I have not found a solution.

@Rosiberto do you mean same problem described in issue #545 ?

@Rosiberto
Copy link

@fgalan,

Yes. I opened this issue #545 here.

I have the same problem. And so far, I haven't been able to solve it myself and I haven't found a solution online.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants