onering-report-plugins 0.0.44 → 0.0.45

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.
Files changed (2) hide show
  1. data/lib/reporter/default/stats_base.rb +91 -0
  2. metadata +29 -24
@@ -17,6 +17,97 @@ report do
17
17
  end
18
18
  end
19
19
 
20
+ # ------------------------------------------------------------------------------
21
+ # memory (hardware)
22
+ #
23
+ mode = nil
24
+ slot = nil
25
+ nilrx = /^(?:\s+|none|undefined|0+)$/
26
+
27
+ IO.popen("dmidecode -t memory").lines.each do |line|
28
+ case line.chomp
29
+ when /^Physical Memory Array$/
30
+ mode = :controller
31
+ next
32
+ when /^Memory Device$/
33
+ mode = :dimm
34
+ stats_mem[:slots] ||= []
35
+ slot = {}
36
+ next
37
+
38
+ # subvalues
39
+ when /^\t([^\:]+): (.+)$/
40
+ key = $1.strip
41
+ value = $2.strip
42
+
43
+ case mode
44
+ when :controller
45
+ case key.upcase
46
+ when 'ERROR CORRECTION TYPE'
47
+ stats_mem[:ecc] = (value.downcase == 'none' ? false : true)
48
+ stats_mem[:ecc_type] = value.downcase.gsub('ecc','').strip.gsub(/[\W\s]+/,'_') if stats_mem[:ecc]
49
+
50
+ when 'NUMBER OF DEVICES'
51
+ i = Integer(value.strip) rescue nil
52
+ stats_mem[:slot_count] = i unless i.nil?
53
+
54
+ when 'MAXIMUM CAPACITY'
55
+ stats_mem[:capacity] = value.to_s.to_bytes
56
+
57
+ else
58
+ next
59
+ end
60
+
61
+ when :dimm
62
+ case key.upcase
63
+ when 'SIZE'
64
+ slot[:size] = value.to_s.to_bytes
65
+ when 'TYPE'
66
+ slot[:type] = value.strip
67
+ when 'BANK LOCATOR'
68
+ slot[:bank] = value.strip
69
+ when 'LOCATOR'
70
+ slot[:id] = value.strip
71
+ when 'SERIAL NUMBER'
72
+ slot[:serial] = (value.strip.downcase =~ nilrx ? nil : value)
73
+ when 'MANUFACTURER'
74
+ slot[:make] = (value.downcase =~ nilrx ? nil : value)
75
+ when 'PART NUMBER'
76
+ slot[:model] = (value.downcase =~ nilrx ? nil : value)
77
+ when 'SPEED'
78
+ slot[:speed] = value.split(/\s+/).first.to_i
79
+ when 'RANK'
80
+ slot[:rank] = (Integer(value) rescue nil)
81
+ slot[:empty] = false unless slot[:rank].nil?
82
+
83
+ else
84
+ next
85
+ end
86
+ else
87
+ next
88
+ end
89
+
90
+ when ''
91
+ if mode == :dimm and not slot.empty?
92
+ if slot[:rank].nil?
93
+ slot = {
94
+ :id => slot[:id],
95
+ :name => slot[:name],
96
+ :bank => slot[:bank],
97
+ :empty => true
98
+ }
99
+ end
100
+
101
+ stats_mem[:slots] << slot.compact
102
+ end
103
+ end
104
+ end
105
+
106
+ unless stats_mem[:slots].nil?
107
+ stats_mem[:slots] = stats_mem[:slots].sort{|a,b| a[:id]<=>b[:id] }
108
+ end
109
+
110
+
20
111
 
21
112
  # ------------------------------------------------------------------------------
22
113
  # cpu
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onering-report-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.44
4
+ version: 0.0.45
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: onering-client
16
- requirement: &17565780 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,12 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *17565780
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  description: Base plugins for providing system information via the Onering client
26
31
  utility
27
32
  email: ghetzel@outbrain.com
@@ -29,34 +34,34 @@ executables: []
29
34
  extensions: []
30
35
  extra_rdoc_files: []
31
36
  files:
37
+ - lib/reporter/default/properties_facter.rb
38
+ - lib/reporter/default/stats_virident.rb
39
+ - lib/reporter/default/stats_disk.rb
40
+ - lib/reporter/default/properties_xen.rb
41
+ - lib/reporter/default/properties_openvz.rb
42
+ - lib/reporter/default/properties_haproxy.rb
43
+ - lib/reporter/default/properties_network.rb
44
+ - lib/reporter/default/properties_physical.rb
45
+ - lib/reporter/default/properties_ohai.rb
46
+ - lib/reporter/default/stats_zfs.rb
47
+ - lib/reporter/default/stats_base.rb
48
+ - lib/reporter/default/properties_services.rb
49
+ - lib/reporter/default/properties_chef.rb
32
50
  - lib/facter/onering_properties_openvz.rb
33
- - lib/facter/onering_properties_network.rb
34
- - lib/facter/onering_properties_virident.rb
35
- - lib/facter/onering_properties_netstat.rb
36
- - lib/facter/onering_properties_services.rb
37
51
  - lib/facter/onering_properties_chef.rb
38
52
  - lib/facter/onering_properties_onering.rb
39
53
  - lib/facter/onering_properties_physical.rb
54
+ - lib/facter/onering_properties_xen.rb
55
+ - lib/facter/onering_properties_netstat.rb
56
+ - lib/facter/onering_properties_services.rb
57
+ - lib/facter/onering_properties_virident.rb
58
+ - lib/facter/onering_properties_zfs.rb
59
+ - lib/facter/onering_properties_network.rb
40
60
  - lib/facter/onering_properties_system.rb
41
61
  - lib/facter/onering_properties_id.rb
42
- - lib/facter/onering_properties_haproxy.rb
43
62
  - lib/facter/onering_disk_smart.rb
44
- - lib/facter/onering_properties_zfs.rb
45
- - lib/facter/onering_properties_xen.rb
63
+ - lib/facter/onering_properties_haproxy.rb
46
64
  - lib/etc/facter.list
47
- - lib/reporter/default/properties_physical.rb
48
- - lib/reporter/default/properties_facter.rb
49
- - lib/reporter/default/stats_disk.rb
50
- - lib/reporter/default/stats_zfs.rb
51
- - lib/reporter/default/properties_openvz.rb
52
- - lib/reporter/default/properties_xen.rb
53
- - lib/reporter/default/properties_chef.rb
54
- - lib/reporter/default/stats_virident.rb
55
- - lib/reporter/default/properties_ohai.rb
56
- - lib/reporter/default/properties_haproxy.rb
57
- - lib/reporter/default/properties_network.rb
58
- - lib/reporter/default/properties_services.rb
59
- - lib/reporter/default/stats_base.rb
60
65
  homepage: https://github.com/outbrain/onering-report-plugins
61
66
  licenses: []
62
67
  post_install_message:
@@ -77,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
82
  version: '0'
78
83
  requirements: []
79
84
  rubyforge_project:
80
- rubygems_version: 1.8.11
85
+ rubygems_version: 1.8.23
81
86
  signing_key:
82
87
  specification_version: 3
83
88
  summary: Onering system reporting plugins