fluent-plugin-sar 0.0.2 → 0.0.4

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
  SHA1:
3
- metadata.gz: c2f1de19c13358cdfb0040af85545cb253a7f062
4
- data.tar.gz: b61888ae08152566a0c0059c61d9396e1cfe0116
3
+ metadata.gz: dde4a2be583f75be73649762e60531aef0d489fe
4
+ data.tar.gz: 9a3176ad2d41ef102ed3d12e78d66270ad7d0e4b
5
5
  SHA512:
6
- metadata.gz: e5c5e049083875ddc3098b3ecf831c32390a263841fade7c435886cbb12fe99a403570fa8f474ecfa1dcec516e5a1f090b5d9638c1b9dec4f025228d40b11278
7
- data.tar.gz: 9e49bc41ed286fbb6e56ba7931f4c08ea0306e81cb0493e00c62ee52fa5eee8fd64b50e49ece22eae5abfc9b3d988406dee240997c3fa665536dda2be28e32eb
6
+ metadata.gz: c10eafca7b0ddfefc83761f978e63cdc9c2c635dd6a1811758c108b04ef881f01c8b5bb00eda63d3c60cc5e2ede6447703f11da4676d06ec8a6cad0275a5970a
7
+ data.tar.gz: 0c3b216e0e444b501d61d29dbf188e59449e2a2a9540ea100657e3b8ebe0a864a1cc922c44fad530796592fafafd009cbe0ae5deae450dbf32451aca8d15300c
@@ -0,0 +1,122 @@
1
+ # Fluent::Plugin::Sar
2
+
3
+ sarの結果を取得するFluentdのinput pluginです。
4
+ sysstatがインストールされていることが、このプラグインの動作条件です。
5
+
6
+ ## インストール
7
+
8
+ bundlerでインストールする場合
9
+ 下記を記載したGemfileを用意して:
10
+
11
+ gem 'fluent-plugin-sar'
12
+
13
+ 下記コマンドを実行します。:
14
+
15
+ $ bundle
16
+
17
+ bundlerを使用せず、自身でgemコマンドを実行する場合には
18
+ 下記コマンドを実行してください。:
19
+
20
+ $ gem install fluent-plugin-sar
21
+
22
+ ## 概要
23
+
24
+ このプラグインは"sarの実行結果"を設定した間隔毎に収集します。
25
+
26
+
27
+ ## 設定
28
+ ### パラメーター:
29
+
30
+ + sar_option
31
+
32
+
33
+ (必須項目)
34
+
35
+ sarコマンドを実行しているだけなので、sarのコマンドオプションがそのまま使え、
36
+ スペース区切りで複数同時に指定出来ます。
37
+ ただし、出力結果のパースに対応できていないオプションがあります。
38
+ パースが対応できないオプションは、sarの実行結果が複数行になるものです。
39
+ また、サブオプションをとるオプションについても実行時のパースで対応していません。
40
+
41
+ 具体例) OSがCentOS 6.5でsysstat version 9.0.4 の環境で確認した、対応可能と未対応のオプション
42
+
43
+ 対応可能:
44
+
45
+ b I/O と転送率の状況
46
+ B ページングの状態
47
+ m 電力管理状況
48
+ q Qキューの長さとロードアベレージの状態
49
+ r メモリ利用率の状態
50
+ R メモリの状況
51
+ S スワップ領域の利用状況
52
+ u CPU 利用の利用状況(省略出力)
53
+ v カーネルのテーブル状態
54
+ w タスクの作成とシステムスイッチの状態
55
+ W スワップの状態
56
+
57
+ 未対応:
58
+
59
+ A
60
+ C
61
+ d
62
+ I
63
+ j
64
+ n
65
+ P
66
+ p
67
+ y
68
+
69
+ - tag
70
+
71
+
72
+ (任意項目 | 既定値 : "sar_result.tag")
73
+
74
+ - interval
75
+
76
+
77
+ (任意項目 | 既定値 : 5)
78
+
79
+ 設定分毎にsarを実行します。
80
+
81
+ - hostname_output
82
+
83
+
84
+ (任意項目 | 規定値 : True)
85
+
86
+ 出力レコードにホスト名を追加するかどうかを選択できます。
87
+ 出力する(true)/出力しない(false)で設定します。
88
+
89
+ - hostname
90
+
91
+
92
+ (任意項目 | 規定値 : OS設定のホスト名)
93
+
94
+ ホスト名を出力するに設定した場合、自動でOS設定のホスト名を取得します。
95
+ OS設定のホスト名とは別の名前で出力したい場合は、任意の名前を設定するも可能です。
96
+
97
+ ### 設定例
98
+
99
+ <source>
100
+ type sar
101
+ sar_option u q
102
+ tag sar.tag
103
+ interval 10
104
+ hostname_output true
105
+ hostname check_host01
106
+ </source>
107
+
108
+ 出力結果
109
+
110
+ sar.tag: {"hostname":"check_host01","check_time":"18:51:25","runq-sz":"0","plist-sz":"223","ldavg-1":"0.00","ldavg-5":"0.00","ldavg-15":"0.00","CPU":"all","%user":"0.00","%nice":"0.00","%system":"1.03","%iowait":"0.00","%steal":"0.00","%idle":"98.97"}
111
+
112
+ ## Contributing
113
+
114
+ 1. Fork it
115
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
116
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
117
+ 4. Push to the branch (`git push origin my-new-feature`)
118
+ 5. Create new Pull Request
119
+
120
+ ## Copyright
121
+
122
+ Copyright (c) 2014 Hirotaka Tajiri. See [LICENSE](LICENSE.txt) for details.
@@ -5,7 +5,7 @@ $:.push File.expand_path('../lib', __FILE__)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "fluent-plugin-sar"
8
- spec.version = "0.0.2"
8
+ spec.version = "0.0.4"
9
9
  spec.authors = ["Hirotaka Tajiri"]
