fluent-plugin-festival 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -5
- data/docs/tutorial.md +3 -3
- data/fluent-plugin-festival.gemspec +2 -2
- data/lib/fluent/plugin/festival_proxy.rb +25 -8
- data/lib/fluent/plugin/in_festival.rb +3 -3
- data/test/plugin/test_in_festival.rb +4 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffd09b60d96a422385ed83d21715333f16163c8d
|
4
|
+
data.tar.gz: 6c1b16397f48192b61465efb873b8941d58d8538
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3087b75bade794d00747b9b0fb6486b6748595b99a263b48ea0ad63a9a94536affc7973fad3cb563de48fdbfb0cb01055a1dbe17bf43d482f81c3d9d4798c10e
|
7
|
+
data.tar.gz: 9b413322b9da6c52d6ec5b9224b4c39f3c3d9da10db0e5da4ecb79e5d5628562d7d9a27fb2d89b9f5c6af5867834b2efcbd926bf79b5b36b325dca14bf78e240
|
data/README.md
CHANGED
@@ -35,10 +35,10 @@ Input Plugin can receive events from FESTIVAL EaaS API Server. It can be used vi
|
|
35
35
|
password festival_portal_password
|
36
36
|
polling_interval 30
|
37
37
|
<resource>
|
38
|
-
path /aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value
|
38
|
+
path /aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value/current_data
|
39
39
|
</resource>
|
40
40
|
<resource>
|
41
|
-
path /aggregators/IOT-0/testbeds/jose/resources/kyoto001_barometer-info-value
|
41
|
+
path /aggregators/IOT-0/testbeds/jose/resources/kyoto001_barometer-info-value/current_data
|
42
42
|
</resource>
|
43
43
|
</source>
|
44
44
|
|
@@ -49,7 +49,7 @@ Input Plugin can receive events from FESTIVAL EaaS API Server. It can be used vi
|
|
49
49
|
password festival_portal_password
|
50
50
|
polling_interval 180
|
51
51
|
<resource>
|
52
|
-
path /aggregators/IOT-0/testbeds/smartsantander/resources/smartsantander_u7jcfa_f3176-chemicalAgentAtmosphericConcentration:airParticles-sensor
|
52
|
+
path /aggregators/IOT-0/testbeds/smartsantander/resources/smartsantander_u7jcfa_f3176-chemicalAgentAtmosphericConcentration:airParticles-sensor/current_data
|
53
53
|
</resource>
|
54
54
|
</source>
|
55
55
|
```
|
@@ -59,13 +59,14 @@ Input Plugin can receive events from FESTIVAL EaaS API Server. It can be used vi
|
|
59
59
|
- **password** (required): password for the login_name
|
60
60
|
- **polling_interval** (optional): Polling interval (seconds) for accessing EaaS API (default: 60 seconds)
|
61
61
|
- **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
|
-
- **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,
|
63
|
-
(e.g. /aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value).
|
62
|
+
- **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
|
+
(e.g. /aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value/current_data).
|
64
64
|
|
65
65
|
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
66
|
|
67
67
|
```
|
68
68
|
{
|
69
|
+
"resourceName": "/aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value/current_data",
|
69
70
|
"dataValue": "1001.16"
|
70
71
|
}
|
71
72
|
```
|
data/docs/tutorial.md
CHANGED
@@ -23,10 +23,10 @@ Create a sample configuration file as follows. You need to change festival_porta
|
|
23
23
|
password festival_portal_password
|
24
24
|
polling_interval 30
|
25
25
|
<resource>
|
26
|
-
path /aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value
|
26
|
+
path /aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value/current_data
|
27
27
|
</resource>
|
28
28
|
<resource>
|
29
|
-
path /aggregators/IOT-0/testbeds/jose/resources/kyoto001_barometer-info-value
|
29
|
+
path /aggregators/IOT-0/testbeds/jose/resources/kyoto001_barometer-info-value/current_data
|
30
30
|
</resource>
|
31
31
|
</source>
|
32
32
|
|
@@ -37,7 +37,7 @@ Create a sample configuration file as follows. You need to change festival_porta
|
|
37
37
|
password festival_portal_password
|
38
38
|
polling_interval 180
|
39
39
|
<resource>
|
40
|
-
path /aggregators/IOT-0/testbeds/smartsantander/resources/smartsantander_u7jcfa_f3176-chemicalAgentAtmosphericConcentration:airParticles-sensor
|
40
|
+
path /aggregators/IOT-0/testbeds/smartsantander/resources/smartsantander_u7jcfa_f3176-chemicalAgentAtmosphericConcentration:airParticles-sensor/current_data
|
41
41
|
</resource>
|
42
42
|
</source>
|
43
43
|
|
@@ -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.
|
7
|
+
spec.version = "0.0.4"
|
8
8
|
spec.authors = ["Toyokazu Akiyama"]
|
9
9
|
spec.email = ["toyokazu@gmail.com"]
|
10
10
|
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.required_ruby_version = '>= 2.
|
21
|
+
spec.required_ruby_version = '>= 2.2.0'
|
22
22
|
|
23
23
|
spec.add_dependency 'fluentd', '~> 0.14.0'
|
24
24
|
|
@@ -85,10 +85,10 @@ module Fluent::Plugin
|
|
85
85
|
# end
|
86
86
|
#end
|
87
87
|
|
88
|
-
def get_data_request(path
|
88
|
+
def get_data_request(path)
|
89
89
|
#get_data_req = @uri + target_path(type)
|
90
90
|
|
91
|
-
get_data_req = @uri + Pathname("/festival/eaas/experimentation/#{path}
|
91
|
+
get_data_req = @uri + Pathname("/festival/eaas/experimentation/#{path}").cleanpath.to_s
|
92
92
|
#get_data_req.query = URI.encode_www_form(get_data_params)
|
93
93
|
$log.debug "#{get_data_req}"
|
94
94
|
# currently time window is automatically updated
|
@@ -104,7 +104,11 @@ module Fluent::Plugin
|
|
104
104
|
}
|
105
105
|
end
|
106
106
|
|
107
|
-
def
|
107
|
+
def resource_type(path)
|
108
|
+
Pathname(path).basename.to_s
|
109
|
+
end
|
110
|
+
|
111
|
+
def get_data
|
108
112
|
if !valid_session?
|
109
113
|
return nil if create_session.nil?
|
110
114
|
$log.debug "session #{@session} created."
|
@@ -113,11 +117,24 @@ module Fluent::Plugin
|
|
113
117
|
#require 'pry-byebug'
|
114
118
|
$log.debug "@resources: #{@resources.inspect}"
|
115
119
|
@resources.each do |resource|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
120
|
+
case resource_type(resource.path)
|
121
|
+
when "current_data" then
|
122
|
+
$log.debug "get_data: request #{get_data_request(resource.path)}, #{get_data_header.inspect}"
|
123
|
+
get_data_res = @https.get(get_data_request(resource.path), get_data_header)
|
124
|
+
return nil if !error_handler(get_data_res,"get_data failed.")
|
125
|
+
$log.debug "get_data: #{get_data_res.body}"
|
126
|
+
data << {
|
127
|
+
"resourceName": resource.path,
|
128
|
+
"dataValue": JSON.parse(get_data_res.body)["dataValue"]
|
129
|
+
}
|
130
|
+
when "historical_data" then
|
131
|
+
$log.error "historical_data is not supported yet"
|
132
|
+
return nil
|
133
|
+
else
|
134
|
+
$log.error "The other resource type is not supported yet"
|
135
|
+
$log.error "resource_type: #{resource_type(resource.path)}"
|
136
|
+
return nil
|
137
|
+
end
|
121
138
|
end
|
122
139
|
if data.size > 1
|
123
140
|
return data
|
@@ -36,7 +36,7 @@ module Fluent::Plugin
|
|
36
36
|
# A resource URI example
|
37
37
|
# https://api.festival-project.eu/festival/eaas/experimentation/aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value/current_data
|
38
38
|
# <resource>
|
39
|
-
# path /aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value
|
39
|
+
# path /aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value/current_data
|
40
40
|
# </resource>
|
41
41
|
#
|
42
42
|
# Resource ID case (not supported now):
|
@@ -49,7 +49,7 @@ module Fluent::Plugin
|
|
49
49
|
# If you want to specify historical data
|
50
50
|
config_section :resource, param_name: :resources, required: true, multi: true do
|
51
51
|
desc 'Resource path'
|
52
|
-
# e.g. /aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value
|
52
|
+
# e.g. /aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value/current_data
|
53
53
|
config_param :path, :string
|
54
54
|
# e.g. IT-0, OD-0, IOT-0, LL-0
|
55
55
|
#base.config_param :aggregator_id, :string, :default => nil
|
@@ -73,7 +73,7 @@ module Fluent::Plugin
|
|
73
73
|
def get_loop
|
74
74
|
while (true)
|
75
75
|
begin
|
76
|
-
data =
|
76
|
+
data = get_data
|
77
77
|
emit(data) if !(data.nil? || data.empty?)
|
78
78
|
sleep @polling_interval
|
79
79
|
rescue Exception => e
|
@@ -23,17 +23,17 @@ class FestivalInputTest < Test::Unit::TestCase
|
|
23
23
|
password login_password
|
24
24
|
polling_interval 30
|
25
25
|
<resource>
|
26
|
-
path /aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value
|
26
|
+
path /aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value/current_data
|
27
27
|
</resource>
|
28
28
|
<resource>
|
29
|
-
path /aggregators/IOT-0/testbeds/jose/resources/kyoto001_barometer-info-value
|
29
|
+
path /aggregators/IOT-0/testbeds/jose/resources/kyoto001_barometer-info-value/current_data
|
30
30
|
</resource>
|
31
31
|
]
|
32
32
|
assert_equal 'test', d.instance.tag
|
33
33
|
assert_equal 'login_password', d.instance.password
|
34
34
|
assert_equal 30, d.instance.polling_interval
|
35
|
-
assert_equal '/aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value', d.instance.resources[0].path
|
36
|
-
assert_equal '/aggregators/IOT-0/testbeds/jose/resources/kyoto001_barometer-info-value', d.instance.resources[1].path
|
35
|
+
assert_equal '/aggregators/IOT-0/testbeds/jose/resources/hyogo001_barometer-info-value/current_data', d.instance.resources[0].path
|
36
|
+
assert_equal '/aggregators/IOT-0/testbeds/jose/resources/kyoto001_barometer-info-value/current_data', d.instance.resources[1].path
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
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.
|
4
|
+
version: 0.0.4
|
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-04-
|
11
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -95,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
95
|
requirements:
|
96
96
|
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: 2.
|
98
|
+
version: 2.2.0
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|