fluent-plugin-calyptia-monitoring 0.1.0.rc → 0.1.0.rc5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efc4e7d0b11c4581475feb8c18c52a7e4366d8ada239ae16db853dc36eb886fd
4
- data.tar.gz: 5db76c13993681bab21c389ce6d5edf2c78e03b64540a409d4bc2791e26e6b29
3
+ metadata.gz: 45f4c392adfd8ddda9ee6c9387f0092472dec1a734274308de4ce6e325b5bc40
4
+ data.tar.gz: 0ba927c3eac167f867342ddfea86f885a2aa4c2f3ea099faa9dbad22fa4af9c1
5
5
  SHA512:
6
- metadata.gz: e74b8aecb6b7b83dafcb999daabe7ebd64d607fb9352ca3dfa14161d612c2bf12a9c3fd6125979203d928f4b1d46676084f49c6299ce68e21f4f92fa2a73647f
7
- data.tar.gz: 60137eaa0870327d7eb1c2485b04c0583558b375af3243ce3c11c94b6c70255d31cad86009d23e547f50dd578fd93b313a930575377c14b1cfdfcfeb01817c3f
6
+ metadata.gz: 3d147883bb7b483b9b141713e05e5c2ea63f8b69b7680acd0fa931e84c8c55028d6ba6a8a6876e898e1d72b9b3a446df1a5e2875f022c6d070a94f7c49930fa9
7
+ data.tar.gz: a9ccd6a159b2c6efdcf330cfa245b7b46b859bb5db476dc5e24e9dcecf9ee3a8439b7da28f0755176f1d52c42c7232230c9fca009e2032042a0b9cfcf28567db
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # fluent-plugin-calyptia-monitoring
2
2
 
3
- [Fluentd](https://fluentd.org/) input plugin to do something.
4
-
5
- TODO: write description for you plugin.
3
+ [Fluentd](https://fluentd.org/) input plugin to ingest metrics into Calyptia Cloud.
6
4
 
7
5
  ## Installation
8
6
 
@@ -26,15 +24,65 @@ And then execute:
26
24
  $ bundle
27
25
  ```
28
26
 
29
- ## Configuration
30
-
31
- You can generate configuration template:
32
-
27
+ ## Plugin helpers
28
+
29
+ * [timer](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-timer)
30
+ * [storage](https://docs.fluentd.org/v/1.0/plugin-helper-overview/api-plugin-helper-storage)
31
+
32
+ * See also: [Input Plugin Overview](https://docs.fluentd.org/v/1.0/input#overview)
33
+
34
+ ## Fluent::Plugin::CalyptiaMonitoringInput
35
+
36
+
37
+ ### \<cloud_monitoring\> section (required) (single)
38
+
39
+ ### Configuration
40
+
41
+ |parameter|type|description|default|
42
+ |---|---|---|---|
43
+ |endpoint|string (optional)|The endpoint for Monitoring API HTTP request, e.g. http://example.com/api|`TBD`|
44
+ |api_key|string (required)|The API KEY for Monitoring API HTTP request||
45
+ |rate|time (optional)|Emit monitoring values interval. (minimum interval is 30 seconds.)|`30`|
46
+ |pending_metrics_size|size (optional)|Setup pending metrics capacity size|`100`|
47
+
48
+ ### Example
49
+
50
+ This plugin works well with [cmetrics Fluentd extension for metrics plugin](https://github.com/calyptia/fluent-plugin-metrics-cmetrics).
51
+
52
+ And enabling RPC and configDump endpoint is required if sending Fluentd configuration:
53
+
54
+ ```aconf
55
+ <system>
56
+ # If users want to use multi workers feature which corresponds to logical number of CPUs, please comment out this line.
57
+ # workers "#{require 'etc'; Etc.nprocessors}"
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
62
+ <metrics>
63
+ @type cmetrics
64
+ </metrics>
65
+ rpc_endpoint 127.0.0.1:24444
66
+ enable_get_dump true
67
+ </system>
68
+ # And other configurations....
69
+
70
+ ## Fill YOUR_API_KEY with your Calyptia API KEY
71
+ <source>
72
+ @type calyptia_monitoring
73
+ @id input_caplyptia_moniroting
74
+ <cloud_monitoring>
75
+ # endpoint http://development-environment-or-production.fqdn:5000
76
+ api_key YOUR_API_KEY
77
+ rate 30
78
+ pending_metrics_size 100 # Specify capacity for pending metrics
79
+ </cloud_monitoring>
80
+ <storage>
81
+ @type local
82
+ path /path/to/agent/accessible/directories/agent_states
83
+ </storage>
84
+ </source>
33
85
  ```
34
- $ fluent-plugin-config-format input calyptia-monitoring
35
- ```
36
-
37
- You can copy and paste generated documents here.
38
86
 
39
87
  ## Copyright
40
88
 
@@ -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.rc"
6
+ spec.version = "0.1.0.rc5"
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.rc2"
27
+ spec.add_runtime_dependency "fluent-plugin-metrics-cmetrics", ">= 0.1.0.rc3"
28
28
  end
@@ -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.warn "MachineID is not retrived from ioreg. Using UUID instead."
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::NOENT
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.warn "MachineID is not retrived from #{DBUS_MACHINE_ID_PATH} or #{ETC_MACHINE_ID_PATH}. Using UUID instead."
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.warn "MachineID is not retrived from Registry. Using UUID instead."
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?
@@ -43,7 +43,7 @@ module Fluent
43
43
  400, # BadRequest
44
44
  ]
45
45
 
46
- config_section :cloud_monitoring, multi: false do
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
48
  config_param :endpoint, :string, default: "https://cloud-monitoring-api-dev.fluentbit.io"
49
49
  desc 'The API KEY for Monitoring API HTTP request'
@@ -222,8 +222,12 @@ module Fluent
222
222
  buffer += v
223
223
  end
224
224
  }
225
- unless add_metrics(buffer)
226
- 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}"
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.rc
4
+ version: 0.1.0.rc5
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-07-21 00:00:00.000000000 Z
11
+ date: 2021-07-29 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.rc2
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.rc2
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.0.3
128
+ rubygems_version: 3.2.22
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: Monitoring Fluentd via Calyptia Cloud