10
10
  spec.email = ["ganryu_koziro@excite.co.jp"]
11
11
  spec.homepage = "https://github.com/hirotaka-tajiri/fluent-plugin-sar"
@@ -40,16 +40,15 @@ class SarInput < Fluent::Input
40
40
 
41
41
  def sar_execute(opt_ary)
42
42
 
43
- rlt = Hash.new{| k, v | Hash[k] = Hash.new }
43
+ rlt = Hash.new {| k, v | h[k] = Hash.new }
44
44
  rec = Hash.new
45
45
  th = Array.new
46
46
 
47
47
  opt_ary.each {| opt |
48
48
  th << Thread.new {
49
- i = 0
50
- `LANG=C sar -#{opt} 1 1 | grep -vi average | tail -n2`.split("\n").each{| a | rlt[(i += 1)] = a.split }
51
- rlt[1][0].sub!(/[0-9]{2}\:[0-9]{2}\:[0-9]{2}/, "check_time")
52
- rec.merge!(Hash[*rlt[1].zip(rlt[2]).flatten])
49
+ `LANG=C sar -#{opt} 1 1 | grep -vi average | tail -n2`.split("\n").each_with_index {| a, i | rlt[i] = a.split }
50
+ rlt[0][0].sub!(/[0-9]{2}\:[0-9]{2}\:[0-9]{2}/, "check_time")
51
+ rec.merge!(Hash[*rlt[0].zip(rlt[1]).flatten])
53
52
  }
54
53
  }
55
54
  th.each {| t | t.join }
@@ -57,4 +56,3 @@ class SarInput < Fluent::Input
57
56
  rec
58
57
  end
59
58
  end
60
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-sar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hirotaka Tajiri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-24 00:00:00.000000000 Z
11
+ date: 2014-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -63,6 +63,7 @@ files:
63
63
  - Gemfile
64
64
  - LICENSE.txt
65
65
  - README.md
66
+ - README_ja.md
66
67
  - Rakefile
67
68
  - fluent-plugin-sar.gemspec
68
69
  - lib/fluent/plugin/in_sar.rb