gri 10.0.4 → 10.0.5

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: 50f6caff192d9084e4f57b13c21748a5435ccc34
4
- data.tar.gz: 3b2f35a3c8a3bf966785aafe696b72ecdd2072a9
3
+ metadata.gz: 18b74441643b4d4919d26663b826f09ed5e79342
4
+ data.tar.gz: eecd64dcd712c1f52a9bbfc7ff7b4c21a32557ad
5
5
  SHA512:
6
- metadata.gz: 8a00998136184148ef1c1f5d5bf9d7b0a5632f41a0311291c5ff8644a90c5e35d357aa39ed62f0012cabbf9e6934f210018ec7abde60b84e9c958d812b69fc23
7
- data.tar.gz: b38a0c029852ec10aed66f37c16e209355189b1c07427c406b45d672fb570f12e7f733766a6cdb869b114626c7ca1d81916ac5edfe70fb9de8f8fa2017a2ba98
6
+ metadata.gz: 6399065907869a2d48bac6d93dbf7b43f34782278a41b8f716d2599a84711b3c6fe852660d0dc78375dbaec570ab186b31dffcbb1adf1100e39d9ba365aacdca
7
+ data.tar.gz: 2efbd5d418c136348a4344dff121a4d2cd3d45e1cc215c455dc99efa9ba8cb5a72dd786689bca9c9a3c38771d9f8e731aa8a197ed0b2da828b988eecae549dda
@@ -88,6 +88,8 @@ module GRI
88
88
  [0x42, $1.to_i]
89
89
  when /^Counter64: (\d+)/
90
90
  [0x46, $1.to_i]
91
+ when /^IpAddress: ([\.\d]+)/
92
+ [0x40, $1]
91
93
  else
92
94
  nil
93
95
  end
@@ -1,5 +1,14 @@
1
1
  if Object.const_defined? :RUBY_VERSION
2
2
 
3
+ #GRI::DEFS.update 'docker'=>{
4
+ # :ds=>['inbytes.0,inoctet,DERIVE,MAX,AREA,#90f090,in,8',
5
+ # 'outbytes.0,outoctet,DERIVE,MAX,LINE1,#0000ff,out,8',
6
+ # ],
7
+ # :list=>['Docker'],
8
+ # :prop=>{:name=>'_index'},
9
+ # :graph=>[['bps', 1000, [0, nil], /octet/]],
10
+ #}
11
+
3
12
  begin
4
13
 
5
14
  require 'net/http'
@@ -17,13 +26,15 @@ module GRI
17
26
  host = @hostname || @host
18
27
  port = @options["docker-port"] || 2375
19
28
  port = port.to_i
29
+
30
+ puts "docker: #{host}:#{port}" if $debug
20
31
  Net::HTTP.start(host, port) {|http|
21
32
  res = http.get '/info'
22
33
  if Net::HTTPSuccess === res
23
34
  h = JSON.parse(res.body)
24
35
  for k in ['Containers', 'Images',
25
36
  'NEventsListener', 'NFd', 'NGoroutines']
26
- record = {'_host'=>host, '_time'=>now_i,
37
+ record = {'_host'=>host, '_time'=>now_i, '_interval'=>@interval,
27
38
  '_key'=>"num_docker_#{k}", 'num'=>h[k],
28
39
  }
29
40
  records.push record
@@ -42,7 +53,12 @@ module GRI
42
53
  '_key'=>"docker_#{docker_hostname}"
43
54
  }
44
55
  for mkey, mvalues in metrics
45
- for k, v in mvalues
56
+ if mkey == 'memory' or mkey == 'cpuacct'
57
+ h = hflat mvalues
58
+ else
59
+ h = mvalues
60
+ end
61
+ for k, v in h
46
62
  record[k] = v
47
63
  end
48
64
  end
@@ -56,6 +72,22 @@ module GRI
56
72
  @loop.detach self
57
73
  end
58
74
 
75
+ def hflat h
76
+ hh = {}
77
+ for k, v in h
78
+ if Hash === v
79
+ hh.update hflat(v)
80
+ elsif Array === v
81
+ v.each_with_index {|vv, ind|
82
+ hh["#{k}.#{ind}"] = vv
83
+ }
84
+ else
85
+ hh[k] = v
86
+ end
87
+ end
88
+ hh
89
+ end
90
+
59
91
  def get_container_info http, ctn_id
60
92
  if Net::HTTPSuccess === (res = http.get "/containers/#{ctn_id}/json")
61
93
  h = JSON.parse(res.body)
@@ -29,6 +29,7 @@ module GRI
29
29
  def write records
30
30
  time = Time.now.to_i
31
31
  for record in records
32
+ record = record.dup
32
33
  time = record.delete '_time'
33
34
  #host = record.delete '_host'
34
35
  key = record.delete '_key'
@@ -38,6 +39,8 @@ module GRI
38
39
  next if data_name == 'SYS'
39
40
  if data_name == ''
40
41
  data_name = 'interfaces'
42
+ elsif data_name == 'docker'
43
+ data_name = "docker.#{index}"
41
44
  end
42
45
  record.update :time=>time.to_i, :key=>index
43
46
  buffered_write data_name, record
@@ -1,3 +1,3 @@
1
1
  module GRI
2
- VERSION = "10.0.4"
2
+ VERSION = "10.0.5"
3
3
  end
@@ -1,4 +1,4 @@
1
- FROM centos
1
+ FROM centos:centos6
2
2
 
3
3
  # cron
4
4
  RUN yum install -y cronie
@@ -13,7 +13,7 @@ RUN gem install gri --no-ri --no-rdoc
13
13
  RUN cp /usr/bin/grapher /var/www/cgi-bin/
14
14
 
15
15
  # rrdtool
16
- RUN yum install -y cairo gettext pango tcp_wrappers-libs libdbi
16
+ RUN yum install -y wget cairo gettext pango tcp_wrappers-libs libdbi
17
17
  RUN yum install -y xorg-x11-fonts-Type1 ipa-gothic-fonts ipa-pgothic-fonts
18
18
  RUN (cd /tmp; wget http://pkgs.repoforge.org/rrdtool/rrdtool-1.4.7-1.el6.rfx.x86_64.rpm)
19
19
  RUN (cd /tmp; rpm --nodeps -i rrdtool-1.4.7-1.el6.rfx.x86_64.rpm)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gri
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.0.4
4
+ version: 10.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - maebashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-13 00:00:00.000000000 Z
11
+ date: 2014-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack