heroku_mongo_watcher 0.1.0.beta → 0.1.1.beta

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -62,7 +62,7 @@ found (see output above), set to false it will just put the total in the summary
62
62
 
63
63
  ## To install
64
64
 
65
- 1. bundle install heroku_mongo_watcher
65
+ 1. gem install heroku_mongo_watcher
66
66
  2. create a .watcher file (see the examples) in your user directory ~/.watcher
67
67
  3. then run `bundle exec watcher`
68
68
  4. Ctrl-C out to quit
@@ -40,7 +40,10 @@ class HerokuMongoWatcher::CLI
40
40
 
41
41
  # Call Tails heroku logs updates counts
42
42
  heroku_watcher = Thread.new('heroku_logs') do
43
- IO.popen("heroku logs --tail --app #{config[:heroku_appname]} --account #{config[:heroku_account]}") do |f|
43
+
44
+ cmd_string = "heroku logs --tail --app #{config[:heroku_appname]}"
45
+ cmd_string = cmd_string + " --account #{config[:heroku_account]}" if config[:heroku_account]
46
+ IO.popen(cmd_string) do |f|
44
47
  while line = f.gets
45
48
  @mutex.synchronize do
46
49
  @current_row.process_heroku_router_line(line) if line.include? 'heroku[router]'
@@ -54,7 +57,9 @@ class HerokuMongoWatcher::CLI
54
57
  heroku_ps = Thread.new('heroku_ps') do
55
58
  while true do
56
59
  dynos = 0
57
- IO.popen("heroku ps --app #{config[:heroku_appname]} --account #{config[:heroku_account]}") do |p|
60
+ cmd_string = "heroku ps --app #{config[:heroku_appname]}"
61
+ cmd_string = cmd_string + " --account #{config[:heroku_account]}" if config[:heroku_account]
62
+ IO.popen(cmd_string) do |p|
58
63
  while line = p.gets
59
64
  dynos += 1 if line =~ /^web/ && line.split(' ')[1] == 'up'
60
65
  end
@@ -117,12 +122,13 @@ class HerokuMongoWatcher::CLI
117
122
  return unless @current_row.total_requests > 200
118
123
  if @current_row.average_response_time > 10_000 || @current_row.error_rate > 1
119
124
  notify "[SEVERE WARNING] Application not healthy | [#{@current_row.total_requests} rpm,#{@current_row.average_response_time} art]" unless @art_critical_notified
120
- # @art_critical_notified = true
125
+ @art_critical_notified = true
121
126
  elsif @current_row.average_response_time > 500 || @current_row.error_rate > 0.3 || @current_row.total_requests > 30_000
122
127
  notify "[WARNING] Application heating up | [#{@current_row.total_requests} rpm,#{@current_row.average_response_time} art]" unless @art_warning_notified
123
- # @art_warning_notified = true
124
- elsif @current_row.average_response_time < 300
128
+ @art_warning_notified = true
129
+ elsif @current_row.average_response_time < 300 && @current_row.total_requests < 25_000
125
130
  if @art_warning_notified || @art_critical_notified
131
+ notify "[RESOLVED] | [#{@current_row.total_requests} rpm,#{@current_row.average_response_time} art]"
126
132
  @art_warning_notified = false
127
133
  @art_critical_notified = false
128
134
  end
@@ -131,8 +137,8 @@ class HerokuMongoWatcher::CLI
131
137
 
132
138
  def self.notify(msg)
133
139
  Thread.new('notify_admins') do
134
- subscribers = config[:notify]
135
- subscribers.each { |user_email| send_email(user_email, msg) } unless subscribers.empty?
140
+ subscribers = config[:notify] || []
141
+ subscribers.each { |user_email| send_email(user_email, msg) }
136
142
  end
137
143
  end
138
144
 
@@ -130,7 +130,7 @@ class HerokuMongoWatcher::DataRow
130
130
 
131
131
  color_print @dynos, length: 4
132
132
  color_print @total_requests, warning: 30_000, critical: 50_000
133
- color_print average_response_time, warning: 1000, critical: 10_000, bold: true
133
+ color_print average_response_time, warning: 500, critical: 1000, bold: true
134
134
  color_print @max_service, warning: 20_000
135
135
  color_print @total_router_errors, warning: 1
136
136
  color_print @total_web_errors, warning: 1
@@ -1,3 +1,3 @@
1
1
  module HerokuMongoWatcher
2
- VERSION = "0.1.0.beta"
2
+ VERSION = "0.1.1.beta"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_mongo_watcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.beta
4
+ version: 0.1.1.beta
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-07-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: term-ansicolor
16
- requirement: &2156288100 !ruby/object:Gem::Requirement
16
+ requirement: &2158231140 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156288100
24
+ version_requirements: *2158231140
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: tlsmail
27
- requirement: &2156279920 !ruby/object:Gem::Requirement
27
+ requirement: &2158230500 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2156279920
35
+ version_requirements: *2158230500
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: heroku
38
- requirement: &2156263940 !ruby/object:Gem::Requirement
38
+ requirement: &2158229820 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2156263940
46
+ version_requirements: *2158229820
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: trollop
49
- requirement: &2156245840 !ruby/object:Gem::Requirement
49
+ requirement: &2158229060 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2156245840
57
+ version_requirements: *2158229060
58
58
  description: Also notifies you when certain thresholds are hit. I have found this
59
59
  much more accurate than New Relic
60
60
  email: