sigar 0.7.0
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.
- data/README +2 -0
- data/Rakefile +105 -0
- data/bindings/SigarBuild.pm +310 -0
- data/bindings/SigarWrapper.pm +2978 -0
- data/bindings/ruby/examples/arp.rb +24 -0
- data/bindings/ruby/examples/cpu_info.rb +35 -0
- data/bindings/ruby/examples/df.rb +49 -0
- data/bindings/ruby/examples/free.rb +36 -0
- data/bindings/ruby/examples/ifconfig.rb +101 -0
- data/bindings/ruby/examples/logging.rb +58 -0
- data/bindings/ruby/examples/net_info.rb +31 -0
- data/bindings/ruby/examples/netstat.rb +71 -0
- data/bindings/ruby/examples/pargs.rb +35 -0
- data/bindings/ruby/examples/penv.rb +31 -0
- data/bindings/ruby/examples/route.rb +48 -0
- data/bindings/ruby/examples/version.rb +40 -0
- data/bindings/ruby/examples/who.rb +30 -0
- data/bindings/ruby/extconf.rb +128 -0
- data/bindings/ruby/rbsigar.c +888 -0
- data/bindings/ruby/test/cpu_test.rb +40 -0
- data/bindings/ruby/test/file_system_test.rb +43 -0
- data/bindings/ruby/test/helper.rb +57 -0
- data/bindings/ruby/test/loadavg_test.rb +30 -0
- data/bindings/ruby/test/mem_test.rb +45 -0
- data/bindings/ruby/test/swap_test.rb +36 -0
- data/bindings/ruby/test/uptime_test.rb +26 -0
- data/include/sigar.h +939 -0
- data/include/sigar_fileinfo.h +157 -0
- data/include/sigar_format.h +65 -0
- data/include/sigar_getline.h +18 -0
- data/include/sigar_log.h +80 -0
- data/include/sigar_private.h +422 -0
- data/include/sigar_ptql.h +53 -0
- data/include/sigar_util.h +191 -0
- data/src/os/aix/aix_sigar.c +2151 -0
- data/src/os/aix/sigar_os.h +73 -0
- data/src/os/darwin/Info.plist.in +27 -0
- data/src/os/darwin/darwin_sigar.c +3709 -0
- data/src/os/darwin/sigar_os.h +80 -0
- data/src/os/hpux/hpux_sigar.c +1342 -0
- data/src/os/hpux/sigar_os.h +49 -0
- data/src/os/linux/linux_sigar.c +2782 -0
- data/src/os/linux/sigar_os.h +82 -0
- data/src/os/solaris/get_mib2.c +321 -0
- data/src/os/solaris/get_mib2.h +127 -0
- data/src/os/solaris/kstats.c +181 -0
- data/src/os/solaris/procfs.c +97 -0
- data/src/os/solaris/sigar_os.h +224 -0
- data/src/os/solaris/solaris_sigar.c +2717 -0
- data/src/os/win32/peb.c +212 -0
- data/src/os/win32/sigar.rc.in +40 -0
- data/src/os/win32/sigar_os.h +653 -0
- data/src/os/win32/sigar_pdh.h +47 -0
- data/src/os/win32/win32_sigar.c +3911 -0
- data/src/sigar.c +2428 -0
- data/src/sigar_cache.c +179 -0
- data/src/sigar_fileinfo.c +815 -0
- data/src/sigar_format.c +696 -0
- data/src/sigar_getline.c +1849 -0
- data/src/sigar_ptql.c +1967 -0
- data/src/sigar_signal.c +216 -0
- data/src/sigar_util.c +1060 -0
- data/src/sigar_version.c.in +22 -0
- data/src/sigar_version_autoconf.c.in +22 -0
- data/version.properties +11 -0
- metadata +131 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2010 VMware, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'sigar'
|
18
|
+
|
19
|
+
Sigar.new.arp_list.each do |arp|
|
20
|
+
host = "?" #XXX
|
21
|
+
puts host + " " +
|
22
|
+
"(" + arp.address + ")" + " at " + arp.hwaddr + " " +
|
23
|
+
"[" + arp.type + "]" + " on " + arp.ifname
|
24
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2007 Hyperic, Inc.
|
3
|
+
# Copyright (c) 2009-2010 VMware, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'sigar'
|
19
|
+
|
20
|
+
sigar = Sigar.new
|
21
|
+
|
22
|
+
infos = sigar.cpu_info_list
|
23
|
+
|
24
|
+
num = infos.length
|
25
|
+
|
26
|
+
puts num.to_s + " total CPUs.."
|
27
|
+
|
28
|
+
infos.each do |info|
|
29
|
+
puts "Vendor........" + info.vendor
|
30
|
+
puts "Model........." + info.model
|
31
|
+
puts "Current Mhz..." + info.mhz.to_s
|
32
|
+
puts "Maximum Mhz..." + info.mhz_max.to_s
|
33
|
+
puts "Minimum Mhz..." + info.mhz_min.to_s
|
34
|
+
puts "Cache size...." + info.cache_size.to_s
|
35
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2007, 2009 Hyperic, Inc.
|
3
|
+
# Copyright (c) 2010 VMware, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'sigar'
|
19
|
+
|
20
|
+
def format_size(size)
|
21
|
+
return Sigar.format_size(size * 1024)
|
22
|
+
end
|
23
|
+
|
24
|
+
sigar = Sigar.new
|
25
|
+
fslist = sigar.file_system_list
|
26
|
+
|
27
|
+
puts "Filesystem\tSize\tUsed\tAvail\tUse%\tMounted on\tType\n"
|
28
|
+
|
29
|
+
fslist.each do |fs|
|
30
|
+
dir_name = fs.dir_name
|
31
|
+
begin
|
32
|
+
usage = sigar.file_system_usage(dir_name)
|
33
|
+
total = usage.total
|
34
|
+
used = total - usage.free
|
35
|
+
avail = usage.avail
|
36
|
+
pct = usage.use_percent * 100
|
37
|
+
rescue Exception => e
|
38
|
+
#e.g. floppy or cdrom drive
|
39
|
+
used = avail = total = pct = 0;
|
40
|
+
end
|
41
|
+
|
42
|
+
puts fs.dev_name + "\t" +
|
43
|
+
format_size(total) + "\t" +
|
44
|
+
format_size(used) + "\t" +
|
45
|
+
format_size(avail) + "\t" +
|
46
|
+
(pct == 0.0 ? '-' : pct.to_s) + "\t" +
|
47
|
+
dir_name + "\t" +
|
48
|
+
fs.sys_type_name + "/" + fs.type_name
|
49
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2007 Hyperic, Inc.
|
3
|
+
# Copyright (c) 2010 VMware, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'sigar'
|
19
|
+
|
20
|
+
sigar = Sigar.new
|
21
|
+
mem = sigar.mem
|
22
|
+
swap = sigar.swap
|
23
|
+
|
24
|
+
puts "\tTotal\tUsed\tFree"
|
25
|
+
|
26
|
+
puts "Mem: " +
|
27
|
+
(mem.total / 1024).to_s + "\t" +
|
28
|
+
(mem.used / 1024).to_s + "\t" +
|
29
|
+
(mem.free/ 1024).to_s
|
30
|
+
|
31
|
+
puts "Swap: " +
|
32
|
+
(swap.total / 1024).to_s + "\t" +
|
33
|
+
(swap.used / 1024).to_s + "\t" +
|
34
|
+
(swap.free/ 1024).to_s
|
35
|
+
|
36
|
+
puts "RAM: " + mem.ram.to_s + "MB";
|
@@ -0,0 +1,101 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2007 Hyperic, Inc.
|
3
|
+
# Copyright (c) 2009 SpringSource, Inc.
|
4
|
+
# Copyright (c) 2010 VMware, Inc.
|
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 'sigar'
|
20
|
+
|
21
|
+
sigar = Sigar.new
|
22
|
+
iflist = sigar.net_interface_list
|
23
|
+
|
24
|
+
iflist.each do |ifname|
|
25
|
+
ifconfig = sigar.net_interface_config(ifname)
|
26
|
+
flags = ifconfig.flags
|
27
|
+
encap = ifconfig.type
|
28
|
+
|
29
|
+
if (flags & Sigar::IFF_UP) == 0
|
30
|
+
next
|
31
|
+
end
|
32
|
+
|
33
|
+
hwaddr = ifconfig.hwaddr
|
34
|
+
if hwaddr == Sigar::NULL_HWADDR
|
35
|
+
hwaddr = ""
|
36
|
+
else
|
37
|
+
hwaddr = " HWaddr " + hwaddr
|
38
|
+
end
|
39
|
+
|
40
|
+
puts ifname + "\t" + "Link encap:" + encap + hwaddr
|
41
|
+
|
42
|
+
if (flags & Sigar::IFF_POINTOPOINT) != 0
|
43
|
+
ptp = " P-t-P:" + ifconfig.destination
|
44
|
+
else
|
45
|
+
ptp = ""
|
46
|
+
end
|
47
|
+
|
48
|
+
if (flags & Sigar::IFF_BROADCAST) != 0
|
49
|
+
bcast = " Bcast:" + ifconfig.broadcast
|
50
|
+
else
|
51
|
+
bcast = ""
|
52
|
+
end
|
53
|
+
|
54
|
+
address = ifconfig.address
|
55
|
+
if address != "0.0.0.0"
|
56
|
+
puts "\t" + "inet addr:" + address +
|
57
|
+
ptp + bcast + " Mask:" + ifconfig.netmask
|
58
|
+
end
|
59
|
+
|
60
|
+
if ifconfig.prefix6_length != 0
|
61
|
+
puts "\t" + "inet6 addr: " + ifconfig.address6 + "/" +
|
62
|
+
ifconfig.prefix6_length.to_s + " Scope:" + Sigar.net_scope_to_s(ifconfig.scope6)
|
63
|
+
end
|
64
|
+
|
65
|
+
puts "\t" +
|
66
|
+
Sigar.net_interface_flags_to_s(flags) +
|
67
|
+
" MTU:" + ifconfig.mtu.to_s +
|
68
|
+
" Metric:" + ifconfig.metric.to_s
|
69
|
+
|
70
|
+
if (!ifname.include?(":"))
|
71
|
+
ifstat = sigar.net_interface_stat(ifname)
|
72
|
+
puts "\t" +
|
73
|
+
"RX packets:" + ifstat.rx_packets.to_s +
|
74
|
+
" errors:" + ifstat.rx_errors.to_s +
|
75
|
+
" dropped:" + ifstat.rx_dropped.to_s +
|
76
|
+
" overruns:" + ifstat.rx_overruns.to_s +
|
77
|
+
" frame:" + ifstat.rx_frame.to_s
|
78
|
+
|
79
|
+
puts "\t" +
|
80
|
+
"TX packets:" + ifstat.tx_packets.to_s +
|
81
|
+
" errors:" + ifstat.tx_errors.to_s +
|
82
|
+
" dropped:" + ifstat.tx_dropped.to_s +
|
83
|
+
" overruns:" + ifstat.tx_overruns.to_s +
|
84
|
+
" carrier:" + ifstat.tx_carrier.to_s
|
85
|
+
|
86
|
+
puts "\t" + "collisions:" + ifstat.tx_collisions.to_s +
|
87
|
+
" txqueuelen:" + ifconfig.tx_queue_len.to_s
|
88
|
+
|
89
|
+
rx_bytes = ifstat.rx_bytes
|
90
|
+
tx_bytes = ifstat.tx_bytes
|
91
|
+
|
92
|
+
puts "\t" +
|
93
|
+
"RX bytes:" + rx_bytes.to_s +
|
94
|
+
" (" + Sigar.format_size(rx_bytes) + ")" +
|
95
|
+
" " +
|
96
|
+
"TX bytes:" + tx_bytes.to_s +
|
97
|
+
" (" + Sigar.format_size(tx_bytes) + ")" + "\n"
|
98
|
+
end
|
99
|
+
|
100
|
+
puts "\n"
|
101
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2009 SpringSource, Inc.
|
3
|
+
# Copyright (c) 2010 VMware, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
# Example illustrating the use of the optional logger.
|
19
|
+
|
20
|
+
require 'sigar'
|
21
|
+
require 'logger'
|
22
|
+
|
23
|
+
sigar = Sigar.new
|
24
|
+
sigar.log_level = Sigar::LOG_DEBUG
|
25
|
+
|
26
|
+
logger = Logger.new(STDERR)
|
27
|
+
logger.datetime_format = "%H:%M:%S"
|
28
|
+
|
29
|
+
# Call something that has DEBUG level logging.
|
30
|
+
fslist = sigar.file_system_list
|
31
|
+
|
32
|
+
# cache data
|
33
|
+
fslist.each do |fs|
|
34
|
+
dir_name = fs.dir_name
|
35
|
+
usage = sigar.file_system_usage(dir_name)
|
36
|
+
end
|
37
|
+
|
38
|
+
puts "Calling file_system_usage() for each filesystem"
|
39
|
+
|
40
|
+
puts "\nwith Logger:"
|
41
|
+
|
42
|
+
sigar.logger = logger
|
43
|
+
|
44
|
+
fslist.each do |fs|
|
45
|
+
dir_name = fs.dir_name
|
46
|
+
usage = sigar.file_system_usage(dir_name)
|
47
|
+
end
|
48
|
+
|
49
|
+
puts "\nwith Proc:"
|
50
|
+
|
51
|
+
sigar.logger = Proc.new do |level, msg|
|
52
|
+
puts "Level #{level}: #{msg}"
|
53
|
+
end
|
54
|
+
|
55
|
+
fslist.each do |fs|
|
56
|
+
dir_name = fs.dir_name
|
57
|
+
usage = sigar.file_system_usage(dir_name)
|
58
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2009-2010 VMware, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
# Example illustrating the collecting of network information.
|
18
|
+
|
19
|
+
require 'sigar'
|
20
|
+
|
21
|
+
sigar = Sigar.new
|
22
|
+
|
23
|
+
ninfo = sigar.net_info
|
24
|
+
|
25
|
+
puts "Hostname: " + ninfo.host_name
|
26
|
+
puts "Domain Name: " + ninfo.domain_name
|
27
|
+
puts "FQDN: " + sigar.fqdn
|
28
|
+
puts "Default gateway: " + ninfo.default_gateway
|
29
|
+
puts "Default gateway interface: " + ninfo.default_gateway_interface
|
30
|
+
puts "Primary DNS: " + ninfo.primary_dns
|
31
|
+
puts "Secondary DNS: " + ninfo.secondary_dns
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2007 Hyperic, Inc.
|
3
|
+
# Copyright (c) 2010 VMware, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'sigar'
|
19
|
+
require 'socket'
|
20
|
+
|
21
|
+
#XXX this example is incomplete wrt:
|
22
|
+
#../../java/src/org/hyperic/sigar/cmd/Netstat.java
|
23
|
+
|
24
|
+
is_numeric = false
|
25
|
+
flags = Sigar::NETCONN_CLIENT|Sigar::NETCONN_SERVER
|
26
|
+
flags |= Sigar::NETCONN_TCP
|
27
|
+
|
28
|
+
def format_port(sigar, proto, port, is_numeric)
|
29
|
+
if port == 0
|
30
|
+
return "*"
|
31
|
+
end
|
32
|
+
if !is_numeric
|
33
|
+
service = sigar.net_services_name(proto, port)
|
34
|
+
if service != nil
|
35
|
+
return service
|
36
|
+
end
|
37
|
+
end
|
38
|
+
port.to_s
|
39
|
+
end
|
40
|
+
|
41
|
+
def format_address(sigar, proto, ip, portnum, is_numeric)
|
42
|
+
port = format_port(sigar, proto, portnum, is_numeric)
|
43
|
+
address = ""
|
44
|
+
if ip == "0.0.0.0" || ip == "::"
|
45
|
+
address = "*"
|
46
|
+
elsif is_numeric
|
47
|
+
address = ip.to_s
|
48
|
+
else
|
49
|
+
begin
|
50
|
+
name = Socket.gethostbyname(ip)
|
51
|
+
address = name[0]
|
52
|
+
rescue SocketError
|
53
|
+
address = ip.to_s
|
54
|
+
end
|
55
|
+
end
|
56
|
+
return address + ":" + port
|
57
|
+
end
|
58
|
+
|
59
|
+
sigar = Sigar.new
|
60
|
+
|
61
|
+
connections = sigar.net_connection_list(flags)
|
62
|
+
puts "Proto\tLocal Address\tForeign Address\tState"
|
63
|
+
|
64
|
+
connections.each do |conn|
|
65
|
+
proto = Sigar.net_connection_type_to_s(conn.type)
|
66
|
+
state = Sigar.net_connection_state_to_s(conn.state)
|
67
|
+
local = format_address(sigar, conn.type, conn.local_address, conn.local_port, is_numeric)
|
68
|
+
remote = format_address(sigar, conn.type, conn.remote_address, conn.remote_port, is_numeric)
|
69
|
+
puts proto + "\t" + local + "\t" + remote + "\t" + state
|
70
|
+
end
|
71
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2007, 2009 Hyperic, Inc.
|
3
|
+
# Copyright (c) 2010 VMware, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'sigar'
|
19
|
+
|
20
|
+
def output(sigar, pid)
|
21
|
+
args = sigar.proc_args(pid)
|
22
|
+
exe = sigar.proc_exe(pid);
|
23
|
+
puts "exe=" + exe.name
|
24
|
+
puts "cwd=" + exe.cwd
|
25
|
+
|
26
|
+
args.each do |arg|
|
27
|
+
puts " " + "=>" + arg + "<="
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
sigar = Sigar.new
|
32
|
+
|
33
|
+
ARGV.each do |pid|
|
34
|
+
output(sigar, pid)
|
35
|
+
end
|