poolboy 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/README.md +5 -4
- data/lib/poolboy/mysql.rb +2 -2
- data/lib/poolboy/version.rb +1 -1
- data/lib/poolboy.rb +23 -11
- metadata +1 -1
data/.gitignore
CHANGED
data/README.md
CHANGED
data/lib/poolboy/mysql.rb
CHANGED
@@ -17,8 +17,8 @@ class MysqlConnection
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def percona
|
20
|
-
xtra = query("show variables like '
|
21
|
-
return xtra.
|
20
|
+
xtra = query("show variables like 'version_comment'")
|
21
|
+
return (xtra.first[:Value].include? "Percona") ? true : false
|
22
22
|
exit
|
23
23
|
end
|
24
24
|
|
data/lib/poolboy/version.rb
CHANGED
data/lib/poolboy.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'poolboy/screen'
|
2
|
+
require 'poolboy/version'
|
2
3
|
require 'poolboy/mysql'
|
3
4
|
require 'poolboy/five_five'
|
4
5
|
require 'poolboy/five_one'
|
@@ -9,39 +10,50 @@ require 'curses'
|
|
9
10
|
module Poolboy
|
10
11
|
|
11
12
|
def Poolboy.execute
|
12
|
-
|
13
13
|
options = YAML.load(File.read(ENV['HOME']+'/.poolboy.yaml')) rescue {}
|
14
14
|
|
15
15
|
o = OptionParser.new do |opts|
|
16
|
-
opts.
|
16
|
+
opts.banner = "Poolboy helps you inspect your buffer pool\n\nUsage: poolboy [options]"
|
17
|
+
opts.on("-h HOST", "MySQL hostname") do |h|
|
17
18
|
options[:host] = h
|
18
19
|
end
|
19
|
-
opts.on("-u USER") do |u|
|
20
|
+
opts.on("-u USER", "MySQL username") do |u|
|
20
21
|
options[:username] = u
|
21
22
|
end
|
22
|
-
opts.on("-p PASSWORD") do |p|
|
23
|
+
opts.on("-p PASSWORD", "MySQL password") do |p|
|
23
24
|
options[:password] = p
|
24
25
|
end
|
25
|
-
opts.on("-r REFRESH", Integer) do |r|
|
26
|
+
opts.on("-r REFRESH", Integer, "Refresh interval") do |r|
|
26
27
|
options[:refresh] = r >= 1 ? r : 1
|
27
28
|
end
|
28
|
-
|
29
|
-
|
29
|
+
options[:refresh] = options.has_key?(:refresh) ? options[:refresh] : 5
|
30
|
+
opts.on("-f", "Force skipping of Percona Server check") do |r|
|
31
|
+
options[:force] = true
|
32
|
+
end
|
33
|
+
options[:force] = options.has_key?(:force) ? options[:force] : false
|
34
|
+
opts.on_tail("--help", "Show this message") do
|
35
|
+
puts opts
|
36
|
+
exit
|
37
|
+
end
|
38
|
+
opts.on_tail("--version", "Show version") do
|
39
|
+
puts VERSION
|
40
|
+
exit
|
30
41
|
end
|
31
42
|
end
|
32
43
|
|
33
44
|
begin o.parse!
|
34
|
-
rescue OptionParser::InvalidOption => e
|
45
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e
|
35
46
|
puts e
|
36
47
|
puts o
|
37
48
|
exit 128
|
38
49
|
end
|
39
50
|
|
40
51
|
connection = MysqlConnection.new(options)
|
41
|
-
|
42
|
-
|
52
|
+
if not options[:force]
|
53
|
+
connection.percona
|
54
|
+
percona = connection.percona ? connection.percona : version_exit
|
55
|
+
end
|
43
56
|
version = connection.version
|
44
|
-
|
45
57
|
case version[0,3]
|
46
58
|
when '5.1'
|
47
59
|
mysql_map = FiveOne
|