onering-report 0.6.12 → 0.6.13
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 +8 -8
- data/lib/facter/onering_properties_physical.rb +2 -3
- data/onering-report.gemspec +1 -1
- metadata +2 -3
- data/lib/facter/onering_properties_netstat.rb +0 -94
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmNiYjNjOGJiYWI1M2U0NzkwMDE3OTkyY2RjODFmMTNhYTI4NzRhZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmE5ZWU1ZDRlODk2NzRkMzgxM2JjMjRiMWNmMDA1OGEwYTJmOTUwNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjBkY2UwZjE4NTQ5NDRiZGUzN2JjNmZmMmZhMTBiY2IwMjE0OTM2ZjBmNzY3
|
10
|
+
ZmE0NjRlZGYwNjFlMmNiZjcyN2E5NmIyNGU3YzRmNjRlNDJlNzc5ZmM2ODI2
|
11
|
+
YTgxOWU3YTg0ZTg4ZWViZjdhMTRhZjlkOGNjZTRiYzRmYThlZGY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDExMzZiYjQzOGFhNzBhZmVlODkwNWE2ZTg3Njk4NDE4Yjg0OTc1YzczOTAw
|
14
|
+
MmMyYWI4ZGJhZmYxMjEzMjcyYTExZTZhYzI3ODRjZmRjNDk3MjRhYTA4ZmRl
|
15
|
+
OTM0N2VkNTUyZGNjMTkwMWJhZGFmMDc0ZDFjNTRlNWJmYzkwNjg=
|
@@ -85,9 +85,8 @@ end
|
|
85
85
|
end
|
86
86
|
|
87
87
|
if ipmi_ok?
|
88
|
-
ipmi_lan =
|
89
|
-
|
90
|
-
ipmi_lan = Facter::Util::Resolution.exec("ipmitool lan print 1 2> /dev/null")
|
88
|
+
ipmi_lan = with_timeout do
|
89
|
+
Facter::Util::Resolution.exec("ipmitool lan print 1 2> /dev/null")
|
91
90
|
end
|
92
91
|
|
93
92
|
if ipmi_lan
|
data/onering-report.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onering-report
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rnarkis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: onering-agent
|
@@ -72,7 +72,6 @@ files:
|
|
72
72
|
- lib/facter/onering_properties_chef.rb
|
73
73
|
- lib/facter/onering_properties_haproxy.rb
|
74
74
|
- lib/facter/onering_properties_id.rb
|
75
|
-
- lib/facter/onering_properties_netstat.rb
|
76
75
|
- lib/facter/onering_properties_network.rb
|
77
76
|
- lib/facter/onering_properties_onering.rb
|
78
77
|
- lib/facter/onering_properties_openvz.rb
|
@@ -1,94 +0,0 @@
|
|
1
|
-
require 'resolv'
|
2
|
-
|
3
|
-
protocols = %w{tcp tcp6 udp udp6}
|
4
|
-
|
5
|
-
flags = "--numeric-hosts --numeric-ports --programs --tcp --udp -ee"
|
6
|
-
|
7
|
-
case Facter.value('osfamily').to_s.downcase
|
8
|
-
when 'debian' then flags += " -W"
|
9
|
-
when 'redhat' then flags += " -T"
|
10
|
-
end
|
11
|
-
|
12
|
-
listening = Facter::Util::Resolution.exec("nice -n 19 netstat #{flags} -l | tr -s ' ' | sed 's/ LISTEN//g'")
|
13
|
-
#nonlistening = Facter::Util::Resolution.exec("nice -n 19 netstat #{flags} | tr -s ' '")
|
14
|
-
|
15
|
-
# netstat = {
|
16
|
-
# 'listening' => [],
|
17
|
-
# 'connections' => []
|
18
|
-
# }
|
19
|
-
|
20
|
-
netstat = {
|
21
|
-
'listening' => []
|
22
|
-
}
|
23
|
-
|
24
|
-
def getcommandline(pid)
|
25
|
-
return nil unless pid.to_i > 0
|
26
|
-
(File.read("/proc/#{pid}/cmdline").to_s.strip.chomp.squeeze("\u0000").squeeze("\0").gsub("\u0000", ' ').gsub("\0", ' '))
|
27
|
-
end
|
28
|
-
|
29
|
-
[*listening.to_s.lines.to_a[2..-1]].each do |line|
|
30
|
-
protocol, recvq, sendq, local, foreign, user, inode, program = line.split(' ', 8)
|
31
|
-
|
32
|
-
next unless protocols.include?(protocol)
|
33
|
-
|
34
|
-
local = local.split(':')
|
35
|
-
foreign = foreign.split(':')
|
36
|
-
local_host = local[-2]
|
37
|
-
local_port = local[-1]
|
38
|
-
foreign_host = foreign[-2]
|
39
|
-
foreign_port = foreign[-1]
|
40
|
-
pid = program.split('/').first
|
41
|
-
|
42
|
-
command = getcommandline(pid)
|
43
|
-
next if command.nil?
|
44
|
-
|
45
|
-
netstat['listening'] << {
|
46
|
-
"protocol" => protocol,
|
47
|
-
"address" => local_host,
|
48
|
-
"fqdn" => (Resolv.getname(local_host) rescue nil),
|
49
|
-
"port" => local_port.to_i,
|
50
|
-
"user" => user,
|
51
|
-
"program" => {
|
52
|
-
"pid" => pid.to_i,
|
53
|
-
"command" => getcommandline(pid)
|
54
|
-
}
|
55
|
-
}
|
56
|
-
end
|
57
|
-
|
58
|
-
# nonlistening.lines.to_a[2..-1].each do |line|
|
59
|
-
# protocol, recvq, sendq, local, foreign, state, user, inode, program = line.split(' ', 9)
|
60
|
-
# next unless protocols.include?(protocol)
|
61
|
-
|
62
|
-
# local = local.split(':')
|
63
|
-
# foreign = foreign.split(':')
|
64
|
-
# local_host = local[-2]
|
65
|
-
# local_port = local[-1]
|
66
|
-
# foreign_host = foreign[-2]
|
67
|
-
# foreign_port = foreign[-1]
|
68
|
-
# pid = program.split('/').first
|
69
|
-
|
70
|
-
# netstat['connections'] << {
|
71
|
-
# "protocol" => protocol,
|
72
|
-
# "from" => {
|
73
|
-
# "address" => local_host,
|
74
|
-
# "port" => local_port.to_i
|
75
|
-
# },
|
76
|
-
# "to" => {
|
77
|
-
# "address" => foreign_host,
|
78
|
-
# "fqdn" => (Resolv.getname(foreign_host) rescue nil),
|
79
|
-
# "port" => foreign_port.to_i
|
80
|
-
# },
|
81
|
-
# "user" => user,
|
82
|
-
# "state" => state.downcase,
|
83
|
-
# "program" => {
|
84
|
-
# "pid" => pid.to_i,
|
85
|
-
# "command" => getcommandline(pid)
|
86
|
-
# }
|
87
|
-
# }
|
88
|
-
# end
|
89
|
-
|
90
|
-
Facter.add("netstat") do
|
91
|
-
setcode do
|
92
|
-
netstat
|
93
|
-
end
|
94
|
-
end
|