fluent-plugin-festival 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6bf3cd0a66259715fde049cd5f12090c51742288
4
- data.tar.gz: 005bf5cdf8a890ca3df7c2bf4bb96e9073de13a4
3
+ metadata.gz: 50683595d0191e60d7ab11e80b8d1661136dbf47
4
+ data.tar.gz: c9ee0fe6002245a39c5bdd5459ce219a2676aa74
5
5
  SHA512:
6
- metadata.gz: b78c51d789fb7b6c7b2a956a1572475ccc4a50debc7ee86e71132174e1db7e8527960761c258bde02c8dc963a2bcc5bc36254d65a12a963e0c29b564bc7e15bf
7
- data.tar.gz: 422e63db0875501548d441e1079490bd13b21dd618009fd85d816e21c889b2f6851d3bafed391694cdfff89bedf6ba71dffec6a0b2ab10812005d822a18a80e7
6
+ metadata.gz: 64d59abb3d6496954e1c5236d54e7924d8b04edae0d83437874a48a739298e14779d8a1ee2980ac3e94c412ef78f0cae732f40d0cdf86401d07f6736e7329f39
7
+ data.tar.gz: d68d607cc80dc5e3a5a7c1c180f21b426dde74ccb30bf3c060f0ed55d705321f6039e7bf2fafdea6bec764110acbcd5f822c9478ba5108ed32b53abb1879ed40
data/README.md CHANGED
@@ -36,9 +36,11 @@ Input Plugin can receive events from FESTIVAL EaaS API Server. It can be used vi
36
36
  polling_interval 30
37
37
  <resource>
38
38
  path /aggregators/IOT-0/testbeds/jose/resources/train_station_kyoto001_humidity-info-value/current_data
39
+ fixed_location [135.0, 35.0]
39
40
  </resource>
40
41
  <resource>
41
42
  path /aggregators/IOT-0/testbeds/jose/resources/train_station_kyoto001_barometer-info-value/current_data
43
+ require_location
42
44
  </resource>
43
45
  </source>
44
46
 
@@ -61,12 +63,15 @@ Input Plugin can receive events from FESTIVAL EaaS API Server. It can be used vi
61
63
  - **resource** (at least one entry is required): The target resources to obtain sensor data. multiple resources can be specified by multiple <resource> tags. If a user wants to specify different polling interval for each resource, it must be specified different <source> tags.
62
64
  - **path** (at least one entry is required): The target resource path name should be specified. The pathname should specify only under aggregator part and target data type. Currently, only "current_data" type is supported.
63
65
  (e.g. /aggregators/IOT-0/testbeds/jose/resources/train_station_hyogo001_barometer-info-value/current_data).
66
+ - **fixed_location**: The target resource location can be specified by longitude and latitude values as an array, e.g. [135.0, 35.0]. The specified location is added to each sensor data.
67
+ - **require_location**: If the target resource is moving object, its dynamic location must be obtained from FESTIVAL platform. When this option is specified, the resource location is retrieved via REST API.
64
68
 
65
69
  If the time field is empty, this plugin automatically set the finished time of data downloading. If multiple sensor data specified simultaneously, the time difference may become larger than single datum case. A sample data format is shown below.
66
70
 
67
71
  ```
68
72
  {
69
73
  "resourceName": "/aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value/current_data",
74
+ "location":{"lon":135.0,"lat":35.0},
70
75
  "dataValue": "1001.16"
71
76
  }
72
77
  ```
data/examples/README.md CHANGED
@@ -24,9 +24,11 @@ Create a sample configuration file as follows. You need to change festival_porta
24
24
  polling_interval 30
25
25
  <resource>
26
26
  path /aggregators/IOT-0/testbeds/jose/resources/train_station_kyoto001_humidity-info-value/current_data
27
+ fixed_location [135.0, 35.0]
27
28
  </resource>
28
29
  <resource>
29
30
  path /aggregators/IOT-0/testbeds/jose/resources/train_station_kyoto001_barometer-info-value/current_data
31
+ require_location
30
32
  </resource>
31
33
  </source>
32
34
 
@@ -106,9 +108,11 @@ curl -XPUT 'http://localhost:9200/festival/iot_gateway/_mapping' -d @iot_gateway
106
108
  polling_interval 30
107
109
  <resource>
108
110
  path /aggregators/IOT-0/testbeds/jose/resources/train_station_kyoto001_humidity-info-value/current_data
111
+ fixed_location [135.0, 35.0]
109
112
  </resource>
110
113
  <resource>
111
114
  path /aggregators/IOT-0/testbeds/jose/resources/train_station_kyoto001_barometer-info-value/current_data
115
+ require_location
112
116
  </resource>
113
117
  @label @test0
114
118
  </source>
