onering-report-plugins 0.0.49 → 0.0.50
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/facter/onering_properties_network.rb +32 -28
- data/lib/reporter/default/stats_disk.rb +63 -0
- metadata +24 -29
@@ -103,38 +103,42 @@ begin
|
|
103
103
|
if not output.nil?
|
104
104
|
# XML formatting worked, parse as such
|
105
105
|
if output[0..1] == '<?'
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
106
|
+
begin
|
107
|
+
output = XmlSimple.xml_in(output)
|
108
|
+
|
109
|
+
(output['interface'] || []).each do |i|
|
110
|
+
current_iface = i['name']
|
111
|
+
port = i['port'].first
|
112
|
+
vlan = i['vlan']
|
113
|
+
chassis = i['chassis'].first
|
114
|
+
speed, duplex = port['auto-negotiation'].first['current'].first['content'].split(' - ',2).first.split(/BaseT/i,2)
|
115
|
+
|
116
|
+
speed = (Integer(speed) * 1000000 rescue nil) # convert to bits
|
117
|
+
duplex = case duplex
|
118
|
+
when 'FD' then :full
|
119
|
+
when 'HD' then :half
|
120
|
+
else nil
|
121
|
+
end
|
121
122
|
|
122
|
-
|
123
|
-
|
123
|
+
# port settings
|
124
|
+
network_lldp[current_iface] = Hash[_format(:port_descr, port['descr'].first['content'])]
|
124
125
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
126
|
+
network_lldp[current_iface]['port_mac'] = (port['id'].first['content'] rescue nil)
|
127
|
+
network_lldp[current_iface]['mfs'] = (port['mfs'].first['content'].to_i rescue nil)
|
128
|
+
network_lldp[current_iface]['speed'] = speed
|
129
|
+
network_lldp[current_iface]['duplex'] = duplex
|
129
130
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
131
|
+
# switch settings
|
132
|
+
network_lldp[current_iface]['switch'] = (chassis['name'].first['content'] rescue nil)
|
133
|
+
network_lldp[current_iface]['management_ip'] = (chassis['mgmt-ip'].first['content'] rescue nil)
|
134
|
+
network_lldp[current_iface]['chassis_mac'] = (chassis['id'].first['content'] rescue nil)
|
134
135
|
|
135
|
-
|
136
|
-
|
137
|
-
|
136
|
+
# Layer 2 / VLAN details
|
137
|
+
network_lldp[current_iface]['vlan'] = (Integer(vlan.select{|i| i['pvid'] == 'yes' }.first['vlan-id']) rescue nil)
|
138
|
+
network_lldp[current_iface]['tagged_vlans'] = (vlan.select{|i| i['pvid'] != 'yes' }.collect{|i| Integer(i['vlan-id']) } rescue nil)
|
139
|
+
end
|
140
|
+
rescue
|
141
|
+
nil
|
138
142
|
end
|
139
143
|
|
140
144
|
else
|
@@ -3,6 +3,67 @@
|
|
3
3
|
#
|
4
4
|
|
5
5
|
report do
|
6
|
+
# ------------------------------------------------------------------------------
|
7
|
+
# block devices
|
8
|
+
#
|
9
|
+
blocks = []
|
10
|
+
|
11
|
+
Facter.value('blockdevices').split(/\W+/).each do |dev|
|
12
|
+
|
13
|
+
block = {
|
14
|
+
:vendor => Facter.value("blockdevice_#{dev}_vendor"),
|
15
|
+
:model => Facter.value("blockdevice_#{dev}_model"),
|
16
|
+
:size => (Integer(Facter.value("blockdevice_#{dev}_size")) rescue nil)
|
17
|
+
}
|
18
|
+
|
19
|
+
if File.directory?("/sys/block/#{dev}")
|
20
|
+
block[:removable] = (File.read("/sys/block/#{dev}/removable").to_s.chomp.strip == '1' rescue nil)
|
21
|
+
block[:readonly] = (File.read("/sys/block/#{dev}/ro").to_s.chomp.strip == '1' rescue nil)
|
22
|
+
block[:solidstate] = (File.read("/sys/block/#{dev}/queue/rotational").to_s.chomp.strip == '0' rescue nil)
|
23
|
+
block[:sectorsize] = {}
|
24
|
+
|
25
|
+
%w{
|
26
|
+
logical
|
27
|
+
physical
|
28
|
+
}.each do |s|
|
29
|
+
block[:sectorsize][s.to_sym] = (Integer(File.read("/sys/block/#{dev}/queue/#{s}_block_size").chomp.strip) rescue nil)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
blocks << block.compact
|
34
|
+
end
|
35
|
+
|
36
|
+
# ------------------------------------------------------------------------------
|
37
|
+
# partitions
|
38
|
+
#
|
39
|
+
# partitions = []
|
40
|
+
|
41
|
+
# begin
|
42
|
+
# File.read("/proc/partitions").lines.each do |line|
|
43
|
+
# next if line == line.first
|
44
|
+
# line = line.chomp.strip
|
45
|
+
# next if line.empty?
|
46
|
+
|
47
|
+
# line = line.split(/\s+/)
|
48
|
+
|
49
|
+
# # for the moment, just interested in sd devices
|
50
|
+
# # numbers sources from /proc/devices
|
51
|
+
# #
|
52
|
+
# next unless [
|
53
|
+
# 8,65,66,67,68,69,70,71,128,129,130,131,132,133,134,135
|
54
|
+
# ].include?(line[0].to_i)
|
55
|
+
|
56
|
+
# # only get numbered partitions (not whole-device entries)
|
57
|
+
# next unless line[-1] =~ /^\D+\d+$/
|
58
|
+
|
59
|
+
# partition = {
|
60
|
+
# :name => line[-1],
|
61
|
+
# }
|
62
|
+
# end
|
63
|
+
# rescue
|
64
|
+
# nil
|
65
|
+
# end
|
66
|
+
|
6
67
|
# ------------------------------------------------------------------------------
|
7
68
|
# mounts
|
8
69
|
#
|
@@ -122,5 +183,7 @@ report do
|
|
122
183
|
|
123
184
|
d[:@smart] = Facter.value('smart')
|
124
185
|
|
186
|
+
d[:@block] = blocks unless blocks.empty?
|
187
|
+
|
125
188
|
stat :disk, d.compact
|
126
189
|
end
|
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.
|
4
|
+
version: 0.0.50
|
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: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &16237640 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,12 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
24
|
+
version_requirements: *16237640
|
30
25
|
description: Base plugins for providing system information via the Onering client
|
31
26
|
utility
|
32
27
|
email: ghetzel@outbrain.com
|
@@ -34,34 +29,34 @@ executables: []
|
|
34
29
|
extensions: []
|
35
30
|
extra_rdoc_files: []
|
36
31
|
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
|
50
32
|
- 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
|
51
37
|
- lib/facter/onering_properties_chef.rb
|
52
38
|
- lib/facter/onering_properties_onering.rb
|
53
39
|
- 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
|
60
40
|
- lib/facter/onering_properties_system.rb
|
61
41
|
- lib/facter/onering_properties_id.rb
|
62
|
-
- lib/facter/onering_disk_smart.rb
|
63
42
|
- lib/facter/onering_properties_haproxy.rb
|
43
|
+
- lib/facter/onering_disk_smart.rb
|
44
|
+
- lib/facter/onering_properties_zfs.rb
|
45
|
+
- lib/facter/onering_properties_xen.rb
|
64
46
|
- 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
|
65
60
|
homepage: https://github.com/outbrain/onering-report-plugins
|
66
61
|
licenses: []
|
67
62
|
post_install_message:
|
@@ -82,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
77
|
version: '0'
|
83
78
|
requirements: []
|
84
79
|
rubyforge_project:
|
85
|
-
rubygems_version: 1.8.
|
80
|
+
rubygems_version: 1.8.11
|
86
81
|
signing_key:
|
87
82
|
specification_version: 3
|
88
83
|
summary: Onering system reporting plugins
|