fluent-plugin-mysql-query 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -2
- data/README.md +15 -10
- data/fluent-plugin-mysql-query.gemspec +2 -1
- data/lib/fluent/plugin/in_mysql_query.rb +4 -8
- data/test/plugin/test_in_mysql_query.rb +1 -2
- metadata +4 -3
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,20 +1,19 @@
|
|
1
1
|
fluent-plugin-mysql-query [![Build Status](https://travis-ci.org/y-ken/fluent-plugin-mysql-query.png?branch=master)](https://travis-ci.org/y-ken/fluent-plugin-mysql-query)
|
2
2
|
===========================
|
3
3
|
|
4
|
-
Fluentd Input plugin to execute mysql query for stationary measurement.
|
4
|
+
Fluentd Input plugin to execute mysql query and fetch rows. It is useful for stationary interval metrics measurement.
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
8
|
-
|
8
|
+
install with gem or fluent-gem command as:
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
```
|
11
|
+
# for fluentd
|
12
|
+
$ gem install fluent-plugin-mysql-query
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
`````
|
14
|
+
# for td-agent
|
15
|
+
$ sudo /usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-mysql-query
|
16
|
+
```
|
18
17
|
|
19
18
|
## Configuration
|
20
19
|
|
@@ -65,7 +64,13 @@ input.mysql: {"hostname":"myhost.example.com","row_count":2,"data":[{"Variable_n
|
|
65
64
|
* SHOW FULL PROCESSLIST;
|
66
65
|
* INSERT INTO log (data, created_at) VALUES((SELECT MAX(id) FROM foo_table), NOW());
|
67
66
|
* SHOW SLAVE STATUS;
|
68
|
-
* SHOW INNODB STATUS;
|
67
|
+
* SHOW INNODB STATUS; -- MySQL 5.0
|
68
|
+
* SHOW ENGINE INNODB STATUS; -- MySQL 5.5 or later
|
69
|
+
|
70
|
+
### Tips
|
71
|
+
|
72
|
+
* Fetching query from multiple mysql host<br />
|
73
|
+
https://github.com/y-ken/fluent-plugin-mysql-query/issues/2
|
69
74
|
|
70
75
|
## TODO
|
71
76
|
patches welcome!
|
@@ -3,7 +3,8 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "fluent-plugin-mysql-query"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.3.0"
|
7
|
+
s.license = "Apache-2.0"
|
7
8
|
s.authors = ["Kentaro Yoshida"]
|
8
9
|
s.email = ["y.ken.studio@gmail.com"]
|
9
10
|
s.homepage = "https://github.com/y-ken/fluent-plugin-mysql-query"
|
@@ -13,22 +13,18 @@ module Fluent
|
|
13
13
|
config_param :password, :string, :default => nil
|
14
14
|
config_param :database, :string, :default => nil
|
15
15
|
config_param :encoding, :string, :default => 'utf8'
|
16
|
-
config_param :interval, :
|
16
|
+
config_param :interval, :time, :default => '1m'
|
17
17
|
config_param :tag, :string
|
18
18
|
config_param :query, :string
|
19
|
-
config_param :nest_result, :
|
19
|
+
config_param :nest_result, :bool, :default => false
|
20
20
|
config_param :nest_key, :string, :default => 'result'
|
21
|
-
config_param :row_count, :
|
21
|
+
config_param :row_count, :bool, :default => false
|
22
22
|
config_param :row_count_key, :string, :default => 'row_count'
|
23
|
-
config_param :record_hostname, :
|
23
|
+
config_param :record_hostname, :bool, :default => false
|
24
24
|
|
25
25
|
def configure(conf)
|
26
26
|
super
|
27
27
|
@hostname = nil
|
28
|
-
@interval = Config.time_value(@interval)
|
29
|
-
@nest_result = Config.bool_value(@nest_result) || false
|
30
|
-
@row_count = Config.bool_value(@row_count) || false
|
31
|
-
@record_hostname = Config.bool_value(@record_hostname) || false
|
32
28
|
$log.info "adding mysql_query job: [#{@query}] interval: #{@interval}sec"
|
33
29
|
end
|
34
30
|
|
@@ -30,12 +30,11 @@ class MysqlQueryInputTest < Test::Unit::TestCase
|
|
30
30
|
query SHOW VARIABLES LIKE 'Thread_%'
|
31
31
|
record_hostname yes
|
32
32
|
]
|
33
|
-
d.instance.inspect
|
34
33
|
assert_equal 'localhost', d.instance.host
|
35
34
|
assert_equal 3306, d.instance.port
|
36
35
|
assert_equal 30, d.instance.interval
|
37
36
|
assert_equal 'input.mysql', d.instance.tag
|
38
37
|
assert_equal true, d.instance.record_hostname
|
38
|
+
assert_equal false, d.instance.nest_result
|
39
39
|
end
|
40
40
|
end
|
41
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-mysql-query
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-07-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -77,7 +77,8 @@ files:
|
|
77
77
|
- test/helper.rb
|
78
78
|
- test/plugin/test_in_mysql_query.rb
|
79
79
|
homepage: https://github.com/y-ken/fluent-plugin-mysql-query
|
80
|
-
licenses:
|
80
|
+
licenses:
|
81
|
+
- Apache-2.0
|
81
82
|
post_install_message:
|
82
83
|
rdoc_options: []
|
83
84
|
require_paths:
|