gri 10.0.7 → 10.0.8

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: 4f65c5971ca81e3e40bb99b6c75fc9cb0e7abd13
4
- data.tar.gz: 13ec94a6ae74dd7b05e54466df5549083dfd7c8b
3
+ metadata.gz: 19492a2ad3e4e1ec3c1e2f2f42de8cb962a3e591
4
+ data.tar.gz: 2c8951bbe68e3a24e8c1a3dbe5b024806f850a6d
5
5
  SHA512:
6
- metadata.gz: 961ec77bab123aba5882cc937722d62d8b9cfa6a18245b6b1664f5a90e4a0c26a30d63df7620340e88a1aceebb904f549f115d72fa5f60dfc14a113514659289
7
- data.tar.gz: 80fdba8a08010d7d33fcc7247b0bd820fb83e7f6d440baf545ff8234e26391a80baff675c75b7d78dfb4dd132f29c9fdb70dc17b9cd8e0d12ad18b435faa23ed
6
+ metadata.gz: 3f7b436519f3f84d94227d01a7ba9be89e9f1436614d191e9d2fe1360629b824a69fe5d6c0293314df1ffcf891c5411c4bc477ee5ced3506e2e3c23c279cbf6b
7
+ data.tar.gz: 01218f858aeefd19b5b83433072ee66cafdd7d19ed91b27716df8323d6319043df7f66c5d3bf879545d6847ad6cfcfe7980fec4455ef951bf619ede6c1a2901e
@@ -9,6 +9,13 @@ module GRI
9
9
  :graph=>[['', 0]],
10
10
  :composite=>['', 's', 'v', 't'],
11
11
  },
