fluent-plugin-calyptia-monitoring 0.1.0.rc2 → 0.1.0.rc6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/fluent-plugin-calyptia-monitoring.gemspec +2 -2
- data/lib/fluent/plugin/calyptia_monitoring_calyptia_api_requester.rb +6 -6
- data/lib/fluent/plugin/calyptia_monitoring_ext.rb +2 -0
- data/lib/fluent/plugin/calyptia_monitoring_machine_id.rb +4 -4
- data/lib/fluent/plugin/in_calyptia_monitoring.rb +7 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc96c5b09c542854a7fc86e735d01c1b8d15d6ffcacc35d21bc4e02578f7d379
|
4
|
+
data.tar.gz: 1deccf93ccb4b41f802099d72b33670459d78c65917af979dd074041de6b964f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba2e21ff1a791fcf81d33d3c568874ac672c3b9882e942007e57c403f2f0d0a12d211b473244bff8303f58bb5b853f2d9acb6c2d527e0d9623484c0a626f26b1
|
7
|
+
data.tar.gz: 62b0c374c5917ca03d8b836fdf2508838e4cc134d04e25873021fd972fa9914f5a38888e2de62d335b5576883307c343ec72b3f00d5959eb502cf9cd8ec9e87d
|
data/README.md
CHANGED
@@ -49,13 +49,16 @@ $ bundle
|
|
49
49
|
|
50
50
|
This plugin works well with [cmetrics Fluentd extension for metrics plugin](https://github.com/calyptia/fluent-plugin-metrics-cmetrics).
|
51
51
|
|
52
|
-
And enabling RPC and configDump endpoint is
|
52
|
+
And enabling RPC and configDump endpoint is required if sending Fluentd configuration:
|
53
53
|
|
54
54
|
```aconf
|
55
55
|
<system>
|
56
56
|
# If users want to use multi workers feature which corresponds to logical number of CPUs, please comment out this line.
|
57
57
|
# workers "#{require 'etc'; Etc.nprocessors}"
|
58
58
|
enable_input_metrics true
|
59
|
+
# This record size measuring settings might impact for performance.
|
60
|
+
# Please be careful for high loaded environment to turn on.
|
61
|
+
enable_size_metrics true
|
59
62
|
<metrics>
|
60
63
|
@type cmetrics
|
61
64
|
</metrics>
|
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = "fluent-plugin-calyptia-monitoring"
|
6
|
-
spec.version = "0.1.0.
|
6
|
+
spec.version = "0.1.0.rc6"
|
7
7
|
spec.authors = ["Hiroshi Hatake"]
|
8
8
|
spec.email = ["hatake@calyptia.com"]
|
9
9
|
|
@@ -24,5 +24,5 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "rake", "~> 13.0"
|
25
25
|
spec.add_development_dependency "test-unit", "~> 3.3"
|
26
26
|
spec.add_runtime_dependency "fluentd", [">= 1.13.0", "< 2"]
|
27
|
-
spec.add_runtime_dependency "fluent-plugin-metrics-cmetrics", ">= 0.1.0.
|
27
|
+
spec.add_runtime_dependency "fluent-plugin-metrics-cmetrics", ">= 0.1.0.rc3"
|
28
28
|
end
|
@@ -51,10 +51,10 @@ module Fluent::Plugin
|
|
51
51
|
metadata
|
52
52
|
end
|
53
53
|
|
54
|
-
# POST /
|
54
|
+
# POST /v1/agents
|
55
55
|
# Authorization: X-Project-Token
|
56
56
|
def create_agent(current_config)
|
57
|
-
url = URI("#{@endpoint}/
|
57
|
+
url = URI("#{@endpoint}/v1/agents")
|
58
58
|
|
59
59
|
https = if proxy = proxies
|
60
60
|
proxy_uri = URI.parse(proxy)
|
@@ -75,10 +75,10 @@ module Fluent::Plugin
|
|
75
75
|
return [response.code, agent, machine_id]
|
76
76
|
end
|
77
77
|
|
78
|
-
# PATCH /
|
78
|
+
# PATCH /v1/agents/:agent_id
|
79
79
|
# Authorization: X-Agent-Token
|
80
80
|
def update_agent(current_config, agent, machine_id)
|
81
|
-
url = URI("#{@endpoint}/
|
81
|
+
url = URI("#{@endpoint}/v1/agents/#{agent['id']}")
|
82
82
|
|
83
83
|
https = if proxy = proxies
|
84
84
|
proxy_uri = URI.parse(proxy)
|
@@ -100,10 +100,10 @@ module Fluent::Plugin
|
|
100
100
|
return [response.code, body]
|
101
101
|
end
|
102
102
|
|
103
|
-
# POST /
|
103
|
+
# POST /v1/agents/:agent_id/metrics
|
104
104
|
# Authorization: X-Agent-Token
|
105
105
|
def add_metrics(metrics, agent_token, agent_id)
|
106
|
-
url = URI("#{@endpoint}/
|
106
|
+
url = URI("#{@endpoint}/v1/agents/#{agent_id}/metrics")
|
107
107
|
|
108
108
|
https = if proxy = proxies
|
109
109
|
proxy_uri = URI.parse(proxy)
|
@@ -19,9 +19,11 @@ module Fluent::Plugin
|
|
19
19
|
class CalyptiaMonitoringExtInput < MonitorAgentInput
|
20
20
|
CALYPTIA_PLUGIN_METRIC_INFO = {
|
21
21
|
'emit_size' => ->(){
|
22
|
+
throw(:skip) if @emit_size_metrics.get.nil?
|
22
23
|
@emit_size_metrics.cmetrics.to_msgpack
|
23
24
|
},
|
24
25
|
'emit_records' => ->(){
|
26
|
+
throw(:skip) if @emit_records_metrics.get.nil?
|
25
27
|
@emit_records_metrics.cmetrics.to_msgpack
|
26
28
|
},
|
27
29
|
'retry_count' => ->(){
|
@@ -53,7 +53,7 @@ module Fluent::Plugin
|
|
53
53
|
require 'open3'
|
54
54
|
o,_e, s = Open3.capture3 %q(ioreg -d2 -c IOPlatformExpertDevice | awk -F\" '/IOPlatformUUID/{print $(NF-1)}')
|
55
55
|
unless s.success?
|
56
|
-
@log.
|
56
|
+
@log.info "MachineID is not retrived from ioreg. Using UUID instead."
|
57
57
|
"#{SecureRandom.uuid}:#{@worker_id}"
|
58
58
|
else
|
59
59
|
# TODO: The prefix should be removed?
|
@@ -65,11 +65,11 @@ module Fluent::Plugin
|
|
65
65
|
machine_id = ""
|
66
66
|
begin
|
67
67
|
machine_id = File.read(DBUS_MACHINE_ID_PATH).strip
|
68
|
-
rescue Errno::
|
68
|
+
rescue Errno::ENOENT
|
69
69
|
machine_id = File.read(ETC_MACHINE_ID_PATH).strip rescue ""
|
70
70
|
end
|
71
71
|
if machine_id.empty?
|
72
|
-
@log.
|
72
|
+
@log.info "MachineID is not retrived from #{DBUS_MACHINE_ID_PATH} or #{ETC_MACHINE_ID_PATH}. Using UUID instead."
|
73
73
|
"#{SecureRandom.uuid}:#{@worker_id}"
|
74
74
|
else
|
75
75
|
# TODO: The prefix should be removed?
|
@@ -85,7 +85,7 @@ module Fluent::Plugin
|
|
85
85
|
machine_id = key.read("MachineGuid")[1] rescue ""
|
86
86
|
end
|
87
87
|
if machine_id.empty?
|
88
|
-
@log.
|
88
|
+
@log.info "MachineID is not retrived from Registry. Using UUID instead."
|
89
89
|
"#{SecureRandom.uuid}:#{@worker_id}"
|
90
90
|
else
|
91
91
|
# TODO: The prefix should be removed?
|
@@ -45,7 +45,7 @@ module Fluent
|
|
45
45
|
|
46
46
|
config_section :cloud_monitoring, multi: false, required: true do
|
47
47
|
desc 'The endpoint for Monitoring API HTTP request, e.g. http://example.com/api'
|
48
|
-
config_param :endpoint, :string, default: "https://cloud-
|
48
|
+
config_param :endpoint, :string, default: "https://cloud-api.calyptia.com"
|
49
49
|
desc 'The API KEY for Monitoring API HTTP request'
|
50
50
|
config_param :api_key, :string, secret: true
|
51
51
|
desc 'Emit monitoring values interval. (minimum interval is 30 seconds.)'
|
@@ -222,8 +222,12 @@ module Fluent
|
|
222
222
|
buffer += v
|
223
223
|
end
|
224
224
|
}
|
225
|
-
|
226
|
-
log.
|
225
|
+
if buffer.empty?
|
226
|
+
log.debug "No initialized metrics is found. Trying to send cmetrics on the next tick."
|
227
|
+
else
|
228
|
+
unless add_metrics(buffer)
|
229
|
+
log.warn "Sending metrics is failed. Trying to send pending buffers in the next interval: #{@cloud_monitoring.rate}, next sending time: #{Time.now + @cloud_monitoring.rate}"
|
230
|
+
end
|
227
231
|
end
|
228
232
|
end
|
229
233
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-calyptia-monitoring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.rc6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroshi Hatake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.1.0.
|
81
|
+
version: 0.1.0.rc3
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.1.0.
|
88
|
+
version: 0.1.0.rc3
|
89
89
|
description: Monitoring Fluentd via Calyptia Cloud
|
90
90
|
email:
|
91
91
|
- hatake@calyptia.com
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: 1.3.1
|
127
127
|
requirements: []
|
128
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.2.22
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: Monitoring Fluentd via Calyptia Cloud
|