fluent-plugin-prometheus 0.3.0 → 0.4.0
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/.travis.yml +0 -7
- data/Gemfile +2 -3
- data/LICENSE +202 -0
- data/README.md +24 -20
- data/fluent-plugin-prometheus.gemspec +4 -4
- data/lib/fluent/plugin/filter_prometheus.rb +1 -1
- data/lib/fluent/plugin/in_prometheus.rb +1 -0
- data/lib/fluent/plugin/in_prometheus_output_monitor.rb +5 -1
- data/lib/fluent/plugin/prometheus.rb +9 -20
- data/misc/fluentd_sample.conf +21 -12
- data/misc/prometheus_alerts.yaml +59 -0
- data/spec/fluent/plugin/filter_prometheus_spec.rb +1 -1
- data/spec/fluent/plugin/shared.rb +8 -4
- metadata +15 -10
- data/Gemfile.fluentd.0.10 +0 -4
- data/Gemfile.fluentd.0.12 +0 -3
- data/LICENSE.txt +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 464d04815988e50129af844c36fba2f260d88071
|
|
4
|
+
data.tar.gz: b8ea875d061ce8b83c6f6970fa41aefaf3aad7cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a4d5053269cc5ecce7318408905da8c104d9f544c963595334c156f9bf351da35b8b6dcea4fe4a8c75aae14ab867025fab0aa3fa8cc34173a5916d2f5c8e4db2
|
|
7
|
+
data.tar.gz: 0d38d9a9ba4830b03376bcff82dd86f4739145ffae3e07ae2d4b308fcd3f6440a096918976a2583ff72c2bdb032f0e037973e9bd71076d9fcf2f4494b5b572bc
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
data/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# fluent-plugin-prometheus, a plugin for [Fluentd](
|
|
1
|
+
# fluent-plugin-prometheus, a plugin for [Fluentd](https://www.fluentd.org)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This is the branch to support Fluentd v0.12. If you want to use Fluentd v0.14 or later, see [master branch](https://github.com/fluent/fluent-plugin-prometheus).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://travis-ci.org/fluent/fluent-plugin-prometheus)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A fluent plugin that instruments metrics from records and exposes them via web interface. Intended to be used together with a [Prometheus server](https://github.com/prometheus/prometheus).
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -24,10 +24,12 @@ Or install it yourself as:
|
|
|
24
24
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
|
27
|
-
fluentd-plugin-prometheus includes
|
|
27
|
+
fluentd-plugin-prometheus includes 6 plugins.
|
|
28
28
|
|
|
29
29
|
- `prometheus` input plugin
|
|
30
30
|
- `prometheus_monitor` input plugin
|
|
31
|
+
- `prometheus_output_monitor` input plugin
|
|
32
|
+
- `prometheus_tail_monitor` input plugin
|
|
31
33
|
- `prometheus` output plugin
|
|
32
34
|
- `prometheus` filter plugin
|
|
33
35
|
|
|
@@ -42,7 +44,7 @@ With following configuration, you can access http://localhost:24231/metrics on a
|
|
|
42
44
|
|
|
43
45
|
```
|
|
44
46
|
<source>
|
|
45
|
-
type prometheus
|
|
47
|
+
@type prometheus
|
|
46
48
|
</source>
|
|
47
49
|
```
|
|
48
50
|
|
|
@@ -65,7 +67,7 @@ Current exposed metrics:
|
|
|
65
67
|
With following configuration, those metrics are collected.
|
|
66
68
|
|
|
67
69
|
<source>
|
|
68
|
-
type prometheus_monitor
|
|
70
|
+
@type prometheus_monitor
|
|
69
71
|
</source>
|
|
70
72
|
|
|
71
73
|
More configuration parameters:
|
|
@@ -75,6 +77,8 @@ More configuration parameters:
|
|
|
75
77
|
|
|
76
78
|
### prometheus_output_monitor input plugin
|
|
77
79
|
|
|
80
|
+
**experimental**
|
|
81
|
+
|
|
78
82
|
This plugin collects internal metrics for output plugin in Fluentd. This is similar to `prometheus_monitor` plugin, but specialized for input plugin. There are Many metrics `prometheus_monitor` does not include, such as `num_errors`, `retry_wait` and so on.
|
|
79
83
|
|
|
80
84
|
Current exposed metrics:
|
|
@@ -97,7 +101,7 @@ Current exposed metrics:
|
|
|
97
101
|
With following configuration, those metrics are collected.
|
|
98
102
|
|
|
99
103
|
<source>
|
|
100
|
-
type prometheus_output_monitor
|
|
104
|
+
@type prometheus_output_monitor
|
|
101
105
|
</source>
|
|
102
106
|
|
|
103
107
|
More configuration parameters:
|
|
@@ -129,7 +133,7 @@ Default labels:
|
|
|
129
133
|
With following configuration, those metrics are collected.
|
|
130
134
|
|
|
131
135
|
<source>
|
|
132
|
-
type prometheus_output_monitor
|
|
136
|
+
@type prometheus_output_monitor
|
|
133
137
|
</source>
|
|
134
138
|
|
|
135
139
|
More configuration parameters:
|
|
@@ -145,7 +149,7 @@ Assuming you have following configuration and receiving message,
|
|
|
145
149
|
|
|
146
150
|
```
|
|
147
151
|
<match message>
|
|
148
|
-
type stdout
|
|
152
|
+
@type stdout
|
|
149
153
|
</match>
|
|
150
154
|
```
|
|
151
155
|
|
|
@@ -161,7 +165,7 @@ In filter plugin style,
|
|
|
161
165
|
|
|
162
166
|
```
|
|
163
167
|
<filter message>
|
|
164
|
-
type prometheus
|
|
168
|
+
@type prometheus
|
|
165
169
|
<metric>
|
|
166
170
|
name message_foo_counter
|
|
167
171
|
type counter
|
|
@@ -171,7 +175,7 @@ In filter plugin style,
|
|
|
171
175
|
</filter>
|
|
172
176
|
|
|
173
177
|
<match message>
|
|
174
|
-
type stdout
|
|
178
|
+
@type stdout
|
|
175
179
|
</match>
|
|
176
180
|
```
|
|
177
181
|
|
|
@@ -179,7 +183,7 @@ In output plugin style:
|
|
|
179
183
|
|
|
180
184
|
```
|
|
181
185
|
<filter message>
|
|
182
|
-
type prometheus
|
|
186
|
+
@type prometheus
|
|
183
187
|
<metric>
|
|
184
188
|
name message_foo_counter
|
|
185
189
|
type counter
|
|
@@ -189,9 +193,9 @@ In output plugin style:
|
|
|
189
193
|
</filter>
|
|
190
194
|
|
|
191
195
|
<match message>
|
|
192
|
-
type copy
|
|
196
|
+
@type copy
|
|
193
197
|
<store>
|
|
194
|
-
type prometheus
|
|
198
|
+
@type prometheus
|
|
195
199
|
<metric>
|
|
196
200
|
name message_foo_counter
|
|
197
201
|
type counter
|
|
@@ -200,7 +204,7 @@ In output plugin style:
|
|
|
200
204
|
</metric>
|
|
201
205
|
</store>
|
|
202
206
|
<store>
|
|
203
|
-
type stdout
|
|
207
|
+
@type stdout
|
|
204
208
|
</store>
|
|
205
209
|
</match>
|
|
206
210
|
```
|
|
@@ -336,7 +340,7 @@ Prometheus output/filter plugin can have multiple metric section. Top-level labe
|
|
|
336
340
|
|
|
337
341
|
```
|
|
338
342
|
<filter message>
|
|
339
|
-
type prometheus
|
|
343
|
+
@type prometheus
|
|
340
344
|
<metric>
|
|
341
345
|
name message_foo_counter
|
|
342
346
|
type counter
|
|
@@ -371,7 +375,7 @@ In this case, `message_foo_counter` has `tag`, `hostname`, `key` and `data_type`
|
|
|
371
375
|
Checkout repository and setup.
|
|
372
376
|
|
|
373
377
|
```
|
|
374
|
-
$ git clone git://github.com/
|
|
378
|
+
$ git clone git://github.com/fluent/fluent-plugin-prometheus
|
|
375
379
|
$ cd fluent-plugin-prometheus
|
|
376
380
|
$ bundle install --path vendor/bundle
|
|
377
381
|
```
|
|
@@ -415,7 +419,7 @@ Then, make a graph on Prometheus UI. http://localhost:9090/
|
|
|
415
419
|
|
|
416
420
|
## Contributing
|
|
417
421
|
|
|
418
|
-
1. Fork it ( https://github.com/
|
|
422
|
+
1. Fork it ( https://github.com/fluent/fluent-plugin-prometheus/fork )
|
|
419
423
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
420
424
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
421
425
|
4. Push to the branch (`git push origin my-new-feature`)
|
|
@@ -432,6 +436,6 @@ Then, make a graph on Prometheus UI. http://localhost:9090/
|
|
|
432
436
|
<td>Copyright</td><td>Copyright (c) 2015- Masahiro Sano</td>
|
|
433
437
|
</tr>
|
|
434
438
|
<tr>
|
|
435
|
-
<td>License</td><td>
|
|
439
|
+
<td>License</td><td>Apache License, Version 2.0</td>
|
|
436
440
|
</tr>
|
|
437
441
|
</table>
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
Gem::Specification.new do |spec|
|
|
2
2
|
spec.name = "fluent-plugin-prometheus"
|
|
3
|
-
spec.version = "0.
|
|
3
|
+
spec.version = "0.4.0"
|
|
4
4
|
spec.authors = ["Masahiro Sano"]
|
|
5
5
|
spec.email = ["sabottenda@gmail.com"]
|
|
6
6
|
spec.summary = %q{A fluent plugin that collects metrics and exposes for Prometheus.}
|
|
7
7
|
spec.description = %q{A fluent plugin that collects metrics and exposes for Prometheus.}
|
|
8
|
-
spec.homepage = "https://github.com/
|
|
9
|
-
spec.license = "
|
|
8
|
+
spec.homepage = "https://github.com/fluent/fluent-plugin-prometheus"
|
|
9
|
+
spec.license = "Apache-2.0"
|
|
10
10
|
|
|
11
11
|
spec.files = `git ls-files -z`.split("\x0")
|
|
12
12
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
13
13
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
14
14
|
spec.require_paths = ["lib"]
|
|
15
15
|
|
|
16
|
-
spec.add_dependency "fluentd"
|
|
16
|
+
spec.add_dependency "fluentd", ">= 0.12.0", "< 0.14.0"
|
|
17
17
|
spec.add_dependency "prometheus-client"
|
|
18
18
|
spec.add_development_dependency "bundler"
|
|
19
19
|
spec.add_development_dependency "rake"
|
|
@@ -10,6 +10,8 @@ module Fluent
|
|
|
10
10
|
attr_reader :registry
|
|
11
11
|
|
|
12
12
|
MONITOR_IVARS = [
|
|
13
|
+
:retry,
|
|
14
|
+
|
|
13
15
|
:num_errors,
|
|
14
16
|
:emit_count,
|
|
15
17
|
|
|
@@ -160,10 +162,12 @@ module Fluent
|
|
|
160
162
|
# v0.12 does not include start, use last_retry_time instead
|
|
161
163
|
start_time = info['instance_variables'][:last_retry_time]
|
|
162
164
|
end
|
|
165
|
+
|
|
166
|
+
wait = 0
|
|
163
167
|
if next_time && start_time
|
|
164
168
|
wait = next_time - start_time
|
|
165
|
-
@metrics[:retry_wait].set(label, wait.to_f)
|
|
166
169
|
end
|
|
170
|
+
@metrics[:retry_wait].set(label, wait.to_f)
|
|
167
171
|
end
|
|
168
172
|
end
|
|
169
173
|
end
|
|
@@ -45,27 +45,16 @@ module Fluent
|
|
|
45
45
|
|
|
46
46
|
def self.placeholder_expander(log)
|
|
47
47
|
# Use internal class in order to expand placeholder
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
# for v0.12
|
|
56
|
-
return Fluent::RecordTransformerFilter::PlaceholderExpander.new(log: log)
|
|
57
|
-
end
|
|
58
|
-
rescue LoadError => e
|
|
59
|
-
raise ConfigError, "cannot find filter_record_transformer plugin: #{e.message}"
|
|
60
|
-
end
|
|
61
|
-
else # for v0.10, use PlaceholderExapander in fluent-plugin-record-reformer plugin
|
|
62
|
-
begin
|
|
63
|
-
require 'fluent/plugin/out_record_reformer.rb'
|
|
64
|
-
return Fluent::RecordReformerOutput::PlaceholderExpander.new(log: log)
|
|
65
|
-
rescue LoadError => e
|
|
66
|
-
raise ConfigError, "cannot find fluent-plugin-record-reformer: #{e.message}"
|
|
67
|
-
end
|
|
48
|
+
require 'fluent/plugin/filter_record_transformer'
|
|
49
|
+
if defined?(Fluent::Plugin::RecordTransformerFilter::PlaceholderExpander)
|
|
50
|
+
# for v0.14
|
|
51
|
+
return Fluent::Plugin::RecordTransformerFilter::PlaceholderExpander.new(log: log)
|
|
52
|
+
else
|
|
53
|
+
# for v0.12
|
|
54
|
+
return Fluent::RecordTransformerFilter::PlaceholderExpander.new(log: log)
|
|
68
55
|
end
|
|
56
|
+
rescue LoadError => e
|
|
57
|
+
raise ConfigError, "cannot find filter_record_transformer plugin: #{e.message}"
|
|
69
58
|
end
|
|
70
59
|
|
|
71
60
|
def configure(conf)
|
data/misc/fluentd_sample.conf
CHANGED
|
@@ -5,6 +5,14 @@
|
|
|
5
5
|
@type prometheus
|
|
6
6
|
</source>
|
|
7
7
|
|
|
8
|
+
<source>
|
|
9
|
+
@type monitor_agent
|
|
10
|
+
</source>
|
|
11
|
+
|
|
12
|
+
<source>
|
|
13
|
+
@type forward
|
|
14
|
+
</source>
|
|
15
|
+
|
|
8
16
|
# input plugin that collects metrics from MonitorAgent
|
|
9
17
|
<source>
|
|
10
18
|
@type prometheus_monitor
|
|
@@ -52,6 +60,7 @@
|
|
|
52
60
|
key size
|
|
53
61
|
<labels>
|
|
54
62
|
host ${hostname}
|
|
63
|
+
foo bar
|
|
55
64
|
</labels>
|
|
56
65
|
</metric>
|
|
57
66
|
|
|
@@ -70,18 +79,18 @@
|
|
|
70
79
|
<match nginx>
|
|
71
80
|
@type copy
|
|
72
81
|
# for MonitorAgent sample
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
<store>
|
|
83
|
+
@id test_forward
|
|
84
|
+
@type forward
|
|
85
|
+
buffer_type memory
|
|
86
|
+
flush_interval 1s
|
|
87
|
+
max_retry_wait 2s
|
|
88
|
+
disable_retry_limit
|
|
89
|
+
<server>
|
|
90
|
+
host 127.0.0.1
|
|
91
|
+
port 20000
|
|
92
|
+
</server>
|
|
93
|
+
</store>
|
|
85
94
|
<store>
|
|
86
95
|
@type stdout
|
|
87
96
|
</store>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
ALERT FluentdNodeDown
|
|
2
|
+
IF up{job="fluentd"} == 0
|
|
3
|
+
FOR 10m
|
|
4
|
+
LABELS {
|
|
5
|
+
service = "fluentd",
|
|
6
|
+
severity = "warning"
|
|
7
|
+
}
|
|
8
|
+
ANNOTATIONS {
|
|
9
|
+
summary = "fluentd cannot be scraped",
|
|
10
|
+
description = "Prometheus could not scrape {{ $labels.job }} for more than 10 minutes",
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
ALERT FluentdNodeDown
|
|
14
|
+
IF up{job="fluentd"} == 0
|
|
15
|
+
FOR 30m
|
|
16
|
+
LABELS {
|
|
17
|
+
service = "fluentd",
|
|
18
|
+
severity = "critical"
|
|
19
|
+
}
|
|
20
|
+
ANNOTATIONS {
|
|
21
|
+
summary = "fluentd cannot be scraped",
|
|
22
|
+
description = "Prometheus could not scrape {{ $labels.job }} for more than 30 minutes",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ALERT FluentdQueueLength
|
|
26
|
+
IF rate(fluentd_status_buffer_queue_length[5m]) > 0.3
|
|
27
|
+
FOR 1m
|
|
28
|
+
LABELS {
|
|
29
|
+
service = "fluentd",
|
|
30
|
+
severity = "warning"
|
|
31
|
+
}
|
|
32
|
+
ANNOTATIONS {
|
|
33
|
+
summary = "fluentd node are failing",
|
|
34
|
+
description = "In the last 5 minutes, fluentd queues increased 30%. Current value is {{ $value }} ",
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
ALERT FluentdQueueLength
|
|
38
|
+
IF rate(fluentd_status_buffer_queue_length[5m]) > 0.5
|
|
39
|
+
FOR 1m
|
|
40
|
+
LABELS {
|
|
41
|
+
service = "fluentd",
|
|
42
|
+
severity = "critical"
|
|
43
|
+
}
|
|
44
|
+
ANNOTATIONS {
|
|
45
|
+
summary = "fluentd node are critical",
|
|
46
|
+
description = "In the last 5 minutes, fluentd queues increased 50%. Current value is {{ $value }} ",
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
ALERT FluentdRecordsCountsHigh
|
|
50
|
+
IF sum(rate(fluentd_record_counts{job="fluentd"}[5m])) BY (instance) > (3 * sum(rate(fluentd_record_counts{job="fluentd"}[15m])) BY (instance))
|
|
51
|
+
FOR 1m
|
|
52
|
+
LABELS {
|
|
53
|
+
service = "fluentd",
|
|
54
|
+
severity = "critical"
|
|
55
|
+
}
|
|
56
|
+
ANNOTATIONS {
|
|
57
|
+
summary = "fluentd records count are critical",
|
|
58
|
+
description = "In the last 5m, records counts increased 3 times, comparing to the latest 15 min.",
|
|
59
|
+
}
|
|
@@ -81,10 +81,14 @@ COUNTER_WITHOUT_KEY_CONFIG = BASE_CONFIG + %[
|
|
|
81
81
|
</metric>
|
|
82
82
|
]
|
|
83
83
|
|
|
84
|
+
def gen_time_suffix
|
|
85
|
+
return Time.now.to_f.to_s.gsub('.', '')
|
|
86
|
+
end
|
|
87
|
+
|
|
84
88
|
shared_context 'simple_config' do
|
|
85
89
|
let(:orig_name) { 'simple_foo' }
|
|
86
90
|
let(:config) { SIMPLE_CONFIG.gsub(orig_name, name.to_s) }
|
|
87
|
-
let(:name) { "#{orig_name}_#{
|
|
91
|
+
let(:name) { "#{orig_name}_#{gen_time_suffix}".to_sym }
|
|
88
92
|
let(:counter) { registry.get(name) }
|
|
89
93
|
end
|
|
90
94
|
|
|
@@ -99,14 +103,14 @@ end
|
|
|
99
103
|
shared_context 'placeholder_config' do
|
|
100
104
|
let(:orig_name) { 'placeholder_foo' }
|
|
101
105
|
let(:config) { PLACEHOLDER_CONFIG.gsub(orig_name, name.to_s) }
|
|
102
|
-
let(:name) { "#{orig_name}_#{
|
|
106
|
+
let(:name) { "#{orig_name}_#{gen_time_suffix}".to_sym }
|
|
103
107
|
let(:counter) { registry.get(name) }
|
|
104
108
|
end
|
|
105
109
|
|
|
106
110
|
shared_context 'counter_without_key_config' do
|
|
107
111
|
let(:orig_name) { 'without_key_foo' }
|
|
108
112
|
let(:config) { COUNTER_WITHOUT_KEY_CONFIG.gsub(orig_name, name.to_s) }
|
|
109
|
-
let(:name) { "#{orig_name}_#{
|
|
113
|
+
let(:name) { "#{orig_name}_#{gen_time_suffix}".to_sym }
|
|
110
114
|
let(:counter) { registry.get(name) }
|
|
111
115
|
end
|
|
112
116
|
|
|
@@ -172,7 +176,7 @@ shared_examples_for 'instruments record' do
|
|
|
172
176
|
|
|
173
177
|
it 'instruments counter metric' do
|
|
174
178
|
expect(counter.type).to eq(:counter)
|
|
175
|
-
expect(counter.get({test_key: 'test_value', key: 'foo1'})).to be_kind_of(
|
|
179
|
+
expect(counter.get({test_key: 'test_value', key: 'foo1'})).to be_kind_of(Numeric)
|
|
176
180
|
end
|
|
177
181
|
|
|
178
182
|
it 'instruments gauge metric' do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-prometheus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masahiro Sano
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-11-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fluentd
|
|
@@ -16,14 +16,20 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 0.12.0
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: 0.14.0
|
|
20
23
|
type: :runtime
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
24
27
|
- - ">="
|
|
25
28
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
29
|
+
version: 0.12.0
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 0.14.0
|
|
27
33
|
- !ruby/object:Gem::Dependency
|
|
28
34
|
name: prometheus-client
|
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -105,9 +111,7 @@ files:
|
|
|
105
111
|
- ".rspec"
|
|
106
112
|
- ".travis.yml"
|
|
107
113
|
- Gemfile
|
|
108
|
-
-
|
|
109
|
-
- Gemfile.fluentd.0.12
|
|
110
|
-
- LICENSE.txt
|
|
114
|
+
- LICENSE
|
|
111
115
|
- README.md
|
|
112
116
|
- Rakefile
|
|
113
117
|
- fluent-plugin-prometheus.gemspec
|
|
@@ -121,14 +125,15 @@ files:
|
|
|
121
125
|
- misc/fluentd_sample.conf
|
|
122
126
|
- misc/nginx_proxy.conf
|
|
123
127
|
- misc/prometheus.yaml
|
|
128
|
+
- misc/prometheus_alerts.yaml
|
|
124
129
|
- spec/fluent/plugin/filter_prometheus_spec.rb
|
|
125
130
|
- spec/fluent/plugin/out_prometheus_spec.rb
|
|
126
131
|
- spec/fluent/plugin/prometheus_spec.rb
|
|
127
132
|
- spec/fluent/plugin/shared.rb
|
|
128
133
|
- spec/spec_helper.rb
|
|
129
|
-
homepage: https://github.com/
|
|
134
|
+
homepage: https://github.com/fluent/fluent-plugin-prometheus
|
|
130
135
|
licenses:
|
|
131
|
-
-
|
|
136
|
+
- Apache-2.0
|
|
132
137
|
metadata: {}
|
|
133
138
|
post_install_message:
|
|
134
139
|
rdoc_options: []
|
|
@@ -146,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
146
151
|
version: '0'
|
|
147
152
|
requirements: []
|
|
148
153
|
rubyforge_project:
|
|
149
|
-
rubygems_version: 2.6.
|
|
154
|
+
rubygems_version: 2.6.13
|
|
150
155
|
signing_key:
|
|
151
156
|
specification_version: 4
|
|
152
157
|
summary: A fluent plugin that collects metrics and exposes for Prometheus.
|
data/Gemfile.fluentd.0.10
DELETED
data/Gemfile.fluentd.0.12
DELETED
data/LICENSE.txt
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2015 Masahiro Sano
|
|
2
|
-
|
|
3
|
-
MIT License
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|