fluent-plugin-munin 0.1.3 → 0.2.2

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.
data/README.md CHANGED
@@ -23,12 +23,17 @@ gem install fluent-plugin-munin
23
23
  `````
24
24
  <source>
25
25
  type munin
26
- server localhost # Optional (default: localhost)
27
- port 4949 # Optional (default: 4949)
28
- interval 10s # Optional (default: 1m)
29
- tag_prefix input.munin # Required
30
- service cpu,df # Optional (not specify, fetch all enabled munin metrics)
31
- record_hostname yes # Optional (yes/no)
26
+ host localhost # Optional (default: localhost)
27
+ port 4949 # Optional (default: 4949)
28
+ interval 10s # Optional (default: 1m)
29
+ tag_prefix input.munin # Required
30
+ # specify munin plugin names by comma separated values.
31
+ service cpu # Optional (not specify, fetch all enabled munin metrics)
32
+ # inserting hostname into record.
33
+ record_hostname yes # Optional (yes/no)
34
+ # multi row results to be nested or separated record.
35
+ nest_result no # Optional (yes/no)
36
+ nest_keyname data # Optional (default: result)
32
37
  </source>
33
38
 
34
39
  <match input.munin.*>
@@ -37,10 +42,28 @@ gem install fluent-plugin-munin
37
42
  `````
38
43
 
39
44
  ### Output Sample
45
+ record_hostname: no, nest_result: no
46
+ `````
47
+ input.munin.cpu: {"service":"cpu","user":"113183","nice":"340","system":"26584","idle":"74205345","iowait":"26134","irq":"1","softirq":"506","steal":"0","guest":"0"}
48
+ `````
49
+
50
+ record_hostname: yes, nest_result: no
40
51
  `````
41
52
  input.munin.cpu: {"hostname":"myhost.example.com","service":"cpu","user":"113183","nice":"340","system":"26584","idle":"74205345","iowait":"26134","irq":"1","softirq":"506","steal":"0","guest":"0"}
42
53
  `````
43
54
 
55
+ record_hostname: yes, nest_result: yes
56
+ `````
57
+ input.munin.cpu: {"hostname":"myhost.example.com","service":"cpu","data":{"user":"113183","nice":"340","system":"26584","idle":"74205345","iowait":"26134","irq":"1","softirq":"506","steal":"0","guest":"0"}}
58
+ `````
59
+
60
+ ### MongoDB find example
61
+ record_hostname: yes, nest_result: yes
62
+ `````
63
+ > use munin
64
+ > db.cpu.find({ "data.iowait" : { $gt : "200000" } })
65
+ `````
66
+
44
67
  ## TODO
45
68
  patches welcome!
46
69
 
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "fluent-plugin-munin"
6
- s.version = "0.1.3"
6
+ s.version = "0.2.2"
7
7
  s.authors = ["Kentaro Yoshida"]
8
8
  s.email = ["y.ken.studio@gmail.com"]
9
9
  s.homepage = "https://github.com/y-ken/fluent-plugin-munin"
@@ -12,16 +12,20 @@ module Fluent
12
12
  config_param :interval, :string, :default => '1m'
13
13
  config_param :tag_prefix, :string
14
14
  config_param :service, :string, :default => 'all'
15
+ config_param :nest_result, :string, :default => nil
16
+ config_param :nest_key, :string, :default => 'result'
15
17
  config_param :record_hostname, :string, :default => nil
16
18
 
17
19
  def configure(conf)
18
20
  super
19
21
  @hostname = get_munin_hostname
20
- service_list = get_service_list
21
- $log.info "munin-node #{@hostname} provides #{service_list}"
22
22
  @interval = Config.time_value(@interval)
23
+ service_list = get_service_list
23
24
  @services = @service == 'all' ? service_list : @service.split(',')
24
- @record_hostname = @record_hostname || false
25
+ @record_hostname = Config.bool_value(@record_hostname) || false
26
+ @nest_result = Config.bool_value(@nest_result) || false
27
+ $log.info "munin-node connected: #{@hostname} #{service_list}"
28
+ $log.info "following munin-node service: #{@service}"
25
29
  end
26
30
 
27
31
  def start
@@ -41,7 +45,11 @@ module Fluent
41
45
  record = Hash.new
42
46
  record.store('hostname', @hostname) if @record_hostname
43
47
  record.store('service', key)
44
- record.merge!(fetch(key).to_hash)
48
+ if (@nest_result)
49
+ record.store(@nest_key, fetch(key))
50
+ else
51
+ record.merge!(fetch(key).to_hash)
52
+ end
45
53
  Engine.emit(tag, Engine.now, record)
46
54
  end
47
55
  disconnect
@@ -33,7 +33,7 @@ class MuninInputTest < Test::Unit::TestCase
33
33
  assert_equal 4949, d.instance.port
34
34
  assert_equal 30, d.instance.interval
35
35
  assert_equal 'input.munin', d.instance.tag_prefix
36
- assert_equal 'yes', d.instance.record_hostname
36
+ assert_equal true, d.instance.record_hostname
37
37
  end
38
38
  end
39
39
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-munin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-10-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
16
- requirement: &9216120 !ruby/object:Gem::Requirement
16
+ requirement: &12769240 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *9216120
24
+ version_requirements: *12769240
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fluentd
27
- requirement: &9214620 !ruby/object:Gem::Requirement
27
+ requirement: &12767660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *9214620
35
+ version_requirements: *12767660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: munin-ruby
38
- requirement: &9213740 !ruby/object:Gem::Requirement
38
+ requirement: &12766880 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *9213740
46
+ version_requirements: *12766880
47
47
  description:
48
48
  email:
49
49
  - y.ken.studio@gmail.com