Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-13332

[fiware-stackoverflow] ContextBroker subscriptions Error

    Details

      Description

      Created question in FIWARE Q/A platform on 03-10-2017 at 15:10
      Please, ANSWER this question AT https://stackoverflow.com/questions/46545475/contextbroker-subscriptions-error

      Question:
      ContextBroker subscriptions Error

      Description:
      I've updated cygnus from version 0.13 to 1.7.0 by installing NGSI following this tutorial:

      https://github.com/telefonicaid/fiware-cygnus/tree/master/cygnus-ngsi

      Error the subscription

      [
      {
      "id": "59d38a92dbaa1e477aef9c00",
      "description": "A subscription to get info about pruebas",
      "status": "failed",
      "subject": {
      "entities": [

      { "id": "pruebas", "type": "pruebas" }

      ],
      "condition":

      { "attrs": [ "pressure" ] }

      },
      "notification": {
      "timesSent": 2,
      "lastNotification": "2017-10-03T13:03:43.00Z",
      "attrs": [
      "temperature",
      "pressure"
      ],
      "attrsFormat": "legacy",
      "http":

      { "url": "http://localhost:5050/notify" }

      ,
      "lastFailure": "2017-10-03T13:03:43.00Z"
      }
      }
      ]

      viewing the contextBroker log gives the following:

      $pp[328]:notificationError | msg=Raising alarm NotificationError http://localhost:5050/notify: (curl_easy_perform failed: Couldn't connect to server)

      I have contextBroker on the same machine as cygnus so I have already tried to change the notify ip for the server and for localhost and it does not work for any of it.

      with version 0.13 if it works with localhost.

      What could be the problem?

      It does not even come to cygnus configuration files because it can not access from the contextBroker.

      Greetings and thank you.

      EDIT1:

      I am tested with the fiwareLab machines and removing cygnus 0.13 that comes pre installed with YUM REMOVE CYGNUS. Then I installed 1.7 with YUM INSTALL CYGNUS-NGSI and installed two packages ngsi and common.

      Restarting the service with service cygnus restart indicates the following:

      Dependencies Resolved

      ================================================================================
      Package Arch Version Repository Size
      ================================================================================
      Installing:
      cygnus-ngsi x86_64 1.7.1-0.g9df0d4d fiware 74 M
      Installing for dependencies:
      cygnus-common x86_64 1.7.1-0.g9df0d4d fiware 128 M

      Transaction Summary
      ================================================================================
      Install 2 Package(s)

      Total size: 202 M
      Installed size: 223 M
      Is this ok [y/N]: y
      Downloading Packages:
      Running rpm_check_debug
      Running Transaction Test
      Transaction Test Succeeded
      Running Transaction
      [INFO] Creating cygnus user
      Installing : cygnus-common-1.7.1-0.g9df0d4d.x86_64 1/2
      [INFO] Creating log directory
      Done
      Installing : cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64 2/2
      Verifying : cygnus-common-1.7.1-0.g9df0d4d.x86_64 1/2
      Verifying : cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64 2/2

      Installed:
      cygnus-ngsi.x86_64 0:1.7.1-0.g9df0d4d

      Dependency Installed:
      cygnus-common.x86_64 0:1.7.1-0.g9df0d4d

      Complete!
      [centos@centos6 cygnus]$ sudo service cygnus restart
      There aren't any instance of Cygnus running [ OK ]
      Starting Cygnus 1... [ OK ]

      When I try on my server I do the same steps but when doing the service cygnus restart has two cygnus the 1 and 2 not as in vuesta machine that only has one and therefore indicates that the port 8081 is already in use.

      Dependencias resueltas

      ============================================================================================================================================================================
      Paquete Arquitectura Versión Repositorio Tamaño
      ============================================================================================================================================================================
      Instalando:
      cygnus-ngsi x86_64 1.7.1-0.g9df0d4d fiware 74 M
      Instalando para las dependencias:
      cygnus-common x86_64 1.7.1-0.g9df0d4d fiware 128 M

      Resumen de la transacción
      ============================================================================================================================================================================
      Instalar 2 Paquete(s)

      Tamaño total de la descarga: 202 M
      Tamaño instalado: 223 M
      Está de acuerdo [s/N]:s
      Descargando paquetes:
      (1/2): cygnus-common_hadoopcore_1.2.1-1.7.1-0.g9df0d4d.x86_64.rpm | 128 MB 00:14
      (2/2): cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64.rpm | 74 MB 00:07
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      Total 8.9 MB/s | 202 MB 00:22
      Ejecutando el rpm_check_debug
      Ejecutando prueba de transacción
      La prueba de transacción ha sido exitosa
      Ejecutando transacción
      [INFO] Creating cygnus user
      Instalando : cygnus-common-1.7.1-0.g9df0d4d.x86_64 1/2
      [INFO] Creating log directory
      Done
      Instalando : cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64 2/2
      Verifying : cygnus-common-1.7.1-0.g9df0d4d.x86_64 1/2
      Verifying : cygnus-ngsi-1.7.1-0.g9df0d4d.x86_64 2/2

      Instalado:
      cygnus-ngsi.x86_64 0:1.7.1-0.g9df0d4d

      Dependencia(s) instalada(s):
      cygnus-common.x86_64 0:1.7.1-0.g9df0d4d

      ¡Listo!

      [root@UAL-IoF2020 conf]# ls
      agent_1.conf agent_ngsi.conf.template cygnus_instance_2.conf grouping_rules_2.conf krb5_login.conf README-cygnus-common.md
      agent_3.conf cartodb_keys.conf.template cygnus_instance.conf.template grouping_rules.conf.template log4j.properties README-cygnus-ngsi.md
      agent.conf.template cygnus_instance_1.conf flume-env.sh.template krb5.conf.template name_mappings.conf.template
      [root@UAL-IoF2020 conf]# service cygnus restart
      There aren't any instance of Cygnus running [ OK ]
      Starting Cygnus 1... [ OK ]
      Starting Cygnus 2... [ OK ]
      [root@UAL-IoF2020 conf]#

      Is it possible that this is the problem and that is not recognizing my NGSI and this occupying the 8081 the common? or is this normal?

      Log cygnus :

      time=2017-10-03T21:51:09.326Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=main | msg=com.telefonica.iot.cygnus.nodes.CygnusApplication[301] : Starting a Jetty server listening on 0.0.0.0:8081 (Management Interface)
      time=2017-10-03T21:51:09.381Z | lvl=WARN | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=warn | msg=org.mortbay.log.Slf4jLog[76] : failed SelectChannelConnector@0.0.0.0:8081: java.net.BindException: La dirección ya se está usando
      time=2017-10-03T21:51:09.381Z | lvl=WARN | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=warn | msg=org.mortbay.log.Slf4jLog[76] : failed Server@52992ace: java.net.BindException: La dirección ya se está usando
      time=2017-10-03T21:51:09.381Z | lvl=FATAL | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=run | msg=com.telefonica.iot.cygnus.http.JettyServer[90] : Fatal error running the Management Interface. Details=La dirección ya se está usando

      EDIT2

      I have already solved the problem of two cygnus, had two agent_1 and agent_2 created. I have deleted one of them and already performing service cygnus restart appears only one cygnus. We are getting better.

      But I still have the same problem with the subscriptions:

      The contextBroker log indicates:

       

      msg = Raising alarm NotificationError http: // localhost: 5050 / notify: (curl_easy_perform failed: could not connect to server)

      When I try:

      [root @ UAL-IoF2020 conf] # netstat -np | grep 5050

      I do not think anything.

      When I launch this:

      [root @ UAL-IoF2020 conf] # netstat -np | grep 1026
      tcp 0 0 150.XXX.XXX.XXX:1026 XXX.XXX.XXX.XXX:50348 ESTABLISHED 5169 / contextBroker

      I am trying to launch a Test of your page.

      ./notification-json-simple.sh http: // localhost: 5050 / notify myservice myservicepath

      and gives me the following error:

      [root @ UAL-IoF2020 ngsi-examples] # ./notification-json-simple.sh http: // localhost: 5050 / notify myservice myservicepath

      • About to connect () to localhost port 5050 (# 0)
      • Trying :: 1 ... Connection refused
      • Trying 127.0.0.1 ... Connection refused
      • could not connect to host
      • Closing connection # 0
        curl: (7) could not connect to host

      It gives the impression that in the 5050 I have nothing listening.

      Any clue what that might be?

      cygnus-ngsi.sources = http-source
      cygnus-ngsi.sinks = mysql-sink
      cygnus-ngsi.channels = mysql-channel

      #=============================================

      1. source configuration
      2. channel name where to write the notification events
        cygnus-ngsi.sources.http-source.channels = mysql-channel
      3. source class, must not be changed
        cygnus-ngsi.sources.http-source.type = org.apache.flume.source.http.HTTPSource
      4. listening port the Flume source will use for receiving incoming notifications
        cygnus-ngsi.sources.http-source.port = 5050
      5. Flume handler that will parse the notifications, must not be changed
        cygnus-ngsi.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.NGSIRestHandler
      6. URL target
        cygnus-ngsi.sources.http-source.handler.notification_target = /notify
      7. default service (service semantic depends on the persistence sink)
        cygnus-ngsi.sources.http-source.handler.default_service = default
      8. default service path (service path semantic depends on the persistence sink)
        cygnus-ngsi.sources.http-source.handler.default_service_path = /
      9. source interceptors, do not change
        cygnus-ngsi.sources.http-source.interceptors = ts gi
      10. TimestampInterceptor, do not change
        cygnus-ngsi.sources.http-source.interceptors.ts.type = timestamp
      11. GroupingInterceptor, do not change
        cygnus-ngsi.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.NGSIGroupingInterceptor$Builder
      12. Grouping rules for the GroupingInterceptor, put the right absolute path to the file if necessary
      13. see the doc/design/interceptors document for more details
        cygnus-ngsi.sources.http-source.interceptors.gi.grouping_rules_conf_file = /usr/cygnus/conf/grouping_rules.conf

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2018-01-12 19:50|CREATED monitor | # answers= 3, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2018-01-12 19:50|CREATED monitor | # answers= 3, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-01-12 19:53|UPDATED status: transition Answer| # answers= 3, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2018-01-12 19:53|UPDATED status: transition Answer| # answers= 3, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-01-12 20:02|UPDATED status: transition Finish| # answers= 3, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2018-01-12 20:02|UPDATED status: transition Finish| # answers= 3, accepted answer= True

          People

          • Assignee:
            frb Francisco Romero
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: