fluent-plugin-prometheus 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +2 -2
- data/Gemfile.fluentd.0.12 +3 -0
- data/README.md +1 -1
- data/fluent-plugin-prometheus.gemspec +1 -1
- data/lib/fluent/plugin/in_prometheus.rb +1 -0
- data/lib/fluent/plugin/in_prometheus_monitor.rb +5 -3
- data/lib/fluent/plugin/out_prometheus.rb +1 -0
- data/lib/fluent/plugin/prometheus.rb +2 -2
- data/misc/fluentd_sample.conf +11 -11
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2697668d79174be33f93db6777808ba2e4b6e856
|
4
|
+
data.tar.gz: 9a842e147273f306bd2b7d18fbf6f2ca35ba3de9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f25473b6467b07dcc4e25ca95696abb22aa2c1bafaf44707ba07bae3ae5d0f3bf89c6cbe62dc57858630bfcab9e2bf85b13d3d7f0423e9ed8dbd504bca33ed1e
|
7
|
+
data.tar.gz: 90a812f445c0b53189119ffe6e62d7eba8541528ace398c1caaebcf991c961ffa063ae440d338614559f436a0a619a9e1ac994f5270bcea0cfed74b3069398ed
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
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).
|
6
6
|
|
7
|
-
If you are using Fluentd v0.10, you have to explicitly install [fluent-plugin-record-reformer](https://github.com/sonots/fluent-plugin-record-reformer) together. With Fluentd v0.12, there is no additional dependency.
|
7
|
+
If you are using Fluentd v0.10, you have to explicitly install [fluent-plugin-record-reformer](https://github.com/sonots/fluent-plugin-record-reformer) together. With Fluentd v0.12 or v0.14, there is no additional dependency.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "fluent-plugin-prometheus"
|
3
|
-
spec.version = "0.1.
|
3
|
+
spec.version = "0.1.3"
|
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.}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'fluent/input'
|
2
|
+
require 'fluent/plugin/in_monitor_agent'
|
1
3
|
require 'fluent/plugin/prometheus'
|
2
4
|
require 'webrick'
|
3
5
|
|
@@ -16,21 +18,21 @@ module Fluent
|
|
16
18
|
def configure(conf)
|
17
19
|
super
|
18
20
|
hostname = Socket.gethostname
|
19
|
-
expander = Fluent::Prometheus.
|
21
|
+
expander = Fluent::Prometheus.placeholder_expander(log)
|
20
22
|
placeholders = expander.prepare_placeholders({'hostname' => hostname})
|
21
23
|
@base_labels = Fluent::Prometheus.parse_labels_elements(conf)
|
22
24
|
@base_labels.each do |key, value|
|
23
25
|
@base_labels[key] = expander.expand(value, placeholders)
|
24
26
|
end
|
25
27
|
|
26
|
-
@monitor_agent = MonitorAgentInput.new
|
28
|
+
@monitor_agent = Fluent::MonitorAgentInput.new
|
27
29
|
|
28
30
|
buffer_queue_length = @registry.gauge(
|
29
31
|
:fluentd_status_buffer_queue_length,
|
30
32
|
'Current buffer queue length.')
|
31
33
|
buffer_total_queued_size = @registry.gauge(
|
32
34
|
:fluentd_status_buffer_total_bytes,
|
33
|
-
'Current total size of
|
35
|
+
'Current total size of queued buffers.')
|
34
36
|
retry_counts = @registry.gauge(
|
35
37
|
:fluentd_status_retry_count,
|
36
38
|
'Current retry counts.')
|
@@ -41,7 +41,7 @@ module Fluent
|
|
41
41
|
metrics
|
42
42
|
end
|
43
43
|
|
44
|
-
def self.
|
44
|
+
def self.placeholder_expander(log)
|
45
45
|
# Use internal class in order to expand placeholder
|
46
46
|
if defined?(Fluent::Filter) # for v0.12, built-in PlaceholderExpander
|
47
47
|
begin
|
@@ -62,7 +62,7 @@ module Fluent
|
|
62
62
|
|
63
63
|
def configure(conf)
|
64
64
|
super
|
65
|
-
@placeholder_expander = Fluent::Prometheus.
|
65
|
+
@placeholder_expander = Fluent::Prometheus.placeholder_expander(log)
|
66
66
|
@hostname = Socket.gethostname
|
67
67
|
end
|
68
68
|
|
data/misc/fluentd_sample.conf
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
# input plugin that exports metrics
|
4
4
|
<source>
|
5
|
-
type prometheus
|
5
|
+
@type prometheus
|
6
6
|
</source>
|
7
7
|
|
8
8
|
# input plugin that collects metrics from MonitorAgent
|
9
9
|
<source>
|
10
|
-
type prometheus_monitor
|
10
|
+
@type prometheus_monitor
|
11
11
|
<labels>
|
12
12
|
host ${hostname}
|
13
13
|
</labels>
|
@@ -16,7 +16,7 @@
|
|
16
16
|
## Nginx Access Log Configuration
|
17
17
|
|
18
18
|
<source>
|
19
|
-
type tail
|
19
|
+
@type tail
|
20
20
|
format nginx
|
21
21
|
tag nginx
|
22
22
|
path /var/log/nginx/access.log
|
@@ -25,7 +25,7 @@
|
|
25
25
|
</source>
|
26
26
|
|
27
27
|
<filter nginx>
|
28
|
-
type prometheus
|
28
|
+
@type prometheus
|
29
29
|
|
30
30
|
# You can use counter type with specifying a key,
|
31
31
|
# and increments counter by the value
|
@@ -52,11 +52,11 @@
|
|
52
52
|
</filter>
|
53
53
|
|
54
54
|
<match nginx>
|
55
|
-
type copy
|
55
|
+
@type copy
|
56
56
|
# for MonitorAgent sample
|
57
57
|
# <store>
|
58
58
|
# @id test_forward
|
59
|
-
# type forward
|
59
|
+
# @type forward
|
60
60
|
# buffer_type memory
|
61
61
|
# <server>
|
62
62
|
# host 127.0.0.1
|
@@ -64,14 +64,14 @@
|
|
64
64
|
# </server>
|
65
65
|
# </store>
|
66
66
|
<store>
|
67
|
-
type stdout
|
67
|
+
@type stdout
|
68
68
|
</store>
|
69
69
|
</match>
|
70
70
|
|
71
71
|
## Nginx Proxy Log Configuration
|
72
72
|
|
73
73
|
<source>
|
74
|
-
type tail
|
74
|
+
@type tail
|
75
75
|
format ltsv
|
76
76
|
tag nginx_proxy
|
77
77
|
path /var/log/nginx/access_proxy.log
|
@@ -80,7 +80,7 @@
|
|
80
80
|
</source>
|
81
81
|
|
82
82
|
<filter nginx_proxy>
|
83
|
-
type prometheus
|
83
|
+
@type prometheus
|
84
84
|
|
85
85
|
# common labels for all metrics
|
86
86
|
<labels>
|
@@ -128,8 +128,8 @@
|
|
128
128
|
</filter>
|
129
129
|
|
130
130
|
<match nginx_proxy>
|
131
|
-
type copy
|
131
|
+
@type copy
|
132
132
|
<store>
|
133
|
-
type stdout
|
133
|
+
@type stdout
|
134
134
|
</store>
|
135
135
|
</match>
|
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.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Sano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04
|
11
|
+
date: 2016-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- ".travis.yml"
|
107
107
|
- Gemfile
|
108
108
|
- Gemfile.fluentd.0.10
|
109
|
+
- Gemfile.fluentd.0.12
|
109
110
|
- LICENSE.txt
|
110
111
|
- README.md
|
111
112
|
- Rakefile
|