12
+ 'counter'=>{
13
+ :ds=>['num,num,DERIVE,,,,:index'],
14
+ :prop=>{:name=>'_index', :description=>'description'},
15
+ :list=>['Counter', '%N'],
16
+ :graph=>[['', 0, [0, nil]]],
17
+ :composite=>['', 's', 'v', 't'],
18
+ },
12
19
  'grimetrics'=>{:ds=>['number,number,GAUGE'],
13
20
  :prop=>{:name=>'_index'},
14
21
  :list_text=>['grimetrics', '%N,%L\r'],
@@ -163,13 +170,24 @@ module GRI
163
170
  :hidden? => proc {|record| record['hrStorageDescr'] =~ /devicemapper/},
164
171
  :tdb=>['hrStorage', 'hrStorageDescr', 'hrStorageSize', 'hrStorageUsed'],
165
172
  :fix_workhash=>lambda {|wh|
173
+ if (th = wh[:hrStorageTotalHack])
174
+ ph = Hash[*(th.map {|k, v|
175
+ [v['dskPath'],
176
+ (v['dskTotalHigh'].to_i * 4294967296 +
177
+ v['dskTotalLow'].to_i) * 1024]
178
+ }).flatten]
179
+ end
166
180
  if (h = wh[:hrStorage])
167
181
  h.reject! {|k, v|
168
182
  v['hrStorageType'] != "+\x06\x01\x02\x01\x19\x02\x01\x04"}
169
183
  h.each {|k, v|
170
184
  u = v['hrStorageAllocationUnits'].to_i
171
185
  v.delete 'hrStorageType'
172
- v['hrStorageSize'] = v['hrStorageSize'].to_i * u
186
+ if ph and (t = ph[v['hrStorageDescr']])
187
+ v['hrStorageSize'] = t
188
+ else
189
+ v['hrStorageSize'] = v['hrStorageSize'].to_i * u
190
+ end
173
191
  v['hrStorageUsed'] = v['hrStorageUsed'].to_i * u
174
192
  }
175
193
  end
@@ -182,6 +200,10 @@ module GRI
182
200
  :composite=>['s', 'v', 't'],
183
201
  },
184
202
 
203
+ 'hrStorageTotalHack'=>{
204
+ :oid=>['dskPath', 'dskTotalLow', 'dskTotalHigh'],
205
+ },
206
+
185
207
  'hrSWRunPerf'=>{
186
208
  :puclass=>'HRSWRunPerf',
187
209
  :oid=>['hrSWRunPath', 'hrSWRunParameters',
@@ -27,9 +27,8 @@ module GRI
27
27
  end
28
28
 
29
29
  def update hash
30
- hash.each {|key, value|
31
- @params[key] = [value]
32
- }
30
+ hash.each {|key, value| @params[key] = [value]}
31
+ self
33
32
  end
34
33
 
35
34
  def merge cgi_params
@@ -369,7 +369,6 @@ class SNMP
369
369
  'hrSystemNumUsers'=>'1.3.6.1.2.1.25.1.5.0',
370
370
  'hrSystemProcesses'=>'1.3.6.1.2.1.25.1.6.0',
371
371
  'hrSystemMaxProcesses'=>'1.3.6.1.2.1.25.1.7.0',
372
- 'hrSystem'=>'1.3.6.1.2.1.25.1',
373
372
  'hrStorage'=>'1.3.6.1.2.1.25.2',
374
373
  'hrStorageTypes'=>'1.3.6.1.2.1.25.2.1',
375
374
  'hrStorageFixedDisk'=>'1.3.6.1.2.1.25.2.1.4',
@@ -5,8 +5,12 @@ module GRI
5
5
  module_function
6
6
 
7
7
  def load_records dir
8
- values = LTSV.load_from_file dir + '/.records.txt'
9
- values.inject({}) {|h, v| h[v['_key']] = v; h}
8
+ if File.exist?(path = dir + '/.records.txt')
9
+ values = LTSV.load_from_file path
10
+ values.inject({}) {|h, v| h[v['_key']] = v; h}
11
+ else
12
+ nil
13
+ end
10
14
  end
11
15
 
12
16
  def search_records dirs, host
@@ -1,3 +1,3 @@
1
1
  module GRI
2
- VERSION = "10.0.7"
2
+ VERSION = "10.0.8"
3
3
  end
@@ -8,7 +8,12 @@ module GRI
8
8
  if (klass = TYPES[wtype])
9
9
  options.select {|k, v| String === k}.each {|k, v|
10
10
  options[k.gsub('-', '_').intern] = v}
11
- klass.new options
11
+ begin
12
+ klass.new options
13
+ rescue
14
+ Log.error "Writer.create error: #{$!}"
15
+ nil
16
+ end
12
17
  end
13
18
  end
14
19
 
@@ -22,11 +22,11 @@ class TestGraph < Test::Unit::TestCase
22
22
  gra_dirs = [@root_dir + '/gra']
23
23
  rs = ['testhost__eth0']
24
24
  graph = Graph.new :dirs=>gra_dirs
25
- params = {}
25
+ params = GParams.new
26
26
  res = graph.mk_graph_title rs, params
27
27
  assert_nil res
28
28
 
29
- params = {'p'=>'t'}
29
+ params.update 'p'=>'t'
30
30
  res = graph.mk_graph_title rs, params
31
31
  ae '"testhost eth0 testdescr"', res
32
32
  end
@@ -13,16 +13,24 @@ class TestPage < Test::Unit::TestCase
13
13
 
14
14
  def test_page_mk_page_title
15
15
  rs = ['testhost__eth0']
16
- res = @page.mk_page_title([@root_dir + '/gra'], rs, {})
16
+ params = GParams.new
17
+ res = @page.mk_page_title([@root_dir + '/gra'], rs, params)
17
18
  ae 3, res.size
18
19
  ae 'testdescr', res[0]
19
20
  assert_match(/__eth0/, res[1])
20
21
  assert_match(/ eth0/, res[2])
22
+
23
+ rs = []
24
+ params.update 'grp'=>'foo', 'tag'=>'foo_bar'
25
+ res = @page.mk_page_title([@root_dir + '/gra'], rs, params)
26
+ ae 3, res.size
27
+ ae 'foo_bar', res[0]
28
+ ae 'foo_bar', res[1]
21
29
  end
22
30
 
23
31
  def test_page_mk_param_str
24
32
  rs = ['r0.example.com', 'r 1?']
25
- params = {}
33
+ params = GParams.new
26
34
  assert_match /\br=r\+1%3F/, @page.mk_param_str(0, 0, rs, nil, params)
27
35
  end
28
36
 
@@ -30,7 +38,7 @@ class TestPage < Test::Unit::TestCase
30
38
  stime = Time.local(2013,10,1)
31
39
  etime = stime + 24*3600
32
40
  rs = ['testhost__eth0']
33
- params = {'p'=>'s'}
41
+ params = GParams.new.update 'p'=>'s'
34
42
  res = @page.mk_graph_tag stime, etime, rs, params
35
43
  ae 2, res.scan(/inoctet/).size
36
44
  ae 2, res.scan(/indiscard/).size
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.7
4
+ version: 10.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - maebashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-11 00:00:00.000000000 Z
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  requirements: []
186
186
  rubyforge_project:
187
- rubygems_version: 2.2.2
187
+ rubygems_version: 2.4.5
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: GRI