kanshi 0.0.2 → 0.1.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.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. Push the code as-is to a new Heroku app.
30
- 2. Set environment variables with database URLs.
31
- 3. `heroku scale kanshi=1`
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'] || 300).to_i
17
+ :delay => (ENV['KANSHI_SAMPLE_DELAY'] || 60).to_i
18
18
  )
@@ -12,7 +12,7 @@ class Kanshi
12
12
  def initialize(options = {})
13
13
  @options = {
14
14
  :databases => {},
15
- :delay => 300,
15
+ :delay => 60,
16
16
  :reporter => ScrollsReporter
17
17
  }
18
18
  @options.merge!(options)
@@ -1,11 +1,12 @@
1
1
  Kanshi::Queries = <<EOF.split(/\s*;\s*/)
2
2
  SELECT
3
- pg_database_size(d.datname) as size,
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,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kanshi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: