kurchatov 0.0.5.pre5 → 0.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 +4 -4
- data/CHANGELOG +1 -0
- data/README.md +6 -7
- data/Rakefile +1 -1
- data/Vagrantfile +5 -6
- data/bin/kurchatov +2 -2
- data/examples/check_file_contains.rb +4 -4
- data/examples/count_proc.rb +5 -5
- data/examples/cpu.rb +5 -5
- data/examples/disk.rb +3 -3
- data/examples/disk_stat.rb +6 -6
- data/examples/dns_check.rb +2 -2
- data/examples/exim.rb +1 -1
- data/examples/file_age.rb +5 -5
- data/examples/find_files.rb +1 -1
- data/examples/http.rb +3 -3
- data/examples/iptables.rb +3 -3
- data/examples/la.rb +12 -12
- data/examples/mdadm.rb +1 -1
- data/examples/memory.rb +8 -8
- data/examples/net.rb +6 -6
- data/examples/net_stat.rb +4 -4
- data/examples/nfs.rb +2 -2
- data/examples/nginx.rb +1 -1
- data/examples/nginx_500.rb +8 -8
- data/examples/ntp.rb +5 -5
- data/examples/openfiles.rb +2 -2
- data/examples/pgsql.rb +3 -3
- data/examples/ping_icmp.rb +4 -4
- data/examples/ping_tcp.rb +4 -4
- data/examples/proc_mem.rb +6 -6
- data/examples/rabbitmq.rb +4 -4
- data/examples/runit.rb +1 -1
- data/examples/sidekiq.rb +12 -12
- data/examples/sidekiq_queue_state.rb +3 -3
- data/examples/status_file.rb +4 -4
- data/examples/tw_cli.rb +4 -4
- data/examples/uptime.rb +4 -4
- data/kurchatov.gemspec +19 -18
- data/lib/kurchatov/application.rb +73 -74
- data/lib/kurchatov/mashie.rb +32 -27
- data/lib/kurchatov/mixin/command.rb +0 -5
- data/lib/kurchatov/mixin/event.rb +7 -5
- data/lib/kurchatov/mixin/http.rb +4 -4
- data/lib/kurchatov/mixin/init.rb +5 -5
- data/lib/kurchatov/mixin/ohai.rb +11 -3
- data/lib/kurchatov/mixin/queue.rb +7 -4
- data/lib/kurchatov/plugin/config.rb +8 -7
- data/lib/kurchatov/plugin/dsl.rb +3 -1
- data/lib/kurchatov/plugin/riemann.rb +7 -8
- data/lib/kurchatov/responders/http.rb +6 -6
- data/lib/kurchatov/responders/init.rb +3 -3
- data/lib/kurchatov/responders/riemann.rb +2 -4
- data/lib/kurchatov/responders/udp.rb +2 -3
- data/lib/kurchatov/riemann/client.rb +12 -12
- data/lib/kurchatov/riemann/event.rb +1 -1
- data/lib/kurchatov/riemann/message.rb +2 -2
- data/lib/kurchatov/version.rb +1 -1
- data/lib/kurchatov.rb +4 -2
- data/lib/ohai/plugins/darwin/cpu.rb +3 -3
- data/lib/ohai/plugins/darwin/hostname.rb +3 -3
- data/lib/ohai/plugins/darwin/platform.rb +12 -12
- data/lib/ohai/plugins/hostname.rb +2 -2
- data/lib/ohai/plugins/linux/cpu.rb +29 -29
- data/lib/ohai/plugins/linux/hostname.rb +4 -4
- data/lib/ohai/plugins/linux/platform.rb +40 -40
- data/lib/ohai/plugins/linux/virtualization.rb +51 -51
- data/lib/ohai/plugins/os.rb +26 -26
- data/lib/ohai/plugins/platform.rb +4 -4
- data/lib/ohai/plugins/virtualization.rb +17 -17
- data/lib/ohai/plugins/windows/cpu.rb +11 -11
- data/lib/ohai/plugins/windows/platform.rb +1 -1
- data/tests/run.sh +4 -4
- data/tests/server.rb +2 -2
- metadata +18 -3
data/lib/ohai/plugins/os.rb
CHANGED
@@ -16,38 +16,38 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
provides
|
19
|
+
provides 'os', 'os_version'
|
20
20
|
|
21
21
|
require 'rbconfig'
|
22
22
|
|
23
23
|
require_plugin 'kernel'
|
24
24
|
|
25
25
|
case ::RbConfig::CONFIG['host_os']
|
26
|
-
when /aix(.+)$/
|
27
|
-
|
28
|
-
when /darwin(.+)$/
|
29
|
-
|
30
|
-
when /hpux(.+)$/
|
31
|
-
|
32
|
-
when /linux/
|
33
|
-
|
34
|
-
when /freebsd(.+)$/
|
35
|
-
|
36
|
-
when /openbsd(.+)$/
|
37
|
-
|
38
|
-
when /netbsd(.*)$/
|
39
|
-
|
40
|
-
when /solaris2/
|
41
|
-
|
42
|
-
when /mswin|mingw32|windows/
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
else
|
50
|
-
|
26
|
+
when /aix(.+)$/
|
27
|
+
os 'aix'
|
28
|
+
when /darwin(.+)$/
|
29
|
+
os 'darwin'
|
30
|
+
when /hpux(.+)$/
|
31
|
+
os 'hpux'
|
32
|
+
when /linux/
|
33
|
+
os 'linux'
|
34
|
+
when /freebsd(.+)$/
|
35
|
+
os 'freebsd'
|
36
|
+
when /openbsd(.+)$/
|
37
|
+
os 'openbsd'
|
38
|
+
when /netbsd(.*)$/
|
39
|
+
os 'netbsd'
|
40
|
+
when /solaris2/
|
41
|
+
os 'solaris2'
|
42
|
+
when /mswin|mingw32|windows/
|
43
|
+
# After long discussion in IRC the "powers that be" have come to a concensus
|
44
|
+
# that there is no other Windows platforms exist that were not based on the
|
45
|
+
# Windows_NT kernel, so we herby decree that "windows" will refer to all
|
46
|
+
# platforms built upon the Windows_NT kernel and have access to win32 or win64
|
47
|
+
# subsystems.
|
48
|
+
os 'windows'
|
49
|
+
else
|
50
|
+
os ::RbConfig::CONFIG['host_os']
|
51
51
|
end
|
52
52
|
|
53
53
|
os_version kernel[:release]
|
@@ -16,13 +16,13 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
provides
|
19
|
+
provides 'platform', 'platform_version', 'platform_family'
|
20
20
|
|
21
21
|
require_plugin "#{os}::platform"
|
22
22
|
|
23
|
-
platform os unless attribute?(
|
23
|
+
platform os unless attribute?('platform')
|
24
24
|
|
25
|
-
platform_version os_version unless attribute?(
|
25
|
+
platform_version os_version unless attribute?('platform_version')
|
26
26
|
|
27
|
-
platform_family platform unless attribute?(
|
27
|
+
platform_family platform unless attribute?('platform_family')
|
28
28
|
|
@@ -16,11 +16,11 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
provides
|
19
|
+
provides 'virtualization'
|
20
20
|
|
21
21
|
require_plugin "#{os}::virtualization"
|
22
22
|
|
23
|
-
unless virtualization.nil? || !(virtualization[:role].eql?(
|
23
|
+
unless virtualization.nil? || !(virtualization[:role].eql?('host'))
|
24
24
|
begin
|
25
25
|
require 'libvirt'
|
26
26
|
require 'hpricot'
|
@@ -32,50 +32,50 @@ unless virtualization.nil? || !(virtualization[:role].eql?("host"))
|
|
32
32
|
|
33
33
|
virtualization[:uri] = virtconn.uri
|
34
34
|
virtualization[:capabilities] = Mash.new
|
35
|
-
virtualization[:capabilities][:xml_desc] = (virtconn.capabilities.split("\n").collect {|line| line.strip}).join
|
35
|
+
virtualization[:capabilities][:xml_desc] = (virtconn.capabilities.split("\n").collect { |line| line.strip }).join
|
36
36
|
#xdoc = Hpricot virtualization[:capabilities][:xml_desc]
|
37
|
-
|
37
|
+
|
38
38
|
virtualization[:nodeinfo] = Mash.new
|
39
39
|
ni = virtconn.node_get_info
|
40
|
-
|
40
|
+
%w(cores cpus memory mhz model nodes sockets threads).each { |a| virtualization[:nodeinfo][a] = ni.send(a) }
|
41
41
|
|
42
42
|
virtualization[:domains] = Mash.new
|
43
43
|
virtconn.list_domains.each do |d|
|
44
44
|
dv = virtconn.lookup_domain_by_id d
|
45
45
|
virtualization[:domains][dv.name] = Mash.new
|
46
46
|
virtualization[:domains][dv.name][:id] = d
|
47
|
-
virtualization[:domains][dv.name][:xml_desc] = (dv.xml_desc.split("\n").collect {|line| line.strip}).join
|
48
|
-
|
49
|
-
|
47
|
+
virtualization[:domains][dv.name][:xml_desc] = (dv.xml_desc.split("\n").collect { |line| line.strip }).join
|
48
|
+
%w(os_type uuid).each { |a| virtualization[:domains][dv.name][a] = dv.send(a) }
|
49
|
+
%w(cpu_time max_mem memory nr_virt_cpu state).each { |a| virtualization[:domains][dv.name][a] = dv.info.send(a) }
|
50
50
|
#xdoc = Hpricot virtualization[:domains][dv.name][:xml_desc]
|
51
|
-
|
51
|
+
|
52
52
|
end
|
53
53
|
|
54
54
|
virtualization[:networks] = Mash.new
|
55
55
|
virtconn.list_networks.each do |n|
|
56
56
|
nv = virtconn.lookup_network_by_name n
|
57
57
|
virtualization[:networks][n] = Mash.new
|
58
|
-
virtualization[:networks][n][:xml_desc] = (nv.xml_desc.split("\n").collect {|line| line.strip}).join
|
59
|
-
|
58
|
+
virtualization[:networks][n][:xml_desc] = (nv.xml_desc.split("\n").collect { |line| line.strip }).join
|
59
|
+
%w(bridge_name uuid).each { |a| virtualization[:networks][n][a] = nv.send(a) }
|
60
60
|
#xdoc = Hpricot virtualization[:networks][n][:xml_desc]
|
61
|
-
|
61
|
+
|
62
62
|
end
|
63
63
|
|
64
64
|
virtualization[:storage] = Mash.new
|
65
65
|
virtconn.list_storage_pools.each do |pool|
|
66
66
|
sp = virtconn.lookup_storage_pool_by_name pool
|
67
67
|
virtualization[:storage][pool] = Mash.new
|
68
|
-
virtualization[:storage][pool][:xml_desc] = (sp.xml_desc.split("\n").collect {|line| line.strip}).join
|
69
|
-
|
70
|
-
|
68
|
+
virtualization[:storage][pool][:xml_desc] = (sp.xml_desc.split("\n").collect { |line| line.strip }).join
|
69
|
+
%w(autostart uuid).each { |a| virtualization[:storage][pool][a] = sp.send(a) }
|
70
|
+
%w(allocation available capacity state).each { |a| virtualization[:storage][pool][a] = sp.info.send(a) }
|
71
71
|
#xdoc = Hpricot virtualization[:storage][pool][:xml_desc]
|
72
72
|
|
73
73
|
virtualization[:storage][pool][:volumes] = Mash.new
|
74
74
|
sp.list_volumes.each do |v|
|
75
75
|
virtualization[:storage][pool][:volumes][v] = Mash.new
|
76
76
|
sv = sp.lookup_volume_by_name v
|
77
|
-
|
78
|
-
|
77
|
+
%w(key name path).each { |a| virtualization[:storage][pool][:volumes][v][a] = sv.send(a) }
|
78
|
+
%w(allocation capacity type).each { |a| virtualization[:storage][pool][:volumes][v][a] = sv.info.send(a) }
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
require 'ruby-wmi'
|
20
20
|
|
21
|
-
provides
|
21
|
+
provides 'cpu'
|
22
22
|
|
23
23
|
cpuinfo = Mash.new
|
24
24
|
cpu_number = 0
|
@@ -40,22 +40,22 @@ WMI::Win32_Processor.find(:all).each do |processor|
|
|
40
40
|
number_of_cores = processor.numberofcores
|
41
41
|
cpu_number += number_of_cores
|
42
42
|
rescue NoMethodError => e
|
43
|
-
Ohai::Log.info(
|
43
|
+
Ohai::Log.info('Can not find numberofcores property on Win32_Processor. Consider applying this patch: http://support.microsoft.com/kb/932370')
|
44
44
|
end
|
45
45
|
|
46
46
|
current_cpu = index.to_s
|
47
47
|
index += 1
|
48
48
|
cpuinfo[current_cpu] = Mash.new
|
49
|
-
cpuinfo[current_cpu][
|
50
|
-
cpuinfo[current_cpu][
|
51
|
-
cpuinfo[current_cpu][
|
52
|
-
cpuinfo[current_cpu][
|
53
|
-
cpuinfo[current_cpu][
|
49
|
+
cpuinfo[current_cpu]['vendor_id'] = processor.manufacturer
|
50
|
+
cpuinfo[current_cpu]['family'] = processor.family.to_s
|
51
|
+
cpuinfo[current_cpu]['model'] = processor.revision.to_s
|
52
|
+
cpuinfo[current_cpu]['stepping'] = processor.stepping
|
53
|
+
cpuinfo[current_cpu]['physical_id'] = processor.deviceid
|
54
54
|
#cpuinfo[current_cpu]["core_id"] = XXX
|
55
|
-
cpuinfo[current_cpu][
|
56
|
-
cpuinfo[current_cpu][
|
57
|
-
cpuinfo[current_cpu][
|
58
|
-
cpuinfo[current_cpu][
|
55
|
+
cpuinfo[current_cpu]['cores'] = number_of_cores
|
56
|
+
cpuinfo[current_cpu]['model_name'] = processor.description
|
57
|
+
cpuinfo[current_cpu]['mhz'] = processor.maxclockspeed.to_s
|
58
|
+
cpuinfo[current_cpu]['cache_size'] = "#{processor.l2cachesize} KB"
|
59
59
|
#cpuinfo[current_cpu]["flags"] = XXX
|
60
60
|
end
|
61
61
|
|
data/tests/run.sh
CHANGED
@@ -50,10 +50,10 @@ grep -q 'STDERR: ls: cannot access /notexists' ./tmp/testplugin.log
|
|
50
50
|
bundle exec ./bin/kurchatov -d ./tmp/ -c ./tmp/config.yml --hosts 127.0.0.1 -l debug --stop-on-error --logfile ./tmp/loadplugins.log
|
51
51
|
echo "Stdout loader"
|
52
52
|
cat ./tmp/loadplugins.log
|
53
|
-
grep '
|
54
|
-
grep '
|
55
|
-
grep '
|
56
|
-
grep 'file command ls return:
|
53
|
+
grep 'Start plugins' ./tmp/loadplugins.log | grep -q '@name="test_0"'
|
54
|
+
grep 'Start plugins' ./tmp/loadplugins.log | grep -q '@name="test_1"'
|
55
|
+
grep 'Start plugins' ./tmp/loadplugins.log | grep -q '@name="test2"'
|
56
|
+
grep 'file command ls return: CHANGELOG' ./tmp/loadplugins.log
|
57
57
|
grep 'get size from http://google.com:' ./tmp/loadplugins.log
|
58
58
|
grep 'get size from https://www.kernel.org' ./tmp/loadplugins.log
|
59
59
|
grep 'get size from ./tests/run.sh' ./tmp/loadplugins.log
|
data/tests/server.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kurchatov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.5
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasiliev Dmitry
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: pry
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,6 +118,7 @@ extra_rdoc_files: []
|
|
104
118
|
files:
|
105
119
|
- .gitignore
|
106
120
|
- .travis.yml
|
121
|
+
- CHANGELOG
|
107
122
|
- Gemfile
|
108
123
|
- LICENSE.txt
|
109
124
|
- README.md
|
@@ -202,9 +217,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
202
217
|
version: '0'
|
203
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
219
|
requirements:
|
205
|
-
- - '
|
220
|
+
- - '>='
|
206
221
|
- !ruby/object:Gem::Version
|
207
|
-
version:
|
222
|
+
version: '0'
|
208
223
|
requirements: []
|
209
224
|
rubyforge_project:
|
210
225
|
rubygems_version: 2.0.3
|