We use proprietary and third party´s cookies to improve your experience and our services, identifying your Internet Browsing preferences on our website; develop analytic activities and display advertising based on your preferences. If you keep browsing, you accept its use. You can get more information on our Cookie Policy
Cookies Policy
Ask Your Question
0

Cygnus tutorial - not working

asked 2018-06-06 11:08:34 +0100

Raffa87 gravatar image

Dear Fiware User, I am trying to complete the example on Cygnus available at http://fiware-cygnus.readthedocs.io/e...startguide/index.html

I have a working Context Broker available at localhost. However, when I try to run the notification.sh script written according to tutorial, this is the error that I get:

$ ./notification.sh http://localhost:5050/notify

  • About to connect() to localhost port 5050 (#0)

  • Trying ::1... Connection refused

  • Trying 127.0.0.1... Connection refused

  • couldn't connect to host

  • Closing connection #0

curl: (7) couldn't connect to host

Can you please support me? Thak you very much

edit retag flag offensive close merge delete

3 answers

Sort by » oldest newest most voted
0

answered 2019-10-18 16:19:13 +0100

yves gravatar image

Hi all I have the same issue this a cygnus ngsi used has service

agent_1.conf

listening port the Flume source will use for receiving incoming notifications

cygnus-ngsi.sources.http-source.port = 5050

cygnusinstance1.conf

Administration port. Must be unique per instance

ADMIN_PORT=8081

tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 13622/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 13771/master tcp6 0 0 :::111 :::* LISTEN 1/systemd tcp6 0 0 :::8081 :::* LISTEN 5035/java tcp6 0 0 :::22 :::* LISTEN 13622/sshd tcp6 0 0 ::1:25 :::* LISTEN 13771/master

No process listing on 5050 !

Any explanation ? Thank you for your feedback

edit flag offensive delete link more
0

answered 2018-06-09 16:11:50 +0100

Jason Fox gravatar image

The notification.sh appears to be a simulation of the result of an Orion Subscription - and therefore needs to be posted to the port Cygnus is listening on - which is usually localhost:5050 - assuming you are running Cygnus on localhost.

Your couldn't connect to host message indicates that either you have not started Cygnus on localhost or you have configured an alternate port. Ensure you have used the environment variable CYGNUS_API_PORT=5080 somewhere or the agent.conf file holds a line cygnus-ngsi.sources.http-source.port = 5050

The subscription it is simulating is supposed to be something along the lines of When X occurs send a notification to cygnus - Therefore I'm guessing that localhost:5050 is the location where Cygnus is supposed to be listening.

When setting up a REAL subscription and running Orion it needs to be something like:

curl -X POST \ 'http://{{orion:port}}/v2/subscriptions/' \ -H 'Content-Type: application/json' \ -d '{ "description": "Notify Cygnus of all context changes", "subject": { "entities": [ { "idPattern": ".*" } ] }, "notification": { "http": { "url": "http://{{cygnus:port}}/notify" }, "attrsFormat": "legacy" }, "throttling": 5 }'

Replace {{orion:port}} and {{cyngnus:port}} as necessary (this assumes you are not using a fiware-header or fiware-servicepath yet...)

You can then update an existing entity with the PATCH command:

curl -X PATCH \ 'http://{{orion}}/v2/entities/<entity-id>/attrs' \ -H 'Content-Type: application/json' \ -d ' { "price":{"type":"Integer", "value": 89} }'

Obviously replace <entity-id> and the -d payload with your data.

edit flag offensive delete link more
0

answered 2018-06-20 18:03:45 +0100

Raffa87 gravatar image

Thank you very much for your answer, Actually, I am still not able to setup a "working" configuration for Orion-Cygnus. I tried the instructions described here: https://github.com/telefonicaid/fiwar...cygnusspark.md but looking at the file "/var/log/cygnus/cygnus.log", I can see only the following lines after a change, not the actual change as reported in the example.

time=2018-06-20T15:57:06.627UTC | lvl=INFO | trans= | srv= | subsrv= | function=handle | comp=Cygnus | msg=com.telefonica.iot.cygnus.management.ManagementInterface[104] : Management interface request. Method: POST, URI: /notify

Is it correct? What changes should I make? Do you have suggestions for beginner documentation where to start?

edit flag offensive delete link more

Comments

Ensure that you are running with logging to the max -I use the `CYGNUS_LOG_LEVEL=DEBUG` environment variable. Check that you are sending your notification to the right port - e.g. `CYGNUS_SERVICE_PORT=5050` would listen on "notification": {"http": { "url": "http://cygnus:5050/notify }}.

Jason Fox gravatar imageJason Fox ( 2018-06-21 09:29:32 +0100 )edit

There is a simple "how to connect Cygnus" tutorial on GitHub - https://github.com/fiware/tutorials.Historic-Context

Jason Fox gravatar imageJason Fox ( 2018-06-21 09:31:05 +0100 )edit

I understood that cygnus has an admin port (ADMIN_PORT set in the cygnus_instance_{id}.conf file) and a port per agent to receive notifications from Orion. Right ? If I set the admin port on 8081 and the agent port on 5050, when I launch cygnus as a service only the admin port is ok

yves gravatar imageyves ( 2019-10-18 16:13:06 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-06-06 11:08:34 +0100

Seen: 8,517 times

Last updated: Jun 20 '18