@@ -116,8 +120,8 @@ curl -XPUT 'http://localhost:9200/festival/iot_gateway/_mapping' -d @iot_gateway
116
120
  <label @test0>
117
121
  <filter test*>
118
122
  @type record_transformer
119
- enable_ruby true
120
- auto_typecast true
123
+ enable_ruby
124
+ auto_typecast
121
125
  <record>
122
126
  timestamp ${time.strftime("%FT%T.%L%:z")}
123
127
  </record>
@@ -6,9 +6,11 @@
6
6
  polling_interval 30
7
7
  <resource>
8
8
  path /aggregators/IOT-0/testbeds/jose/resources/train_station_hyogo001_barometer-info-value/current_data
9
+ fixed_location [135.0, 35.0]
9
10
  </resource>
10
11
  <resource>
11
12
  path /aggregators/IOT-0/testbeds/jose/resources/train_station_kyoto001_barometer-info-value/current_data
13
+ require_location
12
14
  </resource>
13
15
  @label @test0
14
16
  </source>
@@ -39,8 +41,8 @@
39
41
  <label @test0>
40
42
  <filter test*>
41
43
  @type record_transformer
42
- enable_ruby true
43
- auto_typecast true
44
+ enable_ruby
45
+ auto_typecast
44
46
  <record>
45
47
  # set timestamp granularity as second
46
48
  #timestamp ${time.strftime("%FT%T%:z")}
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-festival"
7
- spec.version = "0.0.10"
7
+ spec.version = "0.0.11"
8
8
  spec.authors = ["Toyokazu Akiyama"]
9
9
  spec.email = ["toyokazu@gmail.com"]
10
10
 
@@ -111,10 +111,10 @@ module Fluent::Plugin
111
111
  Pathname(path).dirname.to_s
112
112
  end
113
113
 
114
- def add_location(result, path)
115
- if @require_location
116
- log.debug "get_data (location): request #{get_data_request(resource_path(path))}, #{get_data_header.inspect}"
117
- get_sensor_res = @https.get(get_data_request(resource_path(path)), get_data_header)
114
+ def add_location(result, resource)
115
+ if resource.require_location
116
+ log.debug "get_data (location): request #{get_data_request(resource_path(resource.path))}, #{get_data_header.inspect}"
117
+ get_sensor_res = @https.get(get_data_request(resource_path(resource.path)), get_data_header)
118
118
  return result if !error_handler(get_sensor_res, "get_data failed.")
119
119
  log.debug "get_data: #{get_sensor_res.body}"
120
120
  sensor = JSON.parse(get_sensor_res.body)
@@ -125,6 +125,14 @@ module Fluent::Plugin
125
125
  "lat": JSON.parse(sensor["location"]["geographicArea"])["coordinates"][1]
126
126
  }
127
127
  })
128
+ elsif !resource.fixed_location.nil?
129
+ log.debug "set fixed_location: #{resource.fixed_location.inspect}"
130
+ return result.merge({
131
+ "location": {
132
+ "lon": resource.fixed_location[0].to_f,
133
+ "lat": resource.fixed_location[1].to_f
134
+ }
135
+ })
128
136
  end
129
137
  return result
130
138
  end
@@ -148,7 +156,7 @@ module Fluent::Plugin
148
156
  "resourceName": resource.path,
149
157
  "dataValue": JSON.parse(get_data_res.body)["dataValue"]
150
158
  }
151
- data << add_location(result, resource.path)
159
+ data << add_location(result, resource)
152
160
  when "historical_data" then
153
161
  log.error "historical_data is not supported yet"
154
162
  next
@@ -21,8 +21,6 @@ module Fluent::Plugin
21
21
  config_param :tag, :string
22
22
  desc 'Polling interval to get message from FESTIVAL EaaS API'
23
23
  config_param :polling_interval, :integer, default: 60
24
- desc 'Require sensor location'
25
- config_param :require_location, :bool, default: false
26
24
 
27
25
  # <resoruce> tag can be used for specifying multiple resources in a <source> tag
28
26
  # If the user wants to specify different format or polling interval for each resource,
@@ -54,6 +52,10 @@ module Fluent::Plugin
54
52
  #base.config_param :testbed_id, :string, :default => nil
55
53
  # e.g. airsensors_firenze-airsensors-location, hyogo001_barometer-info-valuesfloat
56
54
  #base.config_param :resource_id, :string, :default => nil
55
+ desc 'Require sensor location'
56
+ config_param :require_location, :bool, default: false
57
+ desc 'Fixed sensor location'
58
+ config_param :fixed_location, :array, default: nil
57
59
  end
58
60
 
59
61
  def configure(conf)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-festival
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toyokazu Akiyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-19 00:00:00.000000000 Z
11
+ date: 2017-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd