server_metrics 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,156 @@
1
+ class ServerMetrics::Memory < ServerMetrics::Collector
2
+ # reports darwin units as MB
3
+ DARWIN_UNITS = { "b" => 1/(1024*1024),
4
+ "k" => 1/1024,
5
+ "m" => 1,
6
+ "g" => 1024 }
7
+
8
+ def build_report
9
+ if solaris?
10
+ solaris_memory
11
+ elsif darwin?
12
+ darwin_memory
13
+ else
14
+ linux_memory
15
+ end
16
+ end
17
+
18
+ def linux_memory
19
+ mem_info = {}
20
+ `cat /proc/meminfo`.each_line do |line|
21
+ _, key, value = *line.match(/^(\w+):\s+(\d+)\s/)
22
+ mem_info[key] = value.to_i
23
+ end
24
+
25
+ # memory info is empty - operating system may not support it (why doesn't an exception get raised earlier on mac osx?)
26
+ if mem_info.empty?
27
+ raise "No such file or directory"
28
+ end
29
+
30
+ mem_info['MemTotal'] ||= 0
31
+ mem_info['MemFree'] ||= 0
32
+ mem_info['Buffers'] ||= 0
33
+ mem_info['Cached'] ||= 0
34
+ mem_info['SwapTotal'] ||= 0
35
+ mem_info['SwapFree'] ||= 0
36
+
37
+ mem_total = mem_info['MemTotal'] / 1024
38
+ mem_free = (mem_info['MemFree'] + mem_info['Buffers'] + mem_info['Cached']) / 1024
39
+ mem_used = mem_total - mem_free
40
+ mem_percent_used = (mem_used / mem_total.to_f * 100).to_i
41
+
42
+ swap_total = mem_info['SwapTotal'] / 1024
43
+ swap_free = mem_info['SwapFree'] / 1024
44
+ swap_used = swap_total - swap_free
45
+ unless swap_total == 0
46
+ swap_percent_used = (swap_used / swap_total.to_f * 100).to_i
47
+ end
48
+
49
+ # will be passed at the end to report to Scout
50
+ report_data = Hash.new
51
+
52
+ report_data['Memory total'] = mem_total
53
+ report_data['Memory used'] = mem_used
54
+ report_data['Memory available'] = mem_total - mem_used
55
+ report_data['% Memory used'] = mem_percent_used
56
+
57
+ report_data['Swap total'] = swap_total
58
+ report_data['Swap used'] = swap_used
59
+ unless swap_total == 0
60
+ report_data['% Swap used'] = swap_percent_used
61
+ end
62
+ @data = report_data
63
+
64
+ rescue Exception => e
65
+ if e.message =~ /No such file or directory/
66
+ error('Unable to find /proc/meminfo',%Q(Unable to find /proc/meminfo. Please ensure your operationg system supports procfs:
67
+ http://en.wikipedia.org/wiki/Procfs)
68
+ )
69
+ else
70
+ raise
71
+ end
72
+ end
73
+
74
+ # Parses top output. Does not report swap usage.
75
+ def darwin_memory
76
+ report_data = Hash.new
77
+ top_output = `top -l1 -n0 -u`
78
+ mem = top_output[/^(?:Phys)?Mem:.+/i]
79
+
80
+ mem.scan(/(\d+|\d+\.\d+)([bkmg])\s+(\w+)/i) do |amount, unit, label|
81
+ case label
82
+ when 'used'
83
+ report_data["Memory used"] =
84
+ (amount.to_f * DARWIN_UNITS[unit.downcase]).round
85
+ when 'free'
86
+ report_data["Memory available"] =
87
+ (amount.to_f * DARWIN_UNITS[unit.downcase]).round
88
+ end
89
+ end
90
+ report_data["Memory total"] = report_data["Memory used"]+report_data["Memory available"]
91
+ report_data['% Memory used'] = ((report_data["Memory used"].to_f/report_data["Memory total"])*100).to_i
92
+ @data = report_data
93
+ end
94
+
95
+ # Memory Used and Swap Used come from the prstat command.
96
+ # Memory Total comes from prtconf
97
+ # Swap Total comes from swap -s
98
+ def solaris_memory
99
+ report_data = Hash.new
100
+
101
+ prstat = `prstat -c -Z 1 1`
102
+ prstat =~ /(ZONEID[^\n]*)\n(.*)/
103
+ values = $2.split(' ')
104
+
105
+ report_data['Memory used'] = convert_to_mb(values[3])
106
+ report_data['Swap used'] = convert_to_mb(values[2])
107
+
108
+ prtconf = `/usr/sbin/prtconf | grep Memory`
109
+
110
+ prtconf =~ /\d+/
111
+ report_data['Memory total'] = $&.to_i
112
+ report_data['% Memory used'] = (report_data['Memory used'] / report_data['Memory total'].to_f * 100).to_i
113
+
114
+ swap = `swap -s`
115
+ swap =~ /\d+[a-zA-Z]\sused/
116
+ swap_used = convert_to_mb($&)
117
+ swap =~ /\d+[a-zA-Z]\savailable/
118
+ swap_available = convert_to_mb($&)
119
+ report_data['Swap total'] = swap_used+swap_available
120
+ unless report_data['Swap total'] == 0
121
+ report_data['% Swap used'] = (report_data['Swap used'] / report_data['Swap total'].to_f * 100).to_i
122
+ end
123
+
124
+ @data = report_data
125
+ end
126
+
127
+ # True if on solaris. Only checked on the first run (assumes OS does not change).
128
+ def solaris?
129
+ solaris = if @memory.has_key?(:solaris)
130
+ memory(:solaris) || false
131
+ else
132
+ solaris = false
133
+ begin
134
+ solaris = true if `uname` =~ /sunos/i
135
+ rescue
136
+ end
137
+ end
138
+ remember(:solaris => solaris)
139
+ return solaris
140
+ end
141
+
142
+ # True if on darwin. Only checked on the first run (assumes OS does not change).
143
+ def darwin?
144
+ darwin = if @memory.has_key?(:darwin)
145
+ memory(:darwin) || false
146
+ else
147
+ darwin = false
148
+ begin
149
+ darwin = true if `uname` =~ /darwin/i
150
+ rescue
151
+ end
152
+ end
153
+ remember(:darwin => darwin)
154
+ return darwin
155
+ end
156
+ end
@@ -0,0 +1,26 @@
1
+ require "server_metrics/system_info"
2
+
3
+ class ServerMetrics::Network < ServerMetrics::MultiCollector
4
+
5
+ def build_report
6
+
7
+ if linux?
8
+ lines = %x(cat /proc/net/dev).split("\n")[2..-1]
9
+ interfaces = []
10
+ lines.each do |line|
11
+ iface, rest = line.split(':', 2).collect { |e| e.strip }
12
+ interfaces << iface
13
+ next unless iface =~ /venet|eth/
14
+ found = true
15
+ cols = rest.split(/\s+/)
16
+
17
+ bytes_in, packets_in, bytes_out, packets_out = cols.values_at(0, 1, 8, 9).collect { |i| i.to_i }
18
+
19
+ counter(iface, "Bytes in", bytes_in.to_f / 1024.0, :per => :second, :round => 2)
20
+ counter(iface, "Packets in", packets_in.to_f, :per => :second, :round => 2)
21
+ counter(iface, "Bytes out", bytes_out.to_f / 1024.0, :per => :second, :round => 2)
22
+ counter(iface, "Packets out", packets_out.to_f, :per => :second, :round => 2)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,110 @@
1
+ require 'sys/proctable'
2
+
3
+ # Collects information on processes. Groups processes running under the same command, and sums up their CPU & memory usage.
4
+ # CPU is calculated **since the last run**
5
+ #
6
+
7
+ class ServerMetrics::Processes
8
+
9
+ def initialize(options={})
10
+ @last_run
11
+ @last_process_list
12
+ end
13
+
14
+ # This is the main method to call. It returns a hash of two arrays.
15
+ # The arrays have the top 10 memory using processes, and the top 10 CPU using processes, respectively.
16
+ # The array elements are hashes that look like this:
17
+ #
18
+ # {:top_memory=>
19
+ # [
20
+ # {
21
+ # :cmd => "mysqld", # the command (without the path of arguments being run)
22
+ # :count => 1, # the number of these processes (grouped by the above command)
23
+ # :cpu => 34, # the total CPU usag of the processes
24
+ # :memory => 2 # the total memory usage of the processes
25
+ # }, ...
26
+ # ],
27
+ # :top_cpu=>
28
+ # [
29
+ # {
30
+ # :cmd => "mysqld",
31
+ # :count => 1,
32
+ # :cpu => 34,
33
+ # :memory => 2
34
+ # }, ...
35
+ # ]
36
+ # }
37
+ def run
38
+ @processes = calculate_processes # returns a hash
39
+
40
+ {
41
+ :top_memory => get_top_processes(:memory, 10),
42
+ :top_cpu => get_top_processes(:cpu, 10)
43
+ }
44
+ end
45
+
46
+ # called from run(). This method lists all the processes running on the server, groups them by command,
47
+ # and calculates CPU time for each process. Since CPU time has to be calculated relative to the last sample,
48
+ # the collector has to be run twice to get CPU data.
49
+ def calculate_processes
50
+ ## 1. get a list of all processes grouped by command
51
+ processes = Sys::ProcTable.ps
52
+ grouped = Hash.new
53
+ processes.each do |proc|
54
+ grouped[proc.comm] ||= {
55
+ :count => 0,
56
+ :raw_cpu => 0,
57
+ :cpu => 0,
58
+ :memory => 0,
59
+ :uid => 0,
60
+ :cmdlines => []
61
+ }
62
+ grouped[proc.comm][:count] += 1
63
+ grouped[proc.comm][:raw_cpu] += proc.cutime + proc.cstime
64
+ grouped[proc.comm][:memory] += proc.rss.to_f / 1024.0
65
+ grouped[proc.comm][:uid] = proc.uid
66
+ grouped[proc.comm][:cmdlines] << proc.cmdline if !grouped[proc.comm][:cmdlines].include?(proc.cmdline)
67
+ end # processes.each
68
+
69
+ ## 2. loop through each and calculate the CPU time. To do this, you need to compare the current values against the last run
70
+ now = Time.now
71
+ if @last_run and @last_process_list
72
+ elapsed_time = now - @last_run # in seconds
73
+ if elapsed_time >= 1
74
+ grouped.each do |name, values|
75
+ if last_values = @last_process_list[name]
76
+ cpu_since_last_sample = values[:raw_cpu] - last_values[:raw_cpu]
77
+ grouped[name][:cpu] = (cpu_since_last_sample/(elapsed_time * ServerMetrics::SystemInfo.num_processors))*100
78
+ else
79
+ grouped.reject!(name) # no data from last run. don't report anything.
80
+ end
81
+ end
82
+ end
83
+ end
84
+ @last_process_list = grouped
85
+ @last_run = now
86
+ grouped
87
+ end
88
+
89
+ # Can only be called after @processes is set. Based on @processes, calcuates the top {num} processes, as ordered by {order_by}.
90
+ # Returns an array of hashes:
91
+ # [{:cmd=>"ruby", :cpu=>30.0, :memory=>100, :uid=>1,:cmdlines=>[]}, {:cmd => ...} ]
92
+ def get_top_processes(order_by, num)
93
+ @processes.map { |key, hash| {:cmd => key}.merge(hash) }.sort { |a, b| a[order_by] <=> b[order_by] }.reverse[0...num-1]
94
+ end
95
+
96
+ # for persisting to a file -- conforms to same basic API as the Collectors do.
97
+ # why not just use marshall? This is a lot more manageable written to the Scout agent's history file.
98
+ def to_hash
99
+ {:last_run=>@last_run, :last_process_list=>@last_process_list}
100
+ end
101
+
102
+ # for reinstantiating from a hash
103
+ # why not just use marshall? this is a lot more manageable written to the Scout agent's history file.
104
+ def self.from_hash(hash)
105
+ p.instance_variable_set('@last_run', hash[:last_run])
106
+ p.instance_variable_set('@last_process_list', hash[:last_process_list])
107
+ p
108
+ end
109
+
110
+ end
@@ -0,0 +1,91 @@
1
+ # MultiCollector is a special case of Collector that returns N metric bundles. For example, Disk uses MultiCollector:
2
+ # you can have any number of mounted disks. MultiCollector generates a nested result:
3
+ #{
4
+ # "dev/disk1" => {
5
+ # "Avail" => 295936.0,
6
+ # "Capacity" => 38.0,
7
+ # ...
8
+ # },
9
+ # "dev/disk2" => {
10
+ # "Avail" => 295936.0,
11
+ # "Capacity" => 38.0,
12
+ # ...
13
+ # }
14
+ #
15
+ #}
16
+
17
+ module ServerMetrics
18
+ class MultiCollector < ServerMetrics::Collector
19
+
20
+ # report("/dev/desk2", :key=>value)
21
+ def report(bundle_name, values)
22
+ @data[bundle_name] ||= {}
23
+ @data[bundle_name].merge!(values)
24
+ end
25
+
26
+ # for MultiCollector, Memory takes an additional argument specifying the sub-hash (bundle) in memory.
27
+ # The bundle name corresponds to the disk/network/whatever we're storing memory for.
28
+ #
29
+ # memory("/dev/desk2", :no_track)
30
+ # memory.delete("/dev/desk2",:no_track)
31
+ # memory.clear("/dev/desk2")
32
+ #
33
+ def memory(bundle_name, name)
34
+ @memory[bundle_name] ||= {}
35
+ if name.nil?
36
+ @memory[bundle_name]
37
+ else
38
+ @memory[bundle_name][name] || @memory[name.is_a?(String) ? name.to_sym : String(name)]
39
+ end
40
+ end
41
+
42
+ # just like the memory function, "remember" takes an additional argument to partition memory by bundle name
43
+ def remember(bundle_name, hash)
44
+ @memory[bundle_name] ||= {}
45
+ @memory[bundle_name].merge!(hash)
46
+ end
47
+
48
+ # counters are also partitioned by bundle name
49
+ #
50
+ # counter("/dev/desk2", :rkbps, stats['rsect'] / 2, :per => :second)
51
+ # counter("/dev/desk2", :rpm, request_counter, :per => :minute)
52
+ # counter("/dev/desk2", :swap_ins, vmstat['pswpin'], :per => :second, :round => true)
53
+ #
54
+ def counter(bundle_name, name, value, options = {}, &block)
55
+ current_time = Time.now
56
+
57
+ if data = memory(bundle_name, "_counter_#{name}")
58
+ last_time, last_value = data[:time], data[:value]
59
+ elapsed_seconds = current_time - last_time
60
+
61
+ # We won't log it if the value has wrapped or enough time hasn't
62
+ # elapsed
63
+ if value >= last_value && elapsed_seconds >= 1
64
+ if block
65
+ result = block.call(last_value, value)
66
+ else
67
+ result = value - last_value
68
+ end
69
+
70
+ case options[:per]
71
+ when :second, 'second'
72
+ result = result / elapsed_seconds.to_f
73
+ when :minute, 'minute'
74
+ result = result / elapsed_seconds.to_f * 60.0
75
+ else
76
+ raise "Unknown option for ':per': #{options[:per].inspect}"
77
+ end
78
+
79
+ if options[:round]
80
+ result = (result * (10 ** options[:round])).round / (10 ** options[:round]).to_f
81
+ end
82
+ report(bundle_name, name => result)
83
+ end
84
+ end
85
+
86
+ remember(bundle_name, "_counter_#{name}" => {:time => current_time, :value => value})
87
+ end
88
+
89
+ end
90
+ end
91
+
@@ -0,0 +1,47 @@
1
+ require 'rbconfig'
2
+ require 'socket'
3
+
4
+ module ServerMetrics
5
+ class SystemInfo
6
+
7
+ def self.architecture
8
+ RbConfig::CONFIG['target_cpu']
9
+ end
10
+
11
+ def self.os
12
+ RbConfig::CONFIG['target_os']
13
+ end
14
+
15
+ def self.os_version
16
+ `uname -r`.chomp
17
+ end
18
+
19
+ def self.num_processors
20
+ if os =~ /(darwin|freebsd)/
21
+ `sysctl -n hw.ncpu`.to_i
22
+ elsif os =~ /linux/
23
+ lines = `cat /proc/cpuinfo`.split("\n")
24
+ lines.grep(/^processor\s*:/).size
25
+ end
26
+ rescue
27
+ nil
28
+ end
29
+
30
+ def self.timezone
31
+ Time.now.zone
32
+ end
33
+
34
+ def self.timezone_offset
35
+ Time.now.utc_offset/60/60
36
+ end
37
+
38
+ def self.hostname
39
+ Socket.gethostname
40
+ end
41
+
42
+ def self.to_h
43
+ {:architecture => architecture, :os=>os, :os_version=>os_version, :num_processors=>num_processors, :hostname=>hostname, :timezone=>timezone, :timezone_offset=>timezone_offset }
44
+ end
45
+ end
46
+ end
47
+
@@ -0,0 +1,3 @@
1
+ module ServerMetrics
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,8 @@
1
+ $LOAD_PATH << File.join(File.dirname(__FILE__))
2
+
3
+ require 'server_metrics/version'
4
+ require 'server_metrics/collector'
5
+ require 'server_metrics/multi_collector'
6
+ require 'server_metrics/system_info'
7
+
8
+ Dir[File.dirname(__FILE__) + '/server_metrics/collectors/*.rb'].each {|file| require file }
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'server_metrics/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "server_metrics"
8
+ spec.version = ServerMetrics::VERSION
9
+ spec.authors = ["Andre Lewis"]
10
+ spec.email = ["andre@scoutapp.com"]
11
+ spec.description = %q{Collect information about disks, memory, CPU, etc}
12
+ spec.summary = %q{For use with the Scout agent}
13
+ spec.homepage = "http://scoutapp.com"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "sys-proctable"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "awesome_print"
26
+ spec.add_development_dependency "pry"
27
+ spec.add_development_dependency "timecop"
28
+ spec.add_development_dependency "mocha"
29
+ end
@@ -0,0 +1,54 @@
1
+ ### `uptime`
2
+ 15:13:55 up 725 days, 4:38, 1 user, load average: 0.25, 0.17, 0.11
3
+
4
+ ### `cat /proc/stat 2>&1`
5
+ cpu 253276049 0 211470167 199385636972 232887976 266 10404969 2594848 0
6
+ cpu0 26258010 0 63099690 12159411413 154920140 209 10383230 1570451 0
7
+ cpu1 19716882 0 18824493 12440168280 36129197 2 10257 271408 0
8
+ cpu2 48760918 0 92301309 12224785690 31350071 2 2419 177223 0
9
+ cpu3 25895845 0 21522019 12450568993 3291899 50 970 98284 0
10
+ cpu4 11296887 0 5820262 12500438642 1947239 2 7044 54477 0
11
+ cpu5 8502709 0 1828148 12513356260 1150749 1 823 48403 0
12
+ cpu6 19194947 0 1629648 12492448267 739021 0 123 47058 0
13
+ cpu7 17140517 0 1188241 12497432755 603142 0 27 42314 0
14
+ cpu8 10694747 0 752902 12511144513 572602 0 18 38049 0
15
+ cpu9 8515823 0 972863 12514815849 569090 0 21 36494 0
16
+ cpu10 15081064 0 1236446 12501172690 564510 0 9 36791 0
17
+ cpu11 9545841 0 1243077 12511944994 499031 0 8 35688 0
18
+ cpu12 7989439 0 656867 12516676150 228349 0 6 35040 0
19
+ cpu13 5911108 0 217671 12521436037 176917 0 3 34314 0
20
+ cpu14 9319500 0 111002 12515078835 105552 0 4 34491 0
21
+ cpu15 9451812 0 65529 12514757604 40467 0 7 34363 0
22
+ intr 18459488402 2755874654 1017677 55413955 82133 0 54724 2942722106 475489 692034931 2605639 0 275311442 1598632894 746202 354826058 1925619 0 184532554 1155096944 324016 106102984 795578 0 42763672 394451178 229380 33834720 467309 0 11308782 308906115 129442 17063974 244811 0 3997464 265430585 105706 11954591 152129 0 1738087 172309019 113600 10724263 65982 0 1163168 100445334 175788 10261326 48634 0 895391 70077699 279924 9960808 53621 0 758273 63089327 440431 9924133 65612 0 524841 51555427 468341 9899685 72769 0 381391 42700159 236140 9173080 55776 0 232790 37547876 65187 8490695 31194 0 113388 38159546 34759 8273005 14428 0 58326 36980910 15441 8185709 6749 0 28331 510 24 987009450 324 603787722 3056504028 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
23
+ ctxt 14426396271
24
+ btime 1319380546
25
+ processes 326424395
26
+ procs_running 1
27
+ procs_blocked 0
28
+ softirq 32527853666 0 1108802755 2174422434 1018051663 0 0 1 2867463785 2329513 3881947035
29
+
30
+ ### `cat /proc/stat 2>&1` second run
31
+ cpu 253276061 0 211470191 199385731316 232888034 266 10404973 2594849 0
32
+ cpu0 26258016 0 63099704 12159417013 154920196 209 10383234 1570452 0
33
+ cpu1 19716883 0 18824496 12440173979 36129199 2 10257 271408 0
34
+ cpu2 48760923 0 92301315 12224791382 31350071 2 2419 177223 0
35
+ cpu3 25895845 0 21522020 12450574714 3291899 50 970 98284 0
36
+ cpu4 11296887 0 5820262 12500444377 1947239 2 7044 54477 0
37
+ cpu5 8502709 0 1828148 12513361442 1150749 1 823 48403 0
38
+ cpu6 19194947 0 1629648 12492453169 739021 0 123 47058 0
39
+ cpu7 17140517 0 1188241 12497439108 603142 0 27 42314 0
40
+ cpu8 10694747 0 752902 12511150916 572602 0 18 38049 0
41
+ cpu9 8515823 0 972863 12514822202 569090 0 21 36494 0
42
+ cpu10 15081064 0 1236446 12501178712 564510 0 9 36791 0
43
+ cpu11 9545841 0 1243077 12511950920 499031 0 8 35688 0
44
+ cpu12 7989439 0 656867 12516682073 228349 0 6 35040 0
45
+ cpu13 5911108 0 217671 12521442486 176917 0 3 34314 0
46
+ cpu14 9319500 0 111002 12515085190 105552 0 4 34491 0
47
+ cpu15 9451812 0 65529 12514763633 40467 0 7 34363 0
48
+ intr 18459496216 2755875459 1017677 55413984 82133 0 54724 2942722875 475489 692035015 2605642 0 275311473 1598633404 746202 354826103 1925622 0 184532578 1155097563 324016 106102998 795578 0 42763672 394451429 229380 33834727 467309 0 11308782 308906125 129442 17063977 244811 0 3997464 265430626 105706 11954595 152129 0 1738087 172309028 113600 10724267 65982 0 1163168 100445345 175788 10261330 48634 0 895391 70077708 279924 9960812 53621 0 758273 63089346 440431 9924137 65613 0 524841 51555489 468341 9899692 72770 0 381391 42700167 236140 9173084 55776 0 232790 37547885 65187 8490699 31194 0 113388 38159557 34759 8273009 14428 0 58326 36980918 15441 8185713 6749 0 28331 510 24 987009627 324 603787861 3056507799 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
49
+ ctxt 14426401515
50
+ btime 1319380546
51
+ processes 326424434
52
+ procs_running 1
53
+ procs_blocked 0
54
+ softirq 32527865769 0 1108805769 2174424404 1018053487 0 0 1 2867465761 2329513 3881950354
@@ -0,0 +1,79 @@
1
+ ### `mount` ubuntu
2
+ /dev/xvda1 on / type ext3 (rw,noatime,nodiratime)
3
+ proc on /proc type proc (rw)
4
+ none on /sys type sysfs (rw,noexec,nosuid,nodev)
5
+ none on /sys/fs/fuse/connections type fusectl (rw)
6
+ none on /sys/kernel/debug type debugfs (rw)
7
+ none on /sys/kernel/security type securityfs (rw)
8
+ none on /dev type devtmpfs (rw,mode=0755)
9
+ none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
10
+ none on /dev/shm type tmpfs (rw,nosuid,nodev)
11
+ none on /var/run type tmpfs (rw,nosuid,mode=0755)
12
+ none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
13
+ none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
14
+ nfsd on /proc/fs/nfsd type nfsd (rw)
15
+
16
+ ### `df -h` ubuntu
17
+ Filesystem Size Used Avail Use% Mounted on
18
+ /dev/xvda1 124G 84G 37G 70% /
19
+ none 7.9G 128K 7.9G 1% /dev
20
+ none 7.9G 0 7.9G 0% /dev/shm
21
+ none 7.9G 64K 7.9G 1% /var/run
22
+ none 7.9G 0 7.9G 0% /var/lock
23
+ none 7.9G 0 7.9G 0% /lib/init/rw
24
+
25
+ ### `cat /proc/diskstats` ubuntu
26
+ 1 0 ram0 0 0 0 0 0 0 0 0 0 0 0
27
+ 1 1 ram1 0 0 0 0 0 0 0 0 0 0 0
28
+ 1 2 ram2 0 0 0 0 0 0 0 0 0 0 0
29
+ 1 3 ram3 0 0 0 0 0 0 0 0 0 0 0
30
+ 1 4 ram4 0 0 0 0 0 0 0 0 0 0 0
31
+ 1 5 ram5 0 0 0 0 0 0 0 0 0 0 0
32
+ 1 6 ram6 0 0 0 0 0 0 0 0 0 0 0
33
+ 1 7 ram7 0 0 0 0 0 0 0 0 0 0 0
34
+ 1 8 ram8 0 0 0 0 0 0 0 0 0 0 0
35
+ 1 9 ram9 0 0 0 0 0 0 0 0 0 0 0
36
+ 1 10 ram10 0 0 0 0 0 0 0 0 0 0 0
37
+ 1 11 ram11 0 0 0 0 0 0 0 0 0 0 0
38
+ 1 12 ram12 0 0 0 0 0 0 0 0 0 0 0
39
+ 1 13 ram13 0 0 0 0 0 0 0 0 0 0 0
40
+ 1 14 ram14 0 0 0 0 0 0 0 0 0 0 0
41
+ 1 15 ram15 0 0 0 0 0 0 0 0 0 0 0
42
+ 7 0 loop0 0 0 0 0 0 0 0 0 0 0 0
43
+ 7 1 loop1 0 0 0 0 0 0 0 0 0 0 0
44
+ 7 2 loop2 0 0 0 0 0 0 0 0 0 0 0
45
+ 7 3 loop3 0 0 0 0 0 0 0 0 0 0 0
46
+ 7 4 loop4 0 0 0 0 0 0 0 0 0 0 0
47
+ 7 5 loop5 0 0 0 0 0 0 0 0 0 0 0
48
+ 7 6 loop6 0 0 0 0 0 0 0 0 0 0 0
49
+ 7 7 loop7 0 0 0 0 0 0 0 0 0 0 0
50
+ 202 1 xvda1 75413629 1344 743739154 105524030 1053781681 1294891028 18878505976 209944886 0 1628702090 315544316
51
+ 202 2 xvda2 281 29 2480 130 1011 312 10584 6380 0 620 6510
52
+
53
+ ### `cat /proc/diskstats` ubuntu second run
54
+ 1 0 ram0 0 0 0 0 0 0 0 0 0 0 0
55
+ 1 1 ram1 0 0 0 0 0 0 0 0 0 0 0
56
+ 1 2 ram2 0 0 0 0 0 0 0 0 0 0 0
57
+ 1 3 ram3 0 0 0 0 0 0 0 0 0 0 0
58
+ 1 4 ram4 0 0 0 0 0 0 0 0 0 0 0
59
+ 1 5 ram5 0 0 0 0 0 0 0 0 0 0 0
60
+ 1 6 ram6 0 0 0 0 0 0 0 0 0 0 0
61
+ 1 7 ram7 0 0 0 0 0 0 0 0 0 0 0
62
+ 1 8 ram8 0 0 0 0 0 0 0 0 0 0 0
63
+ 1 9 ram9 0 0 0 0 0 0 0 0 0 0 0
64
+ 1 10 ram10 0 0 0 0 0 0 0 0 0 0 0
65
+ 1 11 ram11 0 0 0 0 0 0 0 0 0 0 0
66
+ 1 12 ram12 0 0 0 0 0 0 0 0 0 0 0
67
+ 1 13 ram13 0 0 0 0 0 0 0 0 0 0 0
68
+ 1 14 ram14 0 0 0 0 0 0 0 0 0 0 0
69
+ 1 15 ram15 0 0 0 0 0 0 0 0 0 0 0
70
+ 7 0 loop0 0 0 0 0 0 0 0 0 0 0 0
71
+ 7 1 loop1 0 0 0 0 0 0 0 0 0 0 0
72
+ 7 2 loop2 0 0 0 0 0 0 0 0 0 0 0
73
+ 7 3 loop3 0 0 0 0 0 0 0 0 0 0 0
74
+ 7 4 loop4 0 0 0 0 0 0 0 0 0 0 0
75
+ 7 5 loop5 0 0 0 0 0 0 0 0 0 0 0
76
+ 7 6 loop6 0 0 0 0 0 0 0 0 0 0 0
77
+ 7 7 loop7 0 0 0 0 0 0 0 0 0 0 0
78
+ 202 1 xvda1 75413637 1344 743739218 105524040 1053781994 1294891526 18878512088 209956216 9 1628702500 315555746
79
+ 202 2 xvda2 281 29 2480 130 1011 312 10584 6380 0 620 6510
@@ -0,0 +1,43 @@
1
+ ### `cat /proc/meminfo`
2
+ MemTotal: 4332028 kB
3
+ MemFree: 245236 kB
4
+ Buffers: 50592 kB
5
+ Cached: 1961296 kB
6
+ SwapCached: 2252 kB
7
+ Active: 2035620 kB
8
+ Inactive: 1372484 kB
9
+ Active(anon): 1144828 kB
10
+ Inactive(anon): 251720 kB
11
+ Active(file): 890792 kB
12
+ Inactive(file): 1120764 kB
13
+ Unevictable: 0 kB
14
+ Mlocked: 0 kB
15
+ SwapTotal: 2097148 kB
16
+ SwapFree: 2085364 kB
17
+ Dirty: 1008 kB
18
+ Writeback: 0 kB
19
+ AnonPages: 1394372 kB
20
+ Mapped: 13624 kB
21
+ Shmem: 336 kB
22
+ Slab: 122924 kB
23
+ SReclaimable: 86536 kB
24
+ SUnreclaim: 36388 kB
25
+ KernelStack: 2968 kB
26
+ PageTables: 12064 kB
27
+ NFS_Unstable: 0 kB
28
+ Bounce: 0 kB
29
+ WritebackTmp: 0 kB
30
+ CommitLimit: 4263160 kB
31
+ Committed_AS: 2346404 kB
32
+ VmallocTotal: 34359738367 kB
33
+ VmallocUsed: 116640 kB
34
+ VmallocChunk: 34359619676 kB
35
+ HardwareCorrupted: 0 kB
36
+ AnonHugePages: 0 kB
37
+ HugePages_Total: 0
38
+ HugePages_Free: 0
39
+ HugePages_Rsvd: 0
40
+ HugePages_Surp: 0
41
+ Hugepagesize: 2048 kB
42
+ DirectMap4k: 52428800 kB
43
+ DirectMap2M: 0 kB
@@ -0,0 +1,13 @@
1
+ ### `cat /proc/net/dev`
2
+ Inter-| Receive | Transmit
3
+ face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
4
+ lo: 374560323 1856730 0 0 0 0 0 0 374560323 1856730 0 0 0 0 0 0
5
+ eth0: 552462517623 3558957087 0 1364584 0 0 0 0 587598134392 2577271905 0 0 0 0 0 0
6
+ eth1: 6858417585848 11678891991 0 1364584 0 0 0 0 1746386430035 10460881172 0 0 0 0 0 0
7
+
8
+ ### `cat /proc/net/dev` second run
9
+ Inter-| Receive | Transmit
10
+ face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
11
+ lo: 374560323 1856730 0 0 0 0 0 0 374560323 1856730 0 0 0 0 0 0
12
+ eth0: 552465252508 3558974617 0 1364590 0 0 0 0 587600612397 2577284599 0 0 0 0 0 0
13
+ eth1: 6858453491060 11678952278 0 1364590 0 0 0 0 1746395339079 10460934020 0 0 0 0 0 0