kanshi 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -3
- data/bin/kanshi +2 -2
- data/lib/kanshi.rb +1 -1
- data/lib/kanshi/queries.rb +2 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -26,9 +26,10 @@ Kanshi will work as a gem or as a standalone app.
|
|
26
26
|
|
27
27
|
### Create as separate Heroku app
|
28
28
|
|
29
|
-
1.
|
30
|
-
2.
|
31
|
-
3.
|
29
|
+
1. Create a new app.
|
30
|
+
2. Follow steps 1-3 from above.
|
31
|
+
3. Add environment variables for each database URL you want to monitor.
|
32
|
+
4. `heroku scale kanshi=1`
|
32
33
|
|
33
34
|
### Custom install
|
34
35
|
|
@@ -37,6 +38,9 @@ of your choosing, e.g. monitor specific databases or provide your own
|
|
37
38
|
reporter for output. An easy way to do this would be to create a Rake
|
38
39
|
task to run Kanshi.
|
39
40
|
|
41
|
+
For more information, see the Configuration section below and [the
|
42
|
+
source code for bin/kanshi](/heroku/kanshi/blob/master/bin/kanshi).
|
43
|
+
|
40
44
|
## Configuration
|
41
45
|
|
42
46
|
If using the `kanshi` binary, configuration is optional but is done
|
data/bin/kanshi
CHANGED
@@ -8,11 +8,11 @@ databases = ENV.select { |k, v| v =~ %r{^postgres://} }.invert.invert
|
|
8
8
|
prefix = ENV['KANSHI_PREFIX'] || 'kanshi'
|
9
9
|
unless prefix.empty?
|
10
10
|
databases.keys.each do |db|
|
11
|
-
databases["#{prefix}.#{db}"] = databases.delete(db)
|
11
|
+
databases["#{prefix}.#{db.downcase}"] = databases.delete(db)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
Kanshi.run(
|
16
16
|
:databases => databases,
|
17
|
-
:delay => (ENV['KANSHI_SAMPLE_DELAY'] ||
|
17
|
+
:delay => (ENV['KANSHI_SAMPLE_DELAY'] || 60).to_i
|
18
18
|
)
|
data/lib/kanshi.rb
CHANGED
data/lib/kanshi/queries.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
Kanshi::Queries = <<EOF.split(/\s*;\s*/)
|
2
2
|
SELECT
|
3
|
-
pg_database_size(d.datname)
|
3
|
+
pg_database_size(d.datname) AS size,
|
4
4
|
numbackends,
|
5
5
|
xact_commit,
|
6
6
|
xact_rollback,
|
7
7
|
blks_read,
|
8
8
|
blks_hit,
|
9
|
+
blks_read + blks_hit AS blks_total,
|
9
10
|
tup_fetched,
|
10
11
|
tup_returned,
|
11
12
|
tup_inserted,
|