fluent-plugin-azuremonitormetrics 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -12
- data/README.md +2 -3
- data/fluent-plugin-azuremonitormetrics.gemspec +1 -1
- data/lib/fluent/plugin/in_azuremonitormetrics.rb +13 -11
- data/test/plugin/test_in_azuremonitormetrics.rb +14 -10
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bac133b5511787e20e2da55c91b6d982bb160ace
|
|
4
|
+
data.tar.gz: 88636285bcb39785699fcfd85f1f8ad50af2225a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f0b5a48ad01d68bc34aad68f2a0b6f6f754401cdca96d302ff7d7eb53abd4a2661dc1f1af541fbf3b44cf1094ff51b85e9256dd01dae1d8f87e629ba1b141f08
|
|
7
|
+
data.tar.gz: 408903ce49dfa8a5a6f3df6730d9e727aa5ff97204786bdd2f4f84ccb49dc86e0578deb4e04d3ef180dffdcc865ac2d6fd6f02c0999d98a12597bb41162036cc
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
fluent-plugin-azuremonitormetrics (0.0.
|
|
4
|
+
fluent-plugin-azuremonitormetrics (0.0.4)
|
|
5
5
|
azure_mgmt_monitor (~> 0.11.0)
|
|
6
6
|
fluentd (>= 0.10.30)
|
|
7
7
|
|
|
@@ -12,21 +12,22 @@ GEM
|
|
|
12
12
|
ms_rest_azure (~> 0.8.0)
|
|
13
13
|
concurrent-ruby (1.0.5)
|
|
14
14
|
cool.io (1.5.3)
|
|
15
|
+
dig_rb (1.0.1)
|
|
15
16
|
domain_name (0.5.20170404)
|
|
16
17
|
unf (>= 0.0.5, < 1.0.0)
|
|
17
|
-
faraday (0.
|
|
18
|
+
faraday (0.14.0)
|
|
18
19
|
multipart-post (>= 1.2, < 3)
|
|
19
20
|
faraday-cookie_jar (0.0.6)
|
|
20
21
|
faraday (>= 0.7.4)
|
|
21
22
|
http-cookie (~> 1.0.0)
|
|
22
|
-
fluentd (
|
|
23
|
+
fluentd (1.1.0)
|
|
23
24
|
cool.io (>= 1.4.5, < 2.0.0)
|
|
25
|
+
dig_rb (~> 1.0.0)
|
|
24
26
|
http_parser.rb (>= 0.5.1, < 0.7.0)
|
|
25
27
|
msgpack (>= 0.7.0, < 2.0.0)
|
|
26
|
-
ruby_dig (~> 0.0.2)
|
|
27
28
|
serverengine (>= 2.0.4, < 3.0.0)
|
|
28
29
|
sigdump (~> 0.2.2)
|
|
29
|
-
strptime (
|
|
30
|
+
strptime (>= 0.2.2, < 1.0.0)
|
|
30
31
|
tzinfo (~> 1.0)
|
|
31
32
|
tzinfo-data (~> 1.0)
|
|
32
33
|
yajl-ruby (~> 1.0)
|
|
@@ -42,26 +43,25 @@ GEM
|
|
|
42
43
|
faraday (~> 0.9)
|
|
43
44
|
faraday-cookie_jar (~> 0.0.6)
|
|
44
45
|
ms_rest (~> 0.7.0)
|
|
45
|
-
msgpack (1.
|
|
46
|
+
msgpack (1.2.2)
|
|
46
47
|
multipart-post (2.0.0)
|
|
47
48
|
power_assert (1.1.0)
|
|
48
49
|
rake (12.0.0)
|
|
49
|
-
|
|
50
|
-
serverengine (2.0.5)
|
|
50
|
+
serverengine (2.0.6)
|
|
51
51
|
sigdump (~> 0.2.2)
|
|
52
52
|
sigdump (0.2.4)
|
|
53
|
-
strptime (0.
|
|
53
|
+
strptime (0.2.3)
|
|
54
54
|
test-unit (3.2.5)
|
|
55
55
|
power_assert
|
|
56
56
|
thread_safe (0.3.6)
|
|
57
57
|
timeliness (0.3.8)
|
|
58
|
-
tzinfo (1.2.
|
|
58
|
+
tzinfo (1.2.5)
|
|
59
59
|
thread_safe (~> 0.1)
|
|
60
|
-
tzinfo-data (1.
|
|
60
|
+
tzinfo-data (1.2018.3)
|
|
61
61
|
tzinfo (>= 1.0.0)
|
|
62
62
|
unf (0.1.4)
|
|
63
63
|
unf_ext
|
|
64
|
-
unf_ext (0.0.7.
|
|
64
|
+
unf_ext (0.0.7.5)
|
|
65
65
|
yajl-ruby (1.3.1)
|
|
66
66
|
|
|
67
67
|
PLATFORMS
|
data/README.md
CHANGED
|
@@ -25,12 +25,11 @@ $ gem install fluent-plugin-azuremonitormetrics
|
|
|
25
25
|
client_id [Azure_Client_Id]
|
|
26
26
|
client_secret [Azure_Client_Secret]
|
|
27
27
|
|
|
28
|
-
timespan [timespan in
|
|
29
|
-
interval [
|
|
28
|
+
timespan [The query timespan in seconds - must be greater than 60] (default: 300)
|
|
29
|
+
interval [timegrain of the query] (default: PT1M, allowed values are: PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H, PT24H)
|
|
30
30
|
resource_uri [the identifier of the resource]
|
|
31
31
|
aggregation [list of aggregation types] (example: Average,count)
|
|
32
32
|
top [Max number of records to retrive]
|
|
33
|
-
orderby [The aggregation to use for sorting] (example: sum asc)
|
|
34
33
|
filter [filter to reduce metric data] (example A eq 'a1' and B eq '*')
|
|
35
34
|
result_type [reduces the set of data collected]
|
|
36
35
|
metrics [The name of the metrics to retrive, sperated by commas] (example: Network Out,Percentage CPU)
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |gem|
|
|
6
6
|
gem.name = "fluent-plugin-azuremonitormetrics"
|
|
7
|
-
gem.version = "0.0.
|
|
7
|
+
gem.version = "0.0.4"
|
|
8
8
|
gem.authors = ["Ilana Kantorov"]
|
|
9
9
|
gem.email = ["ilanak@microsoft.com"]
|
|
10
10
|
gem.description = %q{Input plugin for Azure Monitor Metrics.}
|
|
@@ -25,11 +25,10 @@ class Fluent::AzureMonitorMetricsInput < Fluent::Input
|
|
|
25
25
|
config_param :resource_uri, :string, :default => nil
|
|
26
26
|
config_param :aggregation, :string, :default => nil
|
|
27
27
|
config_param :top, :integer, :default => nil
|
|
28
|
-
config_param :orderby, :string, :default => nil
|
|
29
28
|
config_param :filter, :string, :default => nil
|
|
30
29
|
config_param :result_type, :string, :default => nil
|
|
31
30
|
config_param :metrics, :string, :default => nil
|
|
32
|
-
config_param :api_version, :string, :default => "
|
|
31
|
+
config_param :api_version, :string, :default => "2017-05-01-preview"
|
|
33
32
|
|
|
34
33
|
def initialize
|
|
35
34
|
super
|
|
@@ -77,19 +76,20 @@ class Fluent::AzureMonitorMetricsInput < Fluent::Input
|
|
|
77
76
|
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
78
77
|
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
timespanstring = "#{start_time.utc.iso8601}/#{end_time.utc.iso8601}"
|
|
80
|
+
top = @filter.nil? ? nil : @top
|
|
82
81
|
|
|
83
|
-
filter = "timeGrain eq duration'#{@interval}' #{metrics_string} #{aggregation_string} and startTime eq #{start_time.utc.iso8601} and endTime eq #{end_time.utc.iso8601}"
|
|
84
|
-
log.debug filter
|
|
85
82
|
{
|
|
86
83
|
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
87
84
|
path_params: {'resourceUri' => @resource_uri},
|
|
88
85
|
query_params: {'api-version' => @api_version,
|
|
89
|
-
'$top' =>
|
|
90
|
-
'$
|
|
91
|
-
'
|
|
92
|
-
'
|
|
86
|
+
'$top' => top,
|
|
87
|
+
'$filter' => @filter,
|
|
88
|
+
'timespan' => timespanstring,
|
|
89
|
+
'interval' => @interval,
|
|
90
|
+
'metric' => @metrics,
|
|
91
|
+
'resultType' => @result_type,
|
|
92
|
+
'aggregation'=> @aggregation},
|
|
93
93
|
headers: request_headers.merge(custom_headers || {}),
|
|
94
94
|
base_url: @client.base_url
|
|
95
95
|
}
|
|
@@ -130,7 +130,8 @@ class Fluent::AzureMonitorMetricsInput < Fluent::Input
|
|
|
130
130
|
response_content = http_response.body
|
|
131
131
|
unless status_code == 200
|
|
132
132
|
error_model = JSON.load(response_content)
|
|
133
|
-
log.error(
|
|
133
|
+
log.error("Error occurred while sending the request")
|
|
134
|
+
log.error(error_model)
|
|
134
135
|
end
|
|
135
136
|
|
|
136
137
|
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
@@ -140,6 +141,7 @@ class Fluent::AzureMonitorMetricsInput < Fluent::Input
|
|
|
140
141
|
result.body = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
141
142
|
rescue Exception => e
|
|
142
143
|
log.error("Error occurred in parsing the response")
|
|
144
|
+
log.error(e)
|
|
143
145
|
end
|
|
144
146
|
end
|
|
145
147
|
|
|
@@ -13,14 +13,14 @@ class AzureMonitorMetricsInputTest < Test::Unit::TestCase
|
|
|
13
13
|
client_secret test_client_secret
|
|
14
14
|
|
|
15
15
|
timespan 300
|
|
16
|
-
aggregation Average,count
|
|
17
16
|
interval PT1M
|
|
18
17
|
resource_uri /subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default/providers/Microsoft.Insights/metrics/BlobCapacity
|
|
18
|
+
aggregation Average,count
|
|
19
19
|
top 20
|
|
20
|
-
|
|
21
|
-
filter timeGrain eq duration'PT1M' and (name.value eq 'Network Out' or name.value eq 'Percentage CPU') and (aggregationType eq 'Average' or aggregationType eq 'Count') and startTime eq 2017-10-11T23:00:00Z and endTime eq 2017-11-22T15:00:00Z
|
|
20
|
+
filter A eq 'a1' and B eq '*'
|
|
22
21
|
result_type Success
|
|
23
|
-
|
|
22
|
+
metrics Percentage CPU
|
|
23
|
+
api_version 2017-05-01-preview
|
|
24
24
|
]
|
|
25
25
|
|
|
26
26
|
def create_driver_monitor_metrics(conf = CONFIG_MONITOR_METRICS)
|
|
@@ -33,12 +33,14 @@ class AzureMonitorMetricsInputTest < Test::Unit::TestCase
|
|
|
33
33
|
assert_equal 'test_tenant_id', d.instance.tenant_id
|
|
34
34
|
assert_equal 'test_client_id', d.instance.client_id
|
|
35
35
|
assert_equal 300, d.instance.timespan
|
|
36
|
+
assert_equal 'PT1M', d.instance.interval
|
|
36
37
|
assert_equal '/subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default/providers/Microsoft.Insights/metrics/BlobCapacity', d.instance.resource_uri
|
|
38
|
+
assert_equal 'Average,count', d.instance.aggregation
|
|
37
39
|
assert_equal 20, d.instance.top
|
|
38
|
-
assert_equal '
|
|
39
|
-
assert_equal "timeGrain eq duration'PT1M' and (name.value eq 'Network Out' or name.value eq 'Percentage CPU') and (aggregationType eq 'Average' or aggregationType eq 'Count') and startTime eq 2017-10-11T23:00:00Z and endTime eq 2017-11-22T15:00:00Z", d.instance.filter
|
|
40
|
+
assert_equal 'A eq \'a1\' and B eq \'*\'', d.instance.filter
|
|
40
41
|
assert_equal 'Success', d.instance.result_type
|
|
41
|
-
assert_equal '
|
|
42
|
+
assert_equal 'Percentage CPU', d.instance.metrics
|
|
43
|
+
assert_equal '2017-05-01-preview', d.instance.api_version
|
|
42
44
|
end
|
|
43
45
|
|
|
44
46
|
def test_set_query_options
|
|
@@ -46,11 +48,13 @@ class AzureMonitorMetricsInputTest < Test::Unit::TestCase
|
|
|
46
48
|
start_time = Time.now - 1000
|
|
47
49
|
end_time = Time.now
|
|
48
50
|
query_options = d.instance.set_path_options(start_time, end_time, {})
|
|
49
|
-
assert_equal '
|
|
50
|
-
assert_equal
|
|
51
|
+
assert_equal '2017-05-01-preview', query_options[:query_params]['api-version']
|
|
52
|
+
assert_equal 'A eq \'a1\' and B eq \'*\'', query_options[:query_params]['$filter']
|
|
53
|
+
assert_equal 'Average,count', query_options[:query_params]['aggregation']
|
|
54
|
+
assert_equal 'PT1M', query_options[:query_params]['interval']
|
|
51
55
|
assert_equal 20, query_options[:query_params]['$top']
|
|
52
|
-
assert_equal 'sum asc', query_options[:query_params]['$orderby']
|
|
53
56
|
assert_equal 'Success', query_options[:query_params]['resultType']
|
|
57
|
+
assert_equal 'Percentage CPU', query_options[:query_params]['metric']
|
|
54
58
|
assert_equal '/subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default/providers/Microsoft.Insights/metrics/BlobCapacity', query_options[:path_params]['resourceUri']
|
|
55
59
|
end
|
|
56
60
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-azuremonitormetrics
|
|
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
|
- Ilana Kantorov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2018-02-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fluentd
|