onering-report-plugins 0.0.54 → 0.0.55
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/reporter/default/properties_facter.rb +2 -2
- data/lib/reporter/default/properties_ipmi.rb +10 -0
- data/lib/reporter/default/properties_physical.rb +0 -4
- data/lib/reporter/default/properties_system_cpu.rb +30 -0
- data/lib/reporter/default/properties_system_disk_block.rb +35 -0
- data/lib/reporter/default/{stats_disk.rb → properties_system_disk_lvm.rb} +4 -57
- data/lib/reporter/default/properties_system_disk_mounts.rb +46 -0
- data/lib/reporter/default/properties_system_disk_smart.rb +3 -0
- data/lib/reporter/default/{stats_base.rb → properties_system_memory.rb} +1 -39
- metadata +8 -3
@@ -38,8 +38,8 @@ report do
|
|
38
38
|
val = cleanup_dirty_values(key, Facter.value(line.first))
|
39
39
|
|
40
40
|
property key.to_sym, val
|
41
|
-
rescue Exception
|
42
|
-
|
41
|
+
rescue Exception => e
|
42
|
+
Onering::Logger.debug(e.message, "onering-report-plugins/properties_facter/#{e.class.name}")
|
43
43
|
next
|
44
44
|
end
|
45
45
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Onering Collector - IPMI plugin
|
2
|
+
# provides collection of IPMI data using vendor tools
|
3
|
+
#
|
4
|
+
|
5
|
+
report do
|
6
|
+
property :ipmi_ip, Facter.value('ipmi_ip')
|
7
|
+
property :ipmi_netmask, Facter.value('ipmi_netmask')
|
8
|
+
property :ipmi_gateway, Facter.value('ipmi_gateway')
|
9
|
+
property :ipmi_macaddress, Facter.value('ipmi_macaddress')
|
10
|
+
end
|
@@ -7,8 +7,4 @@ report do
|
|
7
7
|
property :environment, Facter.value('environment')
|
8
8
|
property :slot, Facter.value('slot')
|
9
9
|
property :virtual, (Facter.value('is_virtual').to_s == 'true' ? true : false)
|
10
|
-
property :ipmi_ip, Facter.value('ipmi_ip')
|
11
|
-
property :ipmi_netmask, Facter.value('ipmi_netmask')
|
12
|
-
property :ipmi_gateway, Facter.value('ipmi_gateway')
|
13
|
-
property :ipmi_macaddress, Facter.value('ipmi_macaddress')
|
14
10
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
report do
|
2
|
+
# ------------------------------------------------------------------------------
|
3
|
+
# cpu
|
4
|
+
#
|
5
|
+
stats_cpu = {
|
6
|
+
:count => 0,
|
7
|
+
:processors => []
|
8
|
+
}
|
9
|
+
|
10
|
+
current_cpu = nil
|
11
|
+
|
12
|
+
File.open("/proc/cpuinfo").each do |line|
|
13
|
+
case line
|
14
|
+
when /processor\s+:\s(.+)/
|
15
|
+
current_cpu = $1.to_i
|
16
|
+
stats_cpu[:count] += 1
|
17
|
+
stats_cpu[:processors][current_cpu] = {
|
18
|
+
:number => current_cpu
|
19
|
+
}
|
20
|
+
when /cpu MHz\s+:\s(.+)/
|
21
|
+
stats_cpu[:processors][current_cpu][:speed] = $1.to_f
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
stat :cpu, ({
|
26
|
+
'count' => Facter.value('processorcount').to_i,
|
27
|
+
'physical' => Facter.value('physicalprocessorcount').to_i,
|
28
|
+
'speed' => stats_cpu[:processors].collect{|i| i[:speed] }.compact.uniq.sort{|a,b| a.to_f <=> b.to_f }.last.to_f
|
29
|
+
} rescue nil)
|
30
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
report do
|
2
|
+
# ------------------------------------------------------------------------------
|
3
|
+
# block devices
|
4
|
+
#
|
5
|
+
blocks = []
|
6
|
+
|
7
|
+
Facter.value('blockdevices').split(/\W+/).each do |dev|
|
8
|
+
|
9
|
+
block = {
|
10
|
+
:name => dev,
|
11
|
+
:device => (File.exists?("/dev/#{dev}") ? "/dev/#{dev}" : nil),
|
12
|
+
:vendor => Facter.value("blockdevice_#{dev}_vendor"),
|
13
|
+
:model => Facter.value("blockdevice_#{dev}_model"),
|
14
|
+
:size => (Integer(Facter.value("blockdevice_#{dev}_size")) rescue nil)
|
15
|
+
}
|
16
|
+
|
17
|
+
if File.directory?("/sys/block/#{dev}")
|
18
|
+
block[:removable] = (File.read("/sys/block/#{dev}/removable").to_s.chomp.strip == '1' rescue nil)
|
19
|
+
block[:readonly] = (File.read("/sys/block/#{dev}/ro").to_s.chomp.strip == '1' rescue nil)
|
20
|
+
block[:solidstate] = (File.read("/sys/block/#{dev}/queue/rotational").to_s.chomp.strip == '0' rescue nil)
|
21
|
+
block[:sectorsize] = {}
|
22
|
+
|
23
|
+
%w{
|
24
|
+
logical
|
25
|
+
physical
|
26
|
+
}.each do |s|
|
27
|
+
block[:sectorsize][s.to_sym] = (Integer(File.read("/sys/block/#{dev}/queue/#{s}_block_size").chomp.strip) rescue nil)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
blocks << block.compact
|
32
|
+
end
|
33
|
+
|
34
|
+
stat 'disk.@block', blocks unless blocks.empty?
|
35
|
+
end
|
@@ -1,52 +1,4 @@
|
|
1
|
-
# Onering Collector - Disk Statistics plugin
|
2
|
-
# provides data on disks, mounts, and RAID configuration
|
3
|
-
#
|
4
|
-
|
5
1
|
report do
|
6
|
-
# ------------------------------------------------------------------------------
|
7
|
-
# mounts
|
8
|
-
#
|
9
|
-
mounts = {}
|
10
|
-
current_dev = nil
|
11
|
-
|
12
|
-
uuids = Hash[Dir["/dev/disk/by-uuid/*"].collect{|i|
|
13
|
-
[File.expand_path(File.readlink(i), File.dirname(i)), File.basename(i)]
|
14
|
-
}]
|
15
|
-
|
16
|
-
File.read("/etc/mtab").lines.each do |line|
|
17
|
-
dev,mount,fstype,flags,dump,pass = line.split(/\s+/)
|
18
|
-
|
19
|
-
mounts[dev] = {
|
20
|
-
:mount => mount,
|
21
|
-
:device => dev,
|
22
|
-
:filesystem => fstype,
|
23
|
-
:flags => flags.split(/\s*,\s*/),
|
24
|
-
:uuid => uuids[dev]
|
25
|
-
}.compact
|
26
|
-
end
|
27
|
-
|
28
|
-
# logical space utilization
|
29
|
-
Facter::Util::Resolution.exec("df 2> /dev/null").to_s.lines.each do |line|
|
30
|
-
next if line =~ /^Filesystem/
|
31
|
-
parts = line.split(/\s+/)
|
32
|
-
|
33
|
-
if parts.length == 1
|
34
|
-
current_dev = parts.first
|
35
|
-
next
|
36
|
-
|
37
|
-
else
|
38
|
-
dev,kblk,used,free,percent,mount = parts
|
39
|
-
dev = current_dev if dev.empty?
|
40
|
-
next unless mounts[dev] and mounts[dev].is_a?(Hash)
|
41
|
-
|
42
|
-
mounts[dev][:used] = (used.to_i * 1024)
|
43
|
-
mounts[dev][:available] = (free.to_i * 1024)
|
44
|
-
mounts[dev][:total] = (mounts[dev][:available] + mounts[dev][:used])
|
45
|
-
mounts[dev][:percent_used] = percent.delete('%').to_i
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
2
|
# ------------------------------------------------------------------------------
|
51
3
|
# LVM
|
52
4
|
#
|
@@ -112,15 +64,10 @@ report do
|
|
112
64
|
end
|
113
65
|
end
|
114
66
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
d[:@mounts] = (Hash[mounts.select{|k,v| k =~ /^\/dev\/((h|s|xv|v)d|mapper|vgc)/ }].values rescue nil)
|
119
|
-
d[:lvm] = {
|
67
|
+
lvm = {}
|
68
|
+
lvm = {
|
120
69
|
:@groups => vg.values
|
121
70
|
} unless vg.values.empty?
|
122
71
|
|
123
|
-
|
124
|
-
|
125
|
-
stat :disk, d.compact
|
126
|
-
end
|
72
|
+
stat 'disk.@lvm', lvm unless lvm.empty?
|
73
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
report do
|
2
|
+
# ------------------------------------------------------------------------------
|
3
|
+
# mounts
|
4
|
+
#
|
5
|
+
mounts = {}
|
6
|
+
current_dev = nil
|
7
|
+
|
8
|
+
uuids = Hash[Dir["/dev/disk/by-uuid/*"].collect{|i|
|
9
|
+
[File.expand_path(File.readlink(i), File.dirname(i)), File.basename(i)]
|
10
|
+
}]
|
11
|
+
|
12
|
+
File.read("/etc/mtab").lines.each do |line|
|
13
|
+
dev,mount,fstype,flags,dump,pass = line.split(/\s+/)
|
14
|
+
|
15
|
+
mounts[dev] = {
|
16
|
+
:mount => mount,
|
17
|
+
:device => dev,
|
18
|
+
:filesystem => fstype,
|
19
|
+
:flags => flags.split(/\s*,\s*/),
|
20
|
+
:uuid => uuids[dev]
|
21
|
+
}.compact
|
22
|
+
end
|
23
|
+
|
24
|
+
# logical space utilization
|
25
|
+
Facter::Util::Resolution.exec("df 2> /dev/null").to_s.lines.each do |line|
|
26
|
+
next if line =~ /^Filesystem/
|
27
|
+
parts = line.split(/\s+/)
|
28
|
+
|
29
|
+
if parts.length == 1
|
30
|
+
current_dev = parts.first
|
31
|
+
next
|
32
|
+
|
33
|
+
else
|
34
|
+
dev,kblk,used,free,percent,mount = parts
|
35
|
+
dev = current_dev if dev.empty?
|
36
|
+
next unless mounts[dev] and mounts[dev].is_a?(Hash)
|
37
|
+
|
38
|
+
mounts[dev][:used] = (used.to_i * 1024)
|
39
|
+
mounts[dev][:available] = (free.to_i * 1024)
|
40
|
+
mounts[dev][:total] = (mounts[dev][:available] + mounts[dev][:used])
|
41
|
+
mounts[dev][:percent_used] = percent.delete('%').to_i
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
stat 'disk.@mounts', (Hash[mounts.select{|k,v| k =~ /^\/dev\/((h|s|xv|v)d|mapper|vgc)/ }].values rescue nil)
|
46
|
+
end
|
@@ -1,7 +1,3 @@
|
|
1
|
-
# Onering Collector - Base Statistics plugin
|
2
|
-
# provides basic system statistics and hardware profile to the Onering API
|
3
|
-
#
|
4
|
-
|
5
1
|
report do
|
6
2
|
# ------------------------------------------------------------------------------
|
7
3
|
# memory
|
@@ -111,39 +107,5 @@ report do
|
|
111
107
|
end
|
112
108
|
end
|
113
109
|
|
114
|
-
|
115
|
-
|
116
|
-
# ------------------------------------------------------------------------------
|
117
|
-
# cpu
|
118
|
-
#
|
119
|
-
stats_cpu = {
|
120
|
-
:count => 0,
|
121
|
-
:processors => []
|
122
|
-
}
|
123
|
-
|
124
|
-
current_cpu = nil
|
125
|
-
|
126
|
-
File.open("/proc/cpuinfo").each do |line|
|
127
|
-
case line
|
128
|
-
when /processor\s+:\s(.+)/
|
129
|
-
current_cpu = $1.to_i
|
130
|
-
stats_cpu[:count] += 1
|
131
|
-
stats_cpu[:processors][current_cpu] = {
|
132
|
-
:number => current_cpu
|
133
|
-
}
|
134
|
-
when /cpu MHz\s+:\s(.+)/
|
135
|
-
stats_cpu[:processors][current_cpu][:speed] = $1.to_f
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
|
140
|
-
# ------------------------------------------------------------------------------
|
141
|
-
# set stat properties
|
142
|
-
#
|
143
110
|
stat :memory, stats_mem
|
144
|
-
|
145
|
-
'count' => Facter.value('processorcount').to_i,
|
146
|
-
'physical' => Facter.value('physicalprocessorcount').to_i,
|
147
|
-
'speed' => stats_cpu[:processors].collect{|i| i[:speed] }.compact.uniq.sort{|a,b| a.to_f <=> b.to_f }.last.to_f
|
148
|
-
} rescue nil)
|
149
|
-
end
|
111
|
+
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.55
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -34,17 +34,22 @@ executables: []
|
|
34
34
|
extensions: []
|
35
35
|
extra_rdoc_files: []
|
36
36
|
files:
|
37
|
+
- lib/reporter/default/properties_system_disk_mounts.rb
|
37
38
|
- lib/reporter/default/properties_facter.rb
|
38
39
|
- lib/reporter/default/stats_virident.rb
|
39
|
-
- lib/reporter/default/
|
40
|
+
- lib/reporter/default/properties_system_cpu.rb
|
41
|
+
- lib/reporter/default/properties_system_disk_lvm.rb
|
40
42
|
- lib/reporter/default/properties_xen.rb
|
41
43
|
- lib/reporter/default/properties_openvz.rb
|
44
|
+
- lib/reporter/default/properties_system_disk_block.rb
|
42
45
|
- lib/reporter/default/properties_haproxy.rb
|
46
|
+
- lib/reporter/default/properties_system_memory.rb
|
43
47
|
- lib/reporter/default/properties_network.rb
|
44
48
|
- lib/reporter/default/properties_physical.rb
|
45
49
|
- lib/reporter/default/properties_ohai.rb
|
50
|
+
- lib/reporter/default/properties_system_disk_smart.rb
|
46
51
|
- lib/reporter/default/stats_zfs.rb
|
47
|
-
- lib/reporter/default/
|
52
|
+
- lib/reporter/default/properties_ipmi.rb
|
48
53
|
- lib/reporter/default/properties_services.rb
|
49
54
|
- lib/reporter/default/properties_chef.rb
|
50
55
|
- lib/facter/onering_properties_openvz.rb
|