mmtop 0.9.9 → 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
data/bin/mmtop CHANGED
@@ -11,6 +11,7 @@ spec = <<-EOL
11
11
  -p, --password <pass> The password used to connect to all DBs
12
12
  -u, --user <user> The user used to connect to all DBs
13
13
  -o, --ops David's funky ops mode
14
+ -q, --quick Display the stats once and exist.
14
15
  EOL
15
16
 
16
17
  args = Getopt::Declare.new(spec)
@@ -23,7 +24,11 @@ while true
23
24
  MMTop::PID.reset
24
25
  config.get_info
25
26
  printer.print_info(config.info)
26
- input.control(config)
27
+ if not config.quick
28
+ input.control(config)
29
+ else
30
+ break
31
+ end
27
32
  end
28
33
 
29
34
 
@@ -21,19 +21,24 @@ module MMTop
21
21
  Host.new(h['host'], h['user'], h['password'], h)
22
22
  end.compact.uniq { |h| h.name }
23
23
 
24
- @filters = MMTop::Filter.default_filters
25
24
  config['sleep'] ||= 5
26
25
 
27
26
  if config['plugin_dir']
28
27
  Dir.glob("#{config['plugin_dir']}/**/*.rb").each { |f| require(f) }
29
28
  end
29
+
30
+ @filters = MMTop::Filter.default_filters
31
+
30
32
  @options = config
33
+
34
+ @quick = cmdline["-q"]
31
35
  end
32
36
 
33
37
  attr_accessor :hosts
34
38
  attr_accessor :info
35
39
  attr_accessor :filters
36
40
  attr_accessor :options
41
+ attr_accessor :quick
37
42
 
38
43
  def find_pid(pid)
39
44
  ret = info.map { |i|
@@ -48,7 +48,7 @@ module MMTop
48
48
  end
49
49
 
50
50
  def table_header_columns
51
- @header_columns ||= ["hostname ", "pid ", "time", "#cx", "slave ", "delay", "qps ", "comment", Time.now.to_s]
51
+ @header_columns ||= ["hostname ", "pid ", "time", "#cx", "slave ", "delay", "qps ", "comment " + info_sep + Time.now.to_s]
52
52
  end
53
53
 
54
54
  def column_fill(index)
@@ -142,13 +142,13 @@ module MMTop
142
142
  def print_host(info)
143
143
  display_name = info.host.display_name
144
144
  display_name = (display_name + "!").red if info.host.dead?
145
- str = pipe + " " + column_value(0, display_name + " " + (info.host.comment || ""), "-".dark_gray)
145
+ str = pipe + " " + column_value(0, display_name + " ", "-".dark_gray)
146
146
  str += sep_fill + column_fill(1) + sep_fill + column_fill(2)
147
147
  str += info_sep + column_value(3, info.connections.size.to_s)
148
148
  str += info_sep + column_value(4, format_slave_status(info.slave_status))
149
149
  str += info_sep + column_value(5, format_slave_delay(info.slave_status))
150
150
  str += info_sep + column_value(6, info.stats[:qps].to_s)
151
- #str += info_sep + column_value(7, info.host.comment || '')
151
+ str += info_sep + column_value(7, info.host.comment || '')
152
152
  str += info_sep
153
153
  str += "-".dark_gray * (@x - str.size - 1)
154
154
  str += pipe
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mmtop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
4
+ version: 0.9.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-15 00:00:00.000000000 Z
12
+ date: 2013-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mysql2
@@ -116,7 +116,8 @@ files:
116
116
  - lib/mmtop/term_input.rb
117
117
  - lib/mmtop/term_printer.rb
118
118
  - lib/mmtop.rb
119
- - bin/mmtop
119
+ - !binary |-
120
+ YmluL21tdG9w
120
121
  homepage: http://github.com/osheroff/mmtop
121
122
  licenses: []
122
123
  post_install_message:
@@ -131,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
132
  version: '0'
132
133
  segments:
133
134
  - 0
134
- hash: -1153904921508667372
135
+ hash: -870775084710735139
135
136
  required_rubygems_version: !ruby/object:Gem::Requirement
136
137
  none: false
137
138
  requirements:
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
141
  version: '0'
141
142
  segments:
142
143
  - 0
143
- hash: -1153904921508667372
144
+ hash: -870775084710735139
144
145
  requirements: []
145
146
  rubyforge_project:
146
147
  rubygems_version: 1.8.24