fluent-plugin-nostat 0.0.1 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1705d2861377ebfef434cbd0a85cda207fa0d96d
4
- data.tar.gz: 3bc1f4b520eb5013336af0624954d189d8bff850
3
+ metadata.gz: 922ef03c57c93b3ad21ff995306ccd54c24ded89
4
+ data.tar.gz: 8576dc90677a7631c1d635424383ccb6bb64875f
5
5
  SHA512:
6
- metadata.gz: 7050d65ad6b9f28aed2ea254d43e370bce00d1846d44e4634346b81826d4c9917ac51cdfdd43d378e8dbcd690ed4b56f0ff2fc7b487965a55293c3c84bfc776f
7
- data.tar.gz: f5c508c7c0db87732835a59f0808009549c9c11e3e0501146cd079695c23ce6c3fcec6e4552ddbfea0ddb5e36b7575ef85a1f371c0c1630f96a533fdf32eb0e6
6
+ metadata.gz: 495da10e373f368cbc42aea78f6e930f557e8e0cdd8a9786ade181cc44f7b2f71291fd12dcec57cb7404ecc1dadf0b881fe965f5fba3ec3986eb883a15ec32af
7
+ data.tar.gz: 7ae64e502d3bf8172e3f4da11d5a493585f1b740fa87f47d644e1a9641b70d16bd5e29bfd2faee030488540a5df314e1aaf134e032045831fa87e2ad7f70d94c
data/README.md CHANGED
@@ -1,2 +1,5 @@
1
1
  # fluent-plugin-nostat
2
2
  fluent plugin for system resource monitoring whithout dstat
3
+
4
+ # it was tested on
5
+ . CentOS 7.x (kernel 3.10.x)
@@ -3,12 +3,12 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "fluent-plugin-nostat"
6
- s.version = "0.0.1"
6
+ s.version = "0.0.2"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
10
10
  s.authors = ["No JinHo"]
11
- s.date = "2016-03-10"
11
+ s.date = "2016-03-15"
12
12
  s.email = "nozino@gmail.com"
13
13
  s.extra_rdoc_files = [
14
14
  "LICENSE.txt",
@@ -1,7 +1,6 @@
1
1
  module Fluent
2
- class BcacheInput < Input
3
- class Nostat
4
- Plugin.register_input('bcache', self)
2
+ class NostatInput < Input
3
+ Plugin.register_input('nostat', self)
5
4
 
6
5
  @@CPU_STAT = "/proc/stat"
7
6
  @@MEM_STAT = "/proc/meminfo"
@@ -28,9 +27,8 @@ module Fluent
28
27
  super
29
28
 
30
29
  if !@tag
31
- @tag = @tag_prefix + `hostname`.strip.split('.')[0].strip + ".bcache"
30
+ @tag = @tag_prefix + `hostname`.strip.split('.')[0].strip + ".nostat"
32
31
  log.info "tag=", @tag
33
- # raise ConfigError, "'tag' option is required on df input"
34
32
  end
35
33
  if !@run_interval
36
34
  raise ConfigError, "'run_interval' option is required on df input"
@@ -40,7 +38,6 @@ module Fluent
40
38
  def start
41
39
  @finished = false
42
40
  @thread = Thread.new(&method(:run_periodic))
43
-
44
41
  end
45
42
 
46
43
  def shutdown
@@ -48,19 +45,6 @@ module Fluent
48
45
  @thread.join
49
46
  end
50
47
 
51
- def get_stats (path)
52
- res = {}
53
-
54
- bcache = path.split('/')[-3]
55
- res[bcache] = {}
56
- res[bcache]["cache_hits"] = File.read(path + "/cache_hits").strip.to_i
57
- res[bcache]["cache_misses"] = File.read(path + "/cache_misses").strip.to_i
58
-
59
- puts res
60
-
61
- res
62
- end
63
-
64
48
  def get_cpu_stat
65
49
  res = {}
66
50
 
@@ -154,7 +138,7 @@ module Fluent
154
138
  record["cpu"] = get_cpu_stat
155
139
  record["disk"] = get_disk_stat
156
140
  record["net"] = get_net_stat
157
- record["mem"] = get_cpu_stat
141
+ record["mem"] = get_mem_stat
158
142
 
159
143
  log.info "ret=", record
160
144
 
@@ -163,8 +147,8 @@ module Fluent
163
147
 
164
148
  router.emit(@tag, time, record)
165
149
  rescue => e
166
- log.error "bcache failed to emit", :error => e.to_s, :error_class => e.class.to_s, :tag => tag
167
- log.error "bcache to run or shutdown child process", :error => $!.to_s, :error_class => $!.class.to_s
150
+ log.error "nostat failed to emit", :error => e.to_s, :error_class => e.class.to_s, :tag => tag
151
+ log.error "nostat to run or shutdown child process", :error => $!.to_s, :error_class => $!.class.to_s
168
152
  log.warn_backtrace $!.backtrace
169
153
 
170
154
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-nostat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - No JinHo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluent-mixin-rewrite-tag-name