fluent-plugin-nostat 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/fluent-plugin-nostat.gemspec +2 -2
- data/lib/fluent/plugin/in_nostat.rb +6 -22
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 922ef03c57c93b3ad21ff995306ccd54c24ded89
|
4
|
+
data.tar.gz: 8576dc90677a7631c1d635424383ccb6bb64875f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 495da10e373f368cbc42aea78f6e930f557e8e0cdd8a9786ade181cc44f7b2f71291fd12dcec57cb7404ecc1dadf0b881fe965f5fba3ec3986eb883a15ec32af
|
7
|
+
data.tar.gz: 7ae64e502d3bf8172e3f4da11d5a493585f1b740fa87f47d644e1a9641b70d16bd5e29bfd2faee030488540a5df314e1aaf134e032045831fa87e2ad7f70d94c
|
data/README.md
CHANGED
@@ -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.
|
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-
|
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
|
3
|
-
|
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 + ".
|
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"] =
|
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 "
|
167
|
-
log.error "
|
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.
|
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-
|
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
|