kurchatov 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/Gemfile +1 -1
- data/app/Gemfile.lock +2 -2
- data/debian/changelog +6 -0
- data/lib/kurchatov/application.rb +0 -2
- data/lib/kurchatov/version.rb +1 -1
- metadata +2 -20
- data/lib/ohai/plugins/darwin/cpu.rb +0 -23
- data/lib/ohai/plugins/darwin/hostname.rb +0 -22
- data/lib/ohai/plugins/darwin/platform.rb +0 -38
- data/lib/ohai/plugins/freebsd/cpu.rb +0 -52
- data/lib/ohai/plugins/freebsd/hostname.rb +0 -22
- data/lib/ohai/plugins/freebsd/platform.rb +0 -23
- data/lib/ohai/plugins/freebsd/virtualization.rb +0 -93
- data/lib/ohai/plugins/hostname.rb +0 -27
- data/lib/ohai/plugins/linux/cpu.rb +0 -60
- data/lib/ohai/plugins/linux/hostname.rb +0 -26
- data/lib/ohai/plugins/linux/platform.rb +0 -113
- data/lib/ohai/plugins/linux/virtualization.rb +0 -125
- data/lib/ohai/plugins/os.rb +0 -53
- data/lib/ohai/plugins/platform.rb +0 -28
- data/lib/ohai/plugins/virtualization.rb +0 -86
- data/lib/ohai/plugins/windows/cpu.rb +0 -64
- data/lib/ohai/plugins/windows/hostname.rb +0 -33
- data/lib/ohai/plugins/windows/platform.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8d6eb36e174f42d37ad9c7cba3c33dd0c60fff4
|
4
|
+
data.tar.gz: 59be76330cb9ffdab86f2ea892f3c399b49ce99d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e94b9621f4315d9657375eeb8197a8b54dc22ed0a97b56c27188162b8208fa962342bce75af7caf0ab4b08a325d24ca69ef44180f69f1692cf8f660cff00179b
|
7
|
+
data.tar.gz: c07a3581a3e1dbff6925a52a4585c98b92a16205e599ed520e836d27a859c76d1f7f5fbd911babb16a19ddb8ea52879dda9273ccf7ffef948f14a361e257ba42
|
data/app/Gemfile
CHANGED
data/app/Gemfile.lock
CHANGED
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
file-tail (1.0.12)
|
12
12
|
tins (~> 0.5)
|
13
13
|
ipaddress (0.8.0)
|
14
|
-
kurchatov (0.3.
|
14
|
+
kurchatov (0.3.6)
|
15
15
|
beefcake (>= 0.3.5)
|
16
16
|
ohai (~> 6.20.0)
|
17
17
|
mixlib-cli (1.5.0)
|
@@ -46,7 +46,7 @@ DEPENDENCIES
|
|
46
46
|
beefcake (= 0.5.0)
|
47
47
|
ffi-rzmq
|
48
48
|
file-tail
|
49
|
-
kurchatov (= 0.3.
|
49
|
+
kurchatov (= 0.3.6)
|
50
50
|
net-ntp
|
51
51
|
net-ping
|
52
52
|
parallel
|
data/debian/changelog
CHANGED
@@ -108,8 +108,6 @@ module Kurchatov
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def configure_defaults
|
111
|
-
::Ohai::Config[:plugin_path] = [::Ohai::Config[:plugin_path],
|
112
|
-
File.expand_path(File.join('..', 'ohai', 'plugins'), File.dirname(__FILE__))].flatten.compact
|
113
111
|
if Config[:ohai_plugins_paths]
|
114
112
|
::Ohai::Config[:plugin_path] += Config[:ohai_plugins_paths]
|
115
113
|
end
|
data/lib/kurchatov/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kurchatov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasiliev Dmitry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: beefcake
|
@@ -182,24 +182,6 @@ files:
|
|
182
182
|
- lib/kurchatov/riemann/event.rb
|
183
183
|
- lib/kurchatov/riemann/message.rb
|
184
184
|
- lib/kurchatov/version.rb
|
185
|
-
- lib/ohai/plugins/darwin/cpu.rb
|
186
|
-
- lib/ohai/plugins/darwin/hostname.rb
|
187
|
-
- lib/ohai/plugins/darwin/platform.rb
|
188
|
-
- lib/ohai/plugins/freebsd/cpu.rb
|
189
|
-
- lib/ohai/plugins/freebsd/hostname.rb
|
190
|
-
- lib/ohai/plugins/freebsd/platform.rb
|
191
|
-
- lib/ohai/plugins/freebsd/virtualization.rb
|
192
|
-
- lib/ohai/plugins/hostname.rb
|
193
|
-
- lib/ohai/plugins/linux/cpu.rb
|
194
|
-
- lib/ohai/plugins/linux/hostname.rb
|
195
|
-
- lib/ohai/plugins/linux/platform.rb
|
196
|
-
- lib/ohai/plugins/linux/virtualization.rb
|
197
|
-
- lib/ohai/plugins/os.rb
|
198
|
-
- lib/ohai/plugins/platform.rb
|
199
|
-
- lib/ohai/plugins/virtualization.rb
|
200
|
-
- lib/ohai/plugins/windows/cpu.rb
|
201
|
-
- lib/ohai/plugins/windows/hostname.rb
|
202
|
-
- lib/ohai/plugins/windows/platform.rb
|
203
185
|
- tests/data/config.yml
|
204
186
|
- tests/data/event.yml
|
205
187
|
- tests/data/plugins/plugin_data.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Nathan L Smith (<nlloyds@gmail.com>)
|
3
|
-
# Copyright:: Copyright (c) 2013 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides 'cpu'
|
20
|
-
|
21
|
-
cpu Mash.new
|
22
|
-
cpu[:real] = from('sysctl -n hw.physicalcpu').to_i
|
23
|
-
cpu[:total] = from('sysctl -n hw.logicalcpu').to_i
|
@@ -1,22 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides 'fqdn', 'hostname'
|
20
|
-
|
21
|
-
hostname from('hostname -s')
|
22
|
-
fqdn from('hostname')
|
@@ -1,38 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides 'platform', 'platform_version', 'platform_build', 'platform_family'
|
20
|
-
|
21
|
-
popen4('/usr/bin/sw_vers') do |pid, stdin, stdout, stderr|
|
22
|
-
stdin.close
|
23
|
-
stdout.each do |line|
|
24
|
-
case line
|
25
|
-
when /^ProductName:\s+(.+)$/
|
26
|
-
macname = $1
|
27
|
-
macname.downcase!
|
28
|
-
macname.gsub!(' ', '_')
|
29
|
-
platform macname
|
30
|
-
when /^ProductVersion:\s+(.+)$/
|
31
|
-
platform_version $1
|
32
|
-
when /^BuildVersion:\s+(.+)$/
|
33
|
-
platform_build $1
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
platform_family 'mac_os_x'
|
@@ -1,52 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Bryan McLellan (btm@loftninjas.org)
|
3
|
-
# Copyright:: Copyright (c) 2008 Bryan McLellan
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides "cpu"
|
20
|
-
|
21
|
-
# all dmesg output for smp I can find only provides info about a single processor
|
22
|
-
# identical processors is probably a hardware requirement so we'll duplicate data for each cpu
|
23
|
-
# old examples: http://www.bnv-bamberg.de/home/ba3294/smp/rbuild/index.htm
|
24
|
-
cpuinfo = Mash.new
|
25
|
-
|
26
|
-
# /var/run/dmesg.boot
|
27
|
-
#CPU: QEMU Virtual CPU version 0.9.1 (1862.02-MHz 686-class CPU)
|
28
|
-
# Origin = "GenuineIntel" Id = 0x623 Stepping = 3
|
29
|
-
# Features=0x78bfbfd<FPU,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2>
|
30
|
-
# Features2=0x80000001<SSE3,<b31>>
|
31
|
-
|
32
|
-
File.open("/var/run/dmesg.boot").each do |line|
|
33
|
-
case line
|
34
|
-
when /CPU:\s+(.+) \(([\d.]+).+\)/
|
35
|
-
cpuinfo["model_name"] = $1
|
36
|
-
cpuinfo["mhz"] = $2
|
37
|
-
when /Origin = "(.+)"\s+Id = (.+)\s+Stepping = (.+)/
|
38
|
-
cpuinfo["vendor_id"] = $1
|
39
|
-
cpuinfo["stepping"] = $3
|
40
|
-
# These _should_ match /AMD Features2?/ lines as well
|
41
|
-
when /Features=.+<(.+)>/
|
42
|
-
cpuinfo["flags"] = $1.downcase.split(',')
|
43
|
-
# Features2=0x80000001<SSE3,<b31>>
|
44
|
-
when /Features2=[a-f\dx]+<(.+)>/
|
45
|
-
cpuinfo["flags"].concat($1.downcase.split(','))
|
46
|
-
when /Logical CPUs per core: (\d+)/
|
47
|
-
cpuinfo["cores"] = $1
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
cpu cpuinfo
|
52
|
-
cpu[:total] = from("sysctl -n hw.ncpu")
|
@@ -1,22 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Bryan McLellan (btm@loftninjas.org)
|
3
|
-
# Copyright:: Copyright (c) 2009 Bryan McLellan
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides "hostname", "fqdn"
|
20
|
-
|
21
|
-
hostname from("hostname -s")
|
22
|
-
fqdn from("hostname -f")
|
@@ -1,23 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Bryan McLellan (btm@loftninjas.org)
|
3
|
-
# Copyright:: Copyright (c) 2009 Bryan McLellan
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides "platform", "platform_version"
|
20
|
-
|
21
|
-
platform from("uname -s").downcase
|
22
|
-
platform_version from("uname -r")
|
23
|
-
|
@@ -1,93 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Bryan McLellan (btm@loftninjas.org)
|
3
|
-
# Copyright:: Copyright (c) 2009 Bryan McLellan
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides "virtualization"
|
20
|
-
|
21
|
-
virtualization Mash.new
|
22
|
-
|
23
|
-
if from("sysctl -n security.jail.jailed").to_i == 1
|
24
|
-
virtualization[:system] = "jail"
|
25
|
-
virtualization[:role] = "guest"
|
26
|
-
end
|
27
|
-
|
28
|
-
# detect from modules
|
29
|
-
popen4("/sbin/kldstat") do |pid, stdin, stdout, stderr|
|
30
|
-
stdin.close
|
31
|
-
stdout.each do |line|
|
32
|
-
case line
|
33
|
-
when /vboxdrv/
|
34
|
-
virtualization[:system] = "vbox"
|
35
|
-
virtualization[:role] = "host"
|
36
|
-
when /vboxguest/
|
37
|
-
virtualization[:system] = "vbox"
|
38
|
-
virtualization[:role] = "guest"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
|
-
# XXX doesn't work when jail is there but not running (ezjail-admin stop)
|
45
|
-
if from("jls -n \| wc -l").to_i >= 1
|
46
|
-
virtualization[:system] = "jail"
|
47
|
-
virtualization[:role] = "host"
|
48
|
-
end
|
49
|
-
|
50
|
-
# KVM Host support for FreeBSD is in development
|
51
|
-
# http://feanor.sssup.it/~fabio/freebsd/lkvm/
|
52
|
-
|
53
|
-
# Detect KVM/QEMU from cpu, report as KVM
|
54
|
-
# hw.model: QEMU Virtual CPU version 0.9.1
|
55
|
-
if from("sysctl -n hw.model") =~ /QEMU Virtual CPU/
|
56
|
-
virtualization[:system] = "kvm"
|
57
|
-
virtualization[:role] = "guest"
|
58
|
-
end
|
59
|
-
|
60
|
-
# http://www.dmo.ca/blog/detecting-virtualization-on-linux
|
61
|
-
if File.exists?("/usr/local/sbin/dmidecode")
|
62
|
-
popen4("dmidecode") do |pid, stdin, stdout, stderr|
|
63
|
-
stdin.close
|
64
|
-
found_virt_manufacturer = nil
|
65
|
-
found_virt_product = nil
|
66
|
-
stdout.each do |line|
|
67
|
-
case line
|
68
|
-
when /Manufacturer: Microsoft/
|
69
|
-
found_virt_manufacturer = "microsoft"
|
70
|
-
when /Product Name: Virtual Machine/
|
71
|
-
found_virt_product = "microsoft"
|
72
|
-
when /Version: 5.0/
|
73
|
-
if found_virt_manufacturer == "microsoft" && found_virt_product == "microsoft"
|
74
|
-
virtualization[:system] = "virtualpc"
|
75
|
-
virtualization[:role] = "guest"
|
76
|
-
end
|
77
|
-
when /Version: VS2005R2/
|
78
|
-
if found_virt_manufacturer == "microsoft" && found_virt_product == "microsoft"
|
79
|
-
virtualization[:system] = "virtualserver"
|
80
|
-
virtualization[:role] = "guest"
|
81
|
-
end
|
82
|
-
when /Manufacturer: VMware/
|
83
|
-
found_virt_manufacturer = "vmware"
|
84
|
-
when /Product Name: VMware Virtual Platform/
|
85
|
-
if found_virt_manufacturer == "vmware"
|
86
|
-
virtualization[:system] = "vmware"
|
87
|
-
virtualization[:role] = "guest"
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides 'fqdn', 'domain'
|
20
|
-
|
21
|
-
require_plugin "#{os}::hostname"
|
22
|
-
|
23
|
-
# Domain is everything after the first dot
|
24
|
-
if fqdn
|
25
|
-
fqdn =~ /.+?\.(.*)/
|
26
|
-
domain $1
|
27
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides 'cpu'
|
20
|
-
|
21
|
-
cpuinfo = Mash.new
|
22
|
-
real_cpu = Mash.new
|
23
|
-
cpu_number = 0
|
24
|
-
current_cpu = nil
|
25
|
-
|
26
|
-
File.open('/proc/cpuinfo').each do |line|
|
27
|
-
case line
|
28
|
-
when /processor\s+:\s(.+)/
|
29
|
-
cpuinfo[$1] = Mash.new
|
30
|
-
current_cpu = $1
|
31
|
-
cpu_number += 1
|
32
|
-
when /vendor_id\s+:\s(.+)/
|
33
|
-
cpuinfo[current_cpu]['vendor_id'] = $1
|
34
|
-
when /cpu family\s+:\s(.+)/
|
35
|
-
cpuinfo[current_cpu]['family'] = $1
|
36
|
-
when /model\s+:\s(.+)/
|
37
|
-
cpuinfo[current_cpu]['model'] = $1
|
38
|
-
when /stepping\s+:\s(.+)/
|
39
|
-
cpuinfo[current_cpu]['stepping'] = $1
|
40
|
-
when /physical id\s+:\s(.+)/
|
41
|
-
cpuinfo[current_cpu]['physical_id'] = $1
|
42
|
-
real_cpu[$1] = true
|
43
|
-
when /core id\s+:\s(.+)/
|
44
|
-
cpuinfo[current_cpu]['core_id'] = $1
|
45
|
-
when /cpu cores\s+:\s(.+)/
|
46
|
-
cpuinfo[current_cpu]['cores'] = $1
|
47
|
-
when /model name\s+:\s(.+)/
|
48
|
-
cpuinfo[current_cpu]['model_name'] = $1
|
49
|
-
when /cpu MHz\s+:\s(.+)/
|
50
|
-
cpuinfo[current_cpu]['mhz'] = $1
|
51
|
-
when /cache size\s+:\s(.+)/
|
52
|
-
cpuinfo[current_cpu]['cache_size'] = $1
|
53
|
-
when /flags\s+:\s(.+)/
|
54
|
-
cpuinfo[current_cpu]['flags'] = $1.split(' ')
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
cpu cpuinfo
|
59
|
-
cpu[:total] = cpu_number
|
60
|
-
cpu[:real] = real_cpu.keys.length
|
@@ -1,26 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides 'hostname', 'fqdn'
|
20
|
-
|
21
|
-
hostname from('hostname -s')
|
22
|
-
begin
|
23
|
-
fqdn from('hostname --fqdn')
|
24
|
-
rescue
|
25
|
-
Ohai::Log.debug('hostname -f returned an error, probably no domain is set')
|
26
|
-
end
|
@@ -1,113 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
def get_redhatish_platform(contents)
|
20
|
-
contents[/^Red Hat/i] ? 'redhat' : contents[/(\w+)/i, 1].downcase
|
21
|
-
end
|
22
|
-
|
23
|
-
def get_redhatish_version(contents)
|
24
|
-
contents[/Rawhide/i] ? contents[/((\d+) \(Rawhide\))/i, 1].downcase : contents[/release ([\d\.]+)/, 1]
|
25
|
-
end
|
26
|
-
|
27
|
-
provides 'platform', 'platform_version', 'platform_family'
|
28
|
-
|
29
|
-
require_plugin 'linux::lsb'
|
30
|
-
|
31
|
-
# platform [ and platform_version ? ] should be lower case to avoid dealing with RedHat/Redhat/redhat matching
|
32
|
-
if File.exists?('/etc/oracle-release')
|
33
|
-
contents = File.read('/etc/oracle-release').chomp
|
34
|
-
platform 'oracle'
|
35
|
-
platform_version get_redhatish_version(contents)
|
36
|
-
elsif File.exists?('/etc/enterprise-release')
|
37
|
-
contents = File.read('/etc/enterprise-release').chomp
|
38
|
-
platform 'oracle'
|
39
|
-
platform_version get_redhatish_version(contents)
|
40
|
-
elsif File.exists?('/etc/debian_version')
|
41
|
-
# Ubuntu and Debian both have /etc/debian_version
|
42
|
-
# Ubuntu should always have a working lsb, debian does not by default
|
43
|
-
if lsb[:id] =~ /Ubuntu/i
|
44
|
-
platform 'ubuntu'
|
45
|
-
platform_version lsb[:release]
|
46
|
-
elsif lsb[:id] =~ /LinuxMint/i
|
47
|
-
platform 'linuxmint'
|
48
|
-
platform_version lsb[:release]
|
49
|
-
else
|
50
|
-
if File.exists?('/usr/bin/raspi-config')
|
51
|
-
platform 'raspbian'
|
52
|
-
else
|
53
|
-
platform 'debian'
|
54
|
-
end
|
55
|
-
platform_version File.read('/etc/debian_version').chomp
|
56
|
-
end
|
57
|
-
elsif File.exists?('/etc/redhat-release')
|
58
|
-
contents = File.read('/etc/redhat-release').chomp
|
59
|
-
platform get_redhatish_platform(contents)
|
60
|
-
platform_version get_redhatish_version(contents)
|
61
|
-
elsif File.exists?('/etc/system-release')
|
62
|
-
contents = File.read('/etc/system-release').chomp
|
63
|
-
platform get_redhatish_platform(contents)
|
64
|
-
platform_version get_redhatish_version(contents)
|
65
|
-
elsif File.exists?('/etc/gentoo-release')
|
66
|
-
platform 'gentoo'
|
67
|
-
platform_version File.read('/etc/gentoo-release').scan(/(\d+|\.+)/).join
|
68
|
-
elsif File.exists?('/etc/SuSE-release')
|
69
|
-
platform 'suse'
|
70
|
-
suse_release = File.read('/etc/SuSE-release')
|
71
|
-
platform_version suse_release.scan(/VERSION = (\d+)\nPATCHLEVEL = (\d+)/).flatten.join('.')
|
72
|
-
platform_version suse_release.scan(/VERSION = ([\d\.]{2,})/).flatten.join('.') if platform_version == ''
|
73
|
-
elsif File.exists?('/etc/slackware-version')
|
74
|
-
platform 'slackware'
|
75
|
-
platform_version File.read('/etc/slackware-version').scan(/(\d+|\.+)/).join
|
76
|
-
elsif File.exists?('/etc/arch-release')
|
77
|
-
platform 'arch'
|
78
|
-
# no way to determine platform_version in a rolling release distribution
|
79
|
-
# kernel release will be used - ex. 2.6.32-ARCH
|
80
|
-
elsif lsb[:id] =~ /RedHat/i
|
81
|
-
platform 'redhat'
|
82
|
-
platform_version lsb[:release]
|
83
|
-
elsif lsb[:id] =~ /Amazon/i
|
84
|
-
platform 'amazon'
|
85
|
-
platform_version lsb[:release]
|
86
|
-
elsif lsb[:id] =~ /ScientificSL/i
|
87
|
-
platform 'scientific'
|
88
|
-
platform_version lsb[:release]
|
89
|
-
elsif lsb[:id] =~ /XenServer/i
|
90
|
-
platform 'xenserver'
|
91
|
-
platform_version lsb[:release]
|
92
|
-
elsif lsb[:id] # LSB can provide odd data that changes between releases, so we currently fall back on it rather than dealing with its subtleties
|
93
|
-
platform lsb[:id].downcase
|
94
|
-
platform_version lsb[:release]
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
|
-
case platform
|
99
|
-
when /debian/, /ubuntu/, /linuxmint/, /raspbian/
|
100
|
-
platform_family 'debian'
|
101
|
-
when /fedora/
|
102
|
-
platform_family 'fedora'
|
103
|
-
when /oracle/, /centos/, /redhat/, /scientific/, /enterpriseenterprise/, /amazon/, /xenserver/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
|
104
|
-
platform_family 'rhel'
|
105
|
-
when /suse/
|
106
|
-
platform_family 'suse'
|
107
|
-
when /gentoo/
|
108
|
-
platform_family 'gentoo'
|
109
|
-
when /slackware/
|
110
|
-
platform_family 'slackware'
|
111
|
-
when /arch/
|
112
|
-
platform_family 'arch'
|
113
|
-
end
|
@@ -1,125 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Thom May (<thom@clearairturbulence.org>)
|
3
|
-
# Copyright:: Copyright (c) 2009 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides 'virtualization'
|
20
|
-
|
21
|
-
virtualization Mash.new
|
22
|
-
|
23
|
-
# if it is possible to detect paravirt vs hardware virt, it should be put in
|
24
|
-
# virtualization[:mechanism]
|
25
|
-
|
26
|
-
## Xen
|
27
|
-
# /proc/xen is an empty dir for EL6 + Linode Guests
|
28
|
-
if File.exists?('/proc/xen')
|
29
|
-
virtualization[:system] = 'xen'
|
30
|
-
# Assume guest
|
31
|
-
virtualization[:role] = 'guest'
|
32
|
-
|
33
|
-
# This file should exist on most Xen systems, normally empty for guests
|
34
|
-
if File.exists?('/proc/xen/capabilities')
|
35
|
-
if File.read('/proc/xen/capabilities') =~ /control_d/i
|
36
|
-
virtualization[:role] = 'host'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# Xen Notes:
|
42
|
-
# - cpuid of guests, if we could get it, would also be a clue
|
43
|
-
# - may be able to determine if under paravirt from /dev/xen/evtchn (See OHAI-253)
|
44
|
-
# - EL6 guests carry a 'hypervisor' cpu flag
|
45
|
-
# - Additional edge cases likely should not change the above assumptions
|
46
|
-
# but rather be additive - btm
|
47
|
-
|
48
|
-
# Detect from kernel module
|
49
|
-
if File.exists?('/proc/modules')
|
50
|
-
modules = File.read('/proc/modules')
|
51
|
-
if modules =~ /^kvm/
|
52
|
-
virtualization[:system] = 'kvm'
|
53
|
-
virtualization[:role] = 'host'
|
54
|
-
elsif modules =~ /^vboxdrv/
|
55
|
-
virtualization[:system] = 'vbox'
|
56
|
-
virtualization[:role] = 'host'
|
57
|
-
elsif modules =~ /^vboxguest/
|
58
|
-
virtualization[:system] = 'vbox'
|
59
|
-
virtualization[:role] = 'guest'
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# Detect KVM/QEMU from cpuinfo, report as KVM
|
64
|
-
# We could pick KVM from 'Booting paravirtualized kernel on KVM' in dmesg
|
65
|
-
# 2.6.27-9-server (intrepid) has this / 2.6.18-6-amd64 (etch) does not
|
66
|
-
# It would be great if we could read pv_info in the kernel
|
67
|
-
# Wait for reply to: http://article.gmane.org/gmane.comp.emulators.kvm.devel/27885
|
68
|
-
if File.exists?('/proc/cpuinfo')
|
69
|
-
if File.read('/proc/cpuinfo') =~ /QEMU Virtual CPU/
|
70
|
-
virtualization[:system] = 'kvm'
|
71
|
-
virtualization[:role] = 'guest'
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
# Detect OpenVZ / Virtuozzo.
|
76
|
-
# http://wiki.openvz.org/BC_proc_entries
|
77
|
-
if File.exists?('/proc/bc/0')
|
78
|
-
virtualization[:system] = 'openvz'
|
79
|
-
virtualization[:role] = 'host'
|
80
|
-
elsif File.exists?('/proc/vz')
|
81
|
-
virtualization[:system] = 'openvz'
|
82
|
-
virtualization[:role] = 'guest'
|
83
|
-
end
|
84
|
-
|
85
|
-
# http://www.dmo.ca/blog/detecting-virtualization-on-linux
|
86
|
-
if File.exists?('/usr/sbin/dmidecode')
|
87
|
-
popen4('dmidecode') do |pid, stdin, stdout, stderr|
|
88
|
-
stdin.close
|
89
|
-
dmi_info = stdout.read
|
90
|
-
case dmi_info
|
91
|
-
when /Manufacturer: Microsoft/
|
92
|
-
if dmi_info =~ /Product Name: Virtual Machine/
|
93
|
-
virtualization[:system] = 'virtualpc'
|
94
|
-
virtualization[:role] = 'guest'
|
95
|
-
end
|
96
|
-
when /Manufacturer: VMware/
|
97
|
-
if dmi_info =~ /Product Name: VMware Virtual Platform/
|
98
|
-
virtualization[:system] = 'vmware'
|
99
|
-
virtualization[:role] = 'guest'
|
100
|
-
end
|
101
|
-
when /Manufacturer: Xen/
|
102
|
-
if dmi_info =~ /Product Name: HVM domU/
|
103
|
-
virtualization[:system] = 'xen'
|
104
|
-
virtualization[:role] = 'guest'
|
105
|
-
end
|
106
|
-
else
|
107
|
-
nil
|
108
|
-
end
|
109
|
-
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
# Detect Linux-VServer
|
114
|
-
if File.exists?('/proc/self/status')
|
115
|
-
proc_self_status = File.read('/proc/self/status')
|
116
|
-
vxid = proc_self_status.match(/^(s_context|VxID): (\d+)$/)
|
117
|
-
if vxid and vxid[2]
|
118
|
-
virtualization[:system] = 'linux-vserver'
|
119
|
-
if vxid[2] == '0'
|
120
|
-
virtualization[:role] = 'host'
|
121
|
-
else
|
122
|
-
virtualization[:role] = 'guest'
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
data/lib/ohai/plugins/os.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides 'os', 'os_version'
|
20
|
-
|
21
|
-
require 'rbconfig'
|
22
|
-
|
23
|
-
require_plugin 'kernel'
|
24
|
-
|
25
|
-
case ::RbConfig::CONFIG['host_os']
|
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
|
-
end
|
52
|
-
|
53
|
-
os_version kernel[:release]
|
@@ -1,28 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2008 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides 'platform', 'platform_version', 'platform_family'
|
20
|
-
|
21
|
-
require_plugin "#{os}::platform"
|
22
|
-
|
23
|
-
platform os unless attribute?('platform')
|
24
|
-
|
25
|
-
platform_version os_version unless attribute?('platform_version')
|
26
|
-
|
27
|
-
platform_family platform unless attribute?('platform_family')
|
28
|
-
|
@@ -1,86 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Benjamin Black (<bb@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2009 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
provides 'virtualization'
|
20
|
-
|
21
|
-
require_plugin "#{os}::virtualization"
|
22
|
-
|
23
|
-
unless virtualization.nil? || !(virtualization[:role].eql?('host'))
|
24
|
-
begin
|
25
|
-
require 'libvirt'
|
26
|
-
require 'hpricot'
|
27
|
-
|
28
|
-
emu = (virtualization[:system].eql?('kvm') ? 'qemu' : virtualization[:system])
|
29
|
-
virtualization[:libvirt_version] = Libvirt::version(emu)[0].to_s
|
30
|
-
|
31
|
-
virtconn = Libvirt::open_read_only("#{emu}:///system")
|
32
|
-
|
33
|
-
virtualization[:uri] = virtconn.uri
|
34
|
-
virtualization[:capabilities] = Mash.new
|
35
|
-
virtualization[:capabilities][:xml_desc] = (virtconn.capabilities.split("\n").collect { |line| line.strip }).join
|
36
|
-
#xdoc = Hpricot virtualization[:capabilities][:xml_desc]
|
37
|
-
|
38
|
-
virtualization[:nodeinfo] = Mash.new
|
39
|
-
ni = virtconn.node_get_info
|
40
|
-
%w(cores cpus memory mhz model nodes sockets threads).each { |a| virtualization[:nodeinfo][a] = ni.send(a) }
|
41
|
-
|
42
|
-
virtualization[:domains] = Mash.new
|
43
|
-
virtconn.list_domains.each do |d|
|
44
|
-
dv = virtconn.lookup_domain_by_id d
|
45
|
-
virtualization[:domains][dv.name] = Mash.new
|
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
|
-
%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
|
-
#xdoc = Hpricot virtualization[:domains][dv.name][:xml_desc]
|
51
|
-
|
52
|
-
end
|
53
|
-
|
54
|
-
virtualization[:networks] = Mash.new
|
55
|
-
virtconn.list_networks.each do |n|
|
56
|
-
nv = virtconn.lookup_network_by_name n
|
57
|
-
virtualization[:networks][n] = Mash.new
|
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
|
-
#xdoc = Hpricot virtualization[:networks][n][:xml_desc]
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
virtualization[:storage] = Mash.new
|
65
|
-
virtconn.list_storage_pools.each do |pool|
|
66
|
-
sp = virtconn.lookup_storage_pool_by_name pool
|
67
|
-
virtualization[:storage][pool] = Mash.new
|
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
|
-
#xdoc = Hpricot virtualization[:storage][pool][:xml_desc]
|
72
|
-
|
73
|
-
virtualization[:storage][pool][:volumes] = Mash.new
|
74
|
-
sp.list_volumes.each do |v|
|
75
|
-
virtualization[:storage][pool][:volumes][v] = Mash.new
|
76
|
-
sv = sp.lookup_volume_by_name v
|
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
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
virtconn.close
|
83
|
-
rescue LoadError => e
|
84
|
-
Ohai::Log.debug("Can't load gem: #{e}. virtualization plugin is disabled.")
|
85
|
-
end
|
86
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Doug MacEachern <dougm@vmware.com>
|
3
|
-
# Copyright:: Copyright (c) 2010 VMware, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
require 'ruby-wmi'
|
20
|
-
|
21
|
-
provides 'cpu'
|
22
|
-
|
23
|
-
cpuinfo = Mash.new
|
24
|
-
cpu_number = 0
|
25
|
-
index = 0
|
26
|
-
|
27
|
-
WMI::Win32_Processor.find(:all).each do |processor|
|
28
|
-
#
|
29
|
-
# On Windows Server 2003 R2 (i.e. 5.2.*), numberofcores property
|
30
|
-
# doesn't exist on the Win32_Processor class unless the user has
|
31
|
-
# patched their system with:
|
32
|
-
# http://support.microsoft.com/kb/932370
|
33
|
-
#
|
34
|
-
# We're returning nil for cpu["cores"] and cpu["count"]
|
35
|
-
# when we don't see numberofcores property
|
36
|
-
#
|
37
|
-
|
38
|
-
number_of_cores = nil
|
39
|
-
begin
|
40
|
-
number_of_cores = processor.numberofcores
|
41
|
-
cpu_number += number_of_cores
|
42
|
-
rescue NoMethodError => e
|
43
|
-
Ohai::Log.info('Can not find numberofcores property on Win32_Processor. Consider applying this patch: http://support.microsoft.com/kb/932370')
|
44
|
-
end
|
45
|
-
|
46
|
-
current_cpu = index.to_s
|
47
|
-
index += 1
|
48
|
-
cpuinfo[current_cpu] = Mash.new
|
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
|
-
#cpuinfo[current_cpu]["core_id"] = XXX
|
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
|
-
#cpuinfo[current_cpu]["flags"] = XXX
|
60
|
-
end
|
61
|
-
|
62
|
-
cpu cpuinfo
|
63
|
-
cpu[:total] = (cpu_number == 0) ? nil : cpu_number
|
64
|
-
cpu[:real] = index
|
@@ -1,33 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: James Gartrell (<jgartrel@gmail.com>)
|
3
|
-
# Copyright:: Copyright (c) 2009 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
require 'ruby-wmi'
|
20
|
-
require 'socket'
|
21
|
-
|
22
|
-
host = WMI::Win32_ComputerSystem.find(:first)
|
23
|
-
hostname "#{host.Name}"
|
24
|
-
|
25
|
-
info = Socket.gethostbyname(Socket.gethostname)
|
26
|
-
if info.first =~ /.+?\.(.*)/
|
27
|
-
fqdn info.first
|
28
|
-
else
|
29
|
-
#host is not in dns. optionally use:
|
30
|
-
#C:\WINDOWS\system32\drivers\etc\hosts
|
31
|
-
fqdn Socket.gethostbyaddr(info.last).first
|
32
|
-
end
|
33
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: James Gartrell (<jgartrel@gmail.com>)
|
3
|
-
# Copyright:: Copyright (c) 2009 Opscode, Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
# After long discussion in IRC the "powers that be" have come to a concensus
|
20
|
-
# that there is no other Windows platforms exist that were not based on the
|
21
|
-
# Windows_NT kernel, so we herby decree that "windows" will refer to all
|
22
|
-
# platforms built upon the Windows_NT kernel and have access to win32 or win64
|
23
|
-
# subsystems.
|
24
|
-
platform os
|
25
|
-
platform_version kernel['release']
|
26
|
-
platform_family 'windows'
|
27
|
-
|