[英]I am not able to make Orion communicate with Cygnus?
I am trying cygnus subscribe to orion. 我正在尝试天鹅绒订阅猎户座。 It is giving success, however, but on updating value to orion there is no notificaton being sent to cygnus. 但是,它给人带来了成功,但是在更新猎户座的价值时,并没有通知天鹅座。 Tell me how can I check notification being received to cygnus? 告诉我如何检查接收到天鹅座的通知? Moreover, Is there any method to check successful connection between orion and cygnus. 此外,是否有任何方法可以检查猎户座和天鹅座之间的成功连接。 Configuration and logs of ORION & CYGNUS are below: 以下是ORION和CYGNUS的配置和日志:
POST METHOD on orion for creating:(VERSION - v1 ) 在Orion上执行POST方法以创建:(VERSION-v1)
{
"contextElements": [
{
"type": "Room",
"isPattern": "false",
"id": "Room1",
"attributes": [
{
"name": "temperature",
"type": "float",
"value": "39.5"
}
]
}
],
"updateAction": "UPDATE"
}
**SUBSCRIBING CYGNUS TO ORION ** is as follows: **将CYGNUS订阅到ORION如下:
{
"entities": [
{
"type": "Room",
"isPattern": "false",
"id": "Room1"
}
],
"attributes": [
"temperature"
],
"reference": "http://cygnus:5050",
"duration": "P1M",
"notifyConditions": [
{
"type": "ONCHANGE",
"condValues": [
"temperature"
]
}
],
"throttling": "PT60S"
}
My agent.conf file in Cygnus is this : 我在Cygnus中的agent.conf文件是这样的:
# ============================================
# # 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 = 1ae97e2f-1589-4bdf-8a3f-b3683fc66a5a
#
# # the FQDN/IP address for the CKAN API endpoint
cygnusagent.sinks.ckan-sink.ckan_host = demo.ckan.org
#
# # the port for the CKAN API endpoint
cygnusagent.sinks.ckan-sink.ckan_port = 5000
#
# # 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
my Cygnus logs: CYGNUS VERSION - 1.7 我的天鹅座日志:天鹅座版本-1.7
/5/2018 3:37:07 PMtime=2018-06-05T10:07:07.572Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=startAllComponents | msg=org.apache.flume.node.Application[145] : Starting Channel ckan-channel
6/5/2018 3:37:07 PMtime=2018-06-05T10:07:07.572Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=startAllComponents | msg=org.apache.flume.node.Application[160] : Waiting for channel: ckan-channel to start. Sleeping for 500 ms
6/5/2018 3:37:08 PMtime=2018-06-05T10:07:08.139Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=main | msg=com.telefonica.iot.cygnus.nodes.CygnusApplication[324] : Starting a Jetty server listening on 0.0.0.0:8081 (Management Interface)
6/5/2018 3:37:08 PMtime=2018-06-05T10:07:08.193Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=register | msg=org.apache.flume.instrumentation.MonitoredCounterGroup[119] : Monitored counter group for type: CHANNEL, name: ckan-channel: Successfully registered new MBean.
6/5/2018 3:37:08 PMtime=2018-06-05T10:07:08.250Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=start | msg=org.apache.flume.instrumentation.MonitoredCounterGroup[95] : Component type: CHANNEL, name: ckan-channel started
6/5/2018 3:37:08 PMtime=2018-06-05T10:07:08.251Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=startAllComponents | msg=org.apache.flume.node.Application[173] : Starting Sink ckan-sink
6/5/2018 3:37:08 PMtime=2018-06-05T10:07:08.253Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=startAllComponents | msg=org.apache.flume.node.Application[184] : Starting Source http-source
6/5/2018 3:37:08 PMtime=2018-06-05T10:07:08.392Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=<init> | msg=com.telefonica.iot.cygnus.interceptors.CygnusGroupingRules[53] : Grouping rules read:
6/5/2018 3:37:08 PMtime=2018-06-05T10:07:08.561Z | lvl=WARN | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=<init> | msg=com.telefonica.iot.cygnus.interceptors.CygnusGroupingRules[61] : Grouping rules syntax has errors. Details: null
6/5/2018 3:37:08 PMtime=2018-06-05T10:07:08.581Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=<init> | msg=com.telefonica.iot.cygnus.interceptors.CygnusGroupingRules[53] : Grouping rules read:
6/5/2018 3:37:08 PMtime=2018-06-05T10:07:08.591Z | lvl=WARN | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=<init> | msg=com.telefonica.iot.cygnus.interceptors.CygnusGroupingRules[61] : Grouping rules syntax has errors. Details: null
6/5/2018 3:37:09 PMtime=2018-06-05T10:07:09.917Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=register | msg=org.apache.flume.instrumentation.MonitoredCounterGroup[119] : Monitored counter group for type: SOURCE, name: http-source: Successfully registered new MBean.
6/5/2018 3:37:09 PMtime=2018-06-05T10:07:09.917Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=start | msg=org.apache.flume.instrumentation.MonitoredCounterGroup[95] : Component type: SOURCE, name: http-source started
6/5/2018 3:37:11 PMtime=2018-06-05T10:07:11.828Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=<init> | msg=com.telefonica.iot.cygnus.backends.http.HttpClientFactory[81] : Setting max total connections (500)
6/5/2018 3:37:11 PMtime=2018-06-05T10:07:11.828Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=<init> | msg=com.telefonica.iot.cygnus.backends.http.HttpClientFactory[82] : Setting default max connections per route (100)
6/5/2018 3:37:11 PMtime=2018-06-05T10:07:11.866Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=<init> | msg=com.telefonica.iot.cygnus.backends.http.HttpClientFactory[81] : Setting max total connections (500)
6/5/2018 3:37:11 PMtime=2018-06-05T10:07:11.867Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=<init> | msg=com.telefonica.iot.cygnus.backends.http.HttpClientFactory[82] : Setting default max connections per route (100)
6/5/2018 3:37:11 PMtime=2018-06-05T10:07:11.868Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnus-ngsi | op=start | msg=com.telefonica.iot.cygnus.sinks.NGSISink[354] : [ckan-sink] Startup completed
For the sake of testing purpose, I followed the below link 为了测试目的,我点击了以下链接
After,configuring a test agent on cygnus: 之后,在天鹅座上配置测试代理:
http://fiware-cygnus.readthedocs.io/en/1.2.2/cygnus-ngsi/quick_start_guide/index.html
/opt/fiware-cygnus/cygnus-ngsi/src/main/resources/cygnus-flume-ng agent --conf /opt/apache-flume/conf/ -f /opt/apache-flume/conf/agent_test.conf -n cygnusagent -Dflume.root.logger=INFO,console
Warning: JAVA_HOME is not set!
+ exec /usr/bin/java -Xmx20m -Dflume.root.logger=INFO,console -cp '/opt/apache-flume/conf:/opt/apache-flume/lib/*:/opt/apache-flume/plugins.d/cygnus/lib/*:/opt/apache-flume/plugins.d/cygnus/libext/*' -Djava.library.path= com.telefonica.iot.cygnus.nodes.CygnusApplication -f /opt/apache-flume/conf/agent_test.conf -n cygnusagent
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/apache-flume/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/apache-flume/plugins.d/cygnus/lib/cygnus-ngsi-1.7.0-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/apache-flume/plugins.d/cygnus/libext/cygnus-common-1.7.0-jar-with-dependencies.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
time=2018-05-05T08:21:21.573Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp= | op=main | msg=com.telefonica.iot.cygnus.nodes.CygnusApplication[189] : Starting Cygnus, version 1.7.0.9df0d4d857488c4dd72e9c5dfd2b5e41083b64b9
time=2018-05-05T08:21:21.792Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=main | msg=com.telefonica.iot.cygnus.nodes.CygnusApplication[312] : Waiting for valid Flume components references...
time=2018-05-05T08:21:21.793Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=start | msg=org.apache.flume.node.PollingPropertiesFileConfigurationProvider[61] : Configuration provider starting
time=2018-05-05T08:21:21.799Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=run | msg=org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable[133] : Reloading configuration file:/opt/apache-flume/conf/agent_test.conf
time=2018-05-05T08:21:21.823Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=addProperty | msg=org.apache.flume.conf.FlumeConfiguration$AgentConfiguration[1016] : Processing:test-sink
time=2018-05-05T08:21:21.824Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=addProperty | msg=org.apache.flume.conf.FlumeConfiguration$AgentConfiguration[1016] : Processing:test_sink
time=2018-05-05T08:21:21.824Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=addProperty | msg=org.apache.flume.conf.FlumeConfiguration$AgentConfiguration[1016] : Processing:test-sink
time=2018-05-05T08:21:21.824Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=addProperty | msg=org.apache.flume.conf.FlumeConfiguration$AgentConfiguration[1016] : Processing:test-sink
time=2018-05-05T08:21:21.824Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=addProperty | msg=org.apache.flume.conf.FlumeConfiguration$AgentConfiguration[930] : Added sinks: test-sink Agent: cygnusagent
time=2018-05-05T08:21:21.837Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=validateConfiguration | msg=org.apache.flume.conf.FlumeConfiguration[140] : Post-validation flume configuration contains configuration for agents: [cygnusagent]
time=2018-05-05T08:21:21.838Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=loadChannels | msg=org.apache.flume.node.AbstractConfigurationProvider[150] : Creating channels
time=2018-05-05T08:21:21.848Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=create | msg=org.apache.flume.channel.DefaultChannelFactory[40] : Creating instance of channel test-channel type memory
time=2018-05-05T08:21:21.854Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=loadChannels | msg=org.apache.flume.node.AbstractConfigurationProvider[205] : Created channel test-channel
time=2018-05-05T08:21:21.855Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=create | msg=org.apache.flume.source.DefaultSourceFactory[39] : Creating instance of source http-source, type org.apache.flume.source.http.HTTPSource
time=2018-05-05T08:21:21.926Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=configure | msg=com.telefonica.iot.cygnus.handlers.NGSIRestHandler[156] : [NGSIRestHandler] Startup completed
time=2018-05-05T08:21:21.939Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=create | msg=org.apache.flume.sink.DefaultSinkFactory[40] : Creating instance of sink: test-sink, type: com.telefonica.iot.cygnus.sinks.NGSITestSink
time=2018-05-05T08:21:21.948Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=getConfiguration | msg=org.apache.flume.node.AbstractConfigurationProvider[119] : Channel test-channel connected to [http-source, test-sink]
time=2018-05-05T08:21:21.962Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=startAllComponents | msg=org.apache.flume.node.Application[138] : Starting new configuration:{ sourceRunners:{http-source=EventDrivenSourceRunner: { source:org.apache.flume.source.http.HTTPSource{name:http-source,state:IDLE} }} sinkRunners:{test-sink=SinkRunner: { policy:org.apache.flume.sink.DefaultSinkProcessor@56bb46b7 counterGroup:{ name:null counters:{} } }} channels:{test-channel=org.apache.flume.channel.MemoryChannel{name: test-channel}} }
time=2018-05-05T08:21:21.962Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=startAllComponents | msg=org.apache.flume.node.Application[145] : Starting Channel test-channel
time=2018-05-05T08:21:21.962Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=startAllComponents | msg=org.apache.flume.node.Application[160] : Waiting for channel: test-channel to start. Sleeping for 500 ms
time=2018-05-05T08:21:22.010Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=register | msg=org.apache.flume.instrumentation.MonitoredCounterGroup[119] : Monitored counter group for type: CHANNEL, name: test-channel: Successfully registered new MBean.
time=2018-05-05T08:21:22.010Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=start | msg=org.apache.flume.instrumentation.MonitoredCounterGroup[95] : Component type: CHANNEL, name: test-channel started
time=2018-05-05T08:21:22.463Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=startAllComponents | msg=org.apache.flume.node.Application[173] : Starting Sink test-sink
time=2018-05-05T08:21:22.464Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=startAllComponents | msg=org.apache.flume.node.Application[184] : Starting Source http-source
time=2018-05-05T08:21:22.466Z | lvl=WARN | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=<init> | msg=com.telefonica.iot.cygnus.interceptors.CygnusGroupingRules[49] : No grouping rules have been read. Details: /Applications/apache-flume-1.4.0-bin/conf/grouping_rules.conf (No such file or directory)
time=2018-05-05T08:21:22.467Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=start | msg=com.telefonica.iot.cygnus.sinks.NGSISink[354] : [test-sink] Startup completed
time=2018-05-05T08:21:22.476Z | lvl=WARN | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=<init> | msg=com.telefonica.iot.cygnus.interceptors.CygnusGroupingRules[49] : No grouping rules have been read. Details: /Applications/apache-flume-1.4.0-bin/conf/grouping_rules.conf (No such file or directory)
time=2018-05-05T08:21:22.626Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=register | msg=org.apache.flume.instrumentation.MonitoredCounterGroup[119] : Monitored counter group for type: SOURCE, name: http-source: Successfully registered new MBean.
time=2018-05-05T08:21:22.627Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=start | msg=org.apache.flume.instrumentation.MonitoredCounterGroup[95] : Component type: SOURCE, name: http-source started
time=2018-05-05T08:21:22.794Z | lvl=INFO | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=main | msg=com.telefonica.iot.cygnus.nodes.CygnusApplication[324] : Starting a Jetty server listening on 0.0.0.0:8081 (Management Interface)
time=2018-05-05T08:21:52.477Z | lvl=WARN | corr= | trans= | srv= | subsrv= | comp=cygnusagent | op=<init> | msg=com.telefonica.iot.cygnus.interceptors.CygnusGroupingRules[49] : No grouping rules have been read. Details: /Applications/apache-flume-1.4.0-bin/conf/grouping_rules.conf (No such file or directory)
and now,if I execute this file notification.sh 现在,如果我执行此文件notification.sh
URL=$1
curl $URL -v -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Fiware-Service: qsg" --header "Fiware-ServicePath: testsink" -d @- <<EOF
{
"subscriptionId" : "51c0ac9ed714fb3b37d7d5a8",
"originator" : "localhost",
"contextResponses" : [
{
"contextElement" : {
"attributes" : [
{
"name" : "temperature",
"type" : "float",
"value" : "26.5"
}
],
"type" : "Room",
"isPattern" : "false",
"id" : "Room1"
},
"statusCode" : {
"code" : "200",
"reasonPhrase" : "OK"
}
}
]
}
EOF
I recieve a response : 我收到回应:
* Connected to CYGNUS_IP (CYGNUS_IP) port 5053 (#0)
> POST /notify HTTP/1.1
> User-Agent: curl/7.29.0
> Host: CYGNUS_IP:5053
> Content-Type: application/json
> Accept: application/json
> Fiware-Service: qsg
> Fiware-ServicePath: testsink
> Content-Length: 615
>
* upload completely sent off: 615 out of 615 bytes
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer
You can do the following to know if your subscription is being activated (thus, ensuring that Orion is sending notifications to Cygnus): 您可以执行以下操作来了解您的订阅是否已激活(因此,确保Orion将通知发送到Cygnus):
GET /v2/subscriptions
if you don't know the id of the subscription. 如果您不知道订阅ID,请GET /v2/subscriptions
subscriptions。 In this case, you will get the information for all subscriptions and you have to locate the one being used for Cygnus. 在这种情况下,您将获得所有订阅的信息,并且必须找到用于Cygnus的订阅。 GET /v2/subscriptions/<subscriptionId
if you know the subscription ID. 如果您知道订阅ID,则GET /v2/subscriptions/<subscriptionId
。 The following fields in the response could help (see NGSIv2 specification for details): 响应中的以下字段可能会有所帮助(有关详细信息,请参见NGSIv2规范 ):
status
: Eitheractive
(for active subscriptions) orinactive
(for inactive subscriptions) [..] .status
:active
(对于活动订阅)或非inactive
(对于非活动订阅)[..]。 Also, for subscriptions experiencing problems with notifications, the status is set tofailed
. 另外,对于遇到通知问题的订阅,其状态将设置为failed
。 As soon as the notifications start working again, the status is changed back toactive
. 通知再次开始工作后,状态将重新更改为active
。
timesSent
(not editable, only present in GET operations): Number of notifications sent due to this subscription.timesSent
(不可编辑,仅在GET操作中提供):由于此订阅而发送的通知数。
lastNotification
(not editable, only present in GET operations): Last notification timestamp in ISO8601 format.lastNotification
(不可编辑,仅在GET操作中提供):ISO8601格式的最后通知时间戳。
lastFailure
(not editable, only present in GET operations): Last failure timestamp in ISO8601 format.lastFailure
(不可编辑,仅在GET操作中提供):ISO8601格式的上次失败时间戳。 Not present if subscription has never had a problem with notifications. 如果订阅从未有过通知问题,则不存在。
lastSuccess
(not editable, only present in GET operations): Timestamp in ISO8601 format for last successful notification.lastSuccess
(不可编辑,仅在GET操作中提供):ISO8601格式的时间戳记,用于最后一次成功的通知。 Not present if subscription has never had a successful notification. 如果订阅从未成功发送过通知,则不存在。
So, if everything goes ok timesSent
should be incresing each update, status should not be failed
and lastNotification
should be equal to lastSuccess
. 因此,如果一切顺利, timesSent
应增加每次更新的次数,则状态不应failed
并且lastNotification
应当等于lastSuccess
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.