rearview 1.1.2-jruby → 1.2.0-jruby

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.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -3
  3. data/app/controllers/rearview/application_controller.rb +11 -0
  4. data/app/controllers/rearview/dashboard_children_controller.rb +1 -1
  5. data/app/controllers/rearview/dashboards_controller.rb +1 -1
  6. data/app/controllers/rearview/home_controller.rb +1 -1
  7. data/app/controllers/rearview/jobs_controller.rb +33 -29
  8. data/app/controllers/rearview/monitor_controller.rb +16 -2
  9. data/app/controllers/rearview/user_controller.rb +2 -2
  10. data/app/helpers/rearview/application_helper.rb +3 -3
  11. data/app/mailers/rearview/alert_mailer.rb +0 -2
  12. data/app/mailers/rearview/metrics_validation_mailer.rb +12 -0
  13. data/app/models/rearview/job.rb +17 -13
  14. data/app/views/rearview/home/show.html.erb +2 -0
  15. data/app/views/rearview/jobs/_job.json.jbuilder +1 -0
  16. data/app/views/rearview/metrics_validation_mailer/validation_failed_email.text.erb +13 -0
  17. data/app/views/rearview/monitor/create.json.jbuilder +1 -0
  18. data/db/migrate/20131106162900_base_schema.rb +2 -2
  19. data/lib/generators/templates/rearview.rb +24 -7
  20. data/lib/graphite.rb +13 -0
  21. data/lib/graphite/cacerts.pem +2184 -0
  22. data/lib/graphite/client.rb +44 -0
  23. data/lib/graphite/graph.rb +35 -0
  24. data/lib/{rearview/graphite_parser.rb → graphite/raw_parser.rb} +2 -3
  25. data/lib/graphite/target.rb +9 -0
  26. data/lib/graphite/target_grammer.rb +114 -0
  27. data/lib/graphite/target_grammer.treetop +53 -0
  28. data/lib/graphite/target_parser.rb +50 -0
  29. data/lib/graphite/treetop_ext.rb +14 -0
  30. data/lib/rearview.rb +11 -3
  31. data/lib/rearview/alerts_handler.rb +2 -6
  32. data/lib/rearview/configuration.rb +44 -19
  33. data/lib/rearview/cron_expression_validator.rb +11 -0
  34. data/lib/rearview/metrics_validator.rb +52 -0
  35. data/lib/rearview/metrics_validator_service.rb +24 -0
  36. data/lib/rearview/metrics_validator_task.rb +56 -0
  37. data/lib/rearview/monitor_runner.rb +9 -7
  38. data/lib/rearview/monitor_service.rb +2 -0
  39. data/lib/rearview/stats_service.rb +4 -2
  40. data/lib/rearview/version.rb +1 -1
  41. data/lib/tasks/rearview_tasks.rake +7 -1
  42. data/public/{help → rearview-src/help}/alert.html +0 -0
  43. data/public/{help → rearview-src/help}/quick.html +0 -0
  44. data/public/rearview-src/js/app.js +9 -0
  45. data/public/rearview-src/js/model/user.js +6 -2
  46. data/public/rearview-src/js/view/addmonitor.js +13 -8
  47. data/public/rearview-src/js/view/alert.js +11 -4
  48. data/public/rearview-src/js/view/dashboard.js +4 -2
  49. data/public/rearview-src/js/view/expandedmonitor.js +22 -9
  50. data/public/rearview-src/js/view/settings.js +84 -0
  51. data/public/rearview-src/less/login.less +4 -4
  52. data/public/rearview-src/less/rearview.less +17 -10
  53. data/public/{monitors → rearview-src/monitors}/index.json +1 -1
  54. data/public/{monitors → rearview-src/monitors}/outage.rb +0 -0
  55. data/public/rearview-src/templates/alert.hbs +10 -2
  56. data/public/rearview-src/templates/primarynav.hbs +6 -6
  57. data/public/rearview-src/templates/schedulemonitor.hbs +2 -1
  58. data/public/rearview-src/templates/settings.hbs +23 -0
  59. data/public/rearview/build.txt +1 -0
  60. data/public/rearview/help/alert.html +20 -0
  61. data/public/rearview/help/quick.html +34 -0
  62. data/public/rearview/js/app.js +1 -1
  63. data/public/rearview/js/main.js +21 -21
  64. data/public/rearview/js/model/user.js +1 -1
  65. data/public/rearview/js/view/addmonitor.js +1 -1
  66. data/public/rearview/js/view/alert.js +1 -1
  67. data/public/rearview/js/view/dashboard.js +1 -1
  68. data/public/rearview/js/view/expandedmonitor.js +1 -1
  69. data/public/rearview/js/view/settings.js +1 -0
  70. data/public/rearview/less/login.less +4 -4
  71. data/public/rearview/less/rearview.less +17 -10
  72. data/public/rearview/monitors/index.json +3 -0
  73. data/public/rearview/monitors/outage.rb +2 -0
  74. data/public/rearview/templates/alert.hbs +10 -2
  75. data/public/rearview/templates/primarynav.hbs +6 -6
  76. data/public/rearview/templates/schedulemonitor.hbs +2 -1
  77. data/public/rearview/templates/settings.hbs +23 -0
  78. data/spec/controllers/jobs_controller_spec.rb +1 -0
  79. data/spec/controllers/monitor_controller_spec.rb +3 -0
  80. data/spec/controllers/user_controller_spec.rb +5 -2
  81. data/spec/data/metrics.yml +598 -0
  82. data/spec/dummy/log/development.log +1044 -0
  83. data/spec/dummy/log/test.log +171716 -0
  84. data/spec/helpers/application_helper_spec.rb +33 -0
  85. data/spec/lib/graphite/client_spec.rb +126 -0
  86. data/spec/lib/graphite/graph_spec.rb +17 -0
  87. data/spec/lib/graphite/graphite_spec.rb +4 -0
  88. data/spec/lib/{rearview/graphite_parser_spec.rb → graphite/raw_parser.rb} +6 -5
  89. data/spec/lib/graphite/target_grammer_spec.rb +106 -0
  90. data/spec/lib/graphite/target_parser_spec.rb +124 -0
  91. data/spec/lib/graphite/target_spec.rb +5 -0
  92. data/spec/lib/rearview/configuration_spec.rb +69 -48
  93. data/spec/lib/rearview/metrics_validator_service_spec.rb +43 -0
  94. data/spec/lib/rearview/metrics_validator_spec.rb +84 -0
  95. data/spec/lib/rearview/metrics_validator_task_spec.rb +62 -0
  96. data/spec/lib/rearview/monitor_runner_spec.rb +3 -3
  97. data/spec/lib/rearview/stats_task_spec.rb +21 -0
  98. data/spec/mailers/metrics_validation_mailer_spec.rb +46 -0
  99. data/spec/models/job_spec.rb +82 -9
  100. data/spec/spec_helper.rb +15 -4
  101. data/spec/support/json_factory.rb +1 -1
  102. data/spec/views/dashboards/show.json.jbuilder_spec.rb +3 -1
  103. data/spec/views/jobs/show.json.jbuilder_spec.rb +2 -1
  104. metadata +98 -11
  105. data/public/rearview-src/templates/test.txt +0 -1
  106. data/public/rearview/templates/test.txt +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d1276e19f9f16bde728edf0876f8abe9c222331
4
- data.tar.gz: efe1ff6239c6c564c9667445ccfab3a5035a35b0
3
+ metadata.gz: d9930818c3cb39841ee9774dbdee3ad09c4e72c4
4
+ data.tar.gz: 0190f0a54cdebf77f29d161adeea0a9ea195a7d4
5
5
  SHA512:
6
- metadata.gz: f2e2d5d153ebbf5fa578ff9d1920b4fdc29775642b1f65ecb506160cab0079dd92bb0942f55c4179583ba3cad049d82b2a9aa1b3cd8374c93393a583da7d031c
7
- data.tar.gz: da47adfeb40007e595983100c8fbb573c17e10159fce0127286f1d63cd974fa3c7bb48df856a901e1da4e58f4d42efe5a755f1528ebedc68599f47c4921e2871
6
+ metadata.gz: a285f335cf44cb0d9fbfc174e419d9051544ab03a045a60cfa8529edb90752cf493625b957d9f983b50081ea063fcda6646454c7bd13ed40ef579a6b0b4c3503
7
+ data.tar.gz: 17e8d45a1f71f0bac7028cb1204978f968f4bc63d30a178e409cba18d2471b8cf48ce19d50ebea818d3ac463ca4fa628692e29b9976db9a3e9c280b89dc57730
data/README.md CHANGED
@@ -1,15 +1,17 @@
1
1
  [![Build Status](https://secure.travis-ci.org/livingsocial/rearview-engine.png?branch=master)](http://travis-ci.org/livingsocial/rearview-engine)
2
+ [![Coverage Status](https://coveralls.io/repos/livingsocial/rearview-engine/badge.png?branch=master)](https://coveralls.io/r/livingsocial/rearview-engine?branch=master)
2
3
  [![Code Climate](https://codeclimate.com/github/livingsocial/rearview-engine.png)](https://codeclimate.com/github/livingsocial/rearview-engine)
4
+ [![Gem Version](https://badge.fury.io/rb/rearview.png)](http://badge.fury.io/rb/rearview)
3
5
 
4
6
  Rails engine for [rearview](http://github.com/livingsocial/rearview). This project is for rearview developers only. For users please go to the [rearview](http://github.com/livingsocial/rearview) project for installation, configuration, and other details.
5
7
 
6
8
  # Development Guide
7
9
 
8
- Before developing please read how to [contribute](https://github.com/livingsocial/rearview-engine/blob/master/CONTRIBUTING.md).
10
+ Be sure to read the contribution guidelines [contribute](https://github.com/livingsocial/rearview-engine/blob/master/CONTRIBUTING.md).
9
11
 
10
12
  ## Intro
11
13
 
12
- Before contributing you should read [Getting Started with Engines](http://guides.rubyonrails.org/engines.html) guide to familiarize yourself with rails engines.
14
+ Before contributing you should read [Getting Started with Engines](http://guides.rubyonrails.org/engines.html) guide to familiarize yourself with rails engines. This [blog post](http://trentalbright.info/ruby/open-sourcing-with-engines/) also provides some more in-depth details of rails engines.
13
15
 
14
16
  Rearview consists of two components:
15
17
 
@@ -42,6 +44,10 @@ Change the line simliar to this
42
44
  To point to the path you cloned the engine too, for example
43
45
 
44
46
  gem 'rearview', :path => '~/clone/path/rearview-engine'
47
+
48
+ Update your gems with bundler
49
+
50
+ bundle install
45
51
 
46
52
  #### sync the engine host database
47
53
 
@@ -54,7 +60,9 @@ To point to the path you cloned the engine too, for example
54
60
 
55
61
  ## User Interface Guide
56
62
 
57
- Rearview does not use the asset pipeline. Instead you'll need to take a look at [public/rearview-src](https://github.com/livingsocial/rearview-engine/tree/master/public/rearview-src). In development mode javascript, css, etc is loaded directly from here. When rearview-engine is bundled as a Gem the various elements are pre-compiled (manually before **gem build**) using require and are loaded from [public/rearview](https://github.com/livingsocial/rearview-engine/tree/master/public/rearview).
63
+ The Rearview UI is built using bootstrap and require.
64
+
65
+ Rearview does not use the asset pipeline. Instead you'll need to take a look at [public/rearview-src](https://github.com/livingsocial/rearview-engine/tree/master/public/rearview-src). In development mode javascript, css, etc are loaded directly from here. When rearview-engine is bundled as a Gem the various elements are pre-compiled (manually before **gem build**) using require.js and are loaded from [public/rearview](https://github.com/livingsocial/rearview-engine/tree/master/public/rearview).
58
66
 
59
67
  To compile the ui before distribution, run the following rake task from inside rearview-engine:
60
68
 
@@ -2,5 +2,16 @@ module Rearview
2
2
  class ApplicationController < ActionController::Base
3
3
  helper Rearview::Engine.helpers
4
4
  before_filter :authenticate_user!
5
+
6
+ protected
7
+
8
+ def underscore_params
9
+ self.params = self.params.inject({}.with_indifferent_access) { |a,(k,v)| a[k.to_s.underscore] = v; a }
10
+ end
11
+
12
+ def clean_empty_array_vals(key)
13
+ params[key].reject! { |m| !m.present? } if params[key].present?
14
+ end
15
+
5
16
  end
6
17
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Rearview
3
- class DashboardChildrenController < ApplicationController
3
+ class DashboardChildrenController < Rearview::ApplicationController
4
4
  def index
5
5
  @dashboards = if params[:dashboard_id]
6
6
  Rearview::Dashboard.find(params[:dashboard_id]).children
@@ -1,7 +1,7 @@
1
1
  require_dependency "rearview/application_controller"
2
2
 
3
3
  module Rearview
4
- class DashboardsController < ApplicationController
4
+ class DashboardsController < Rearview::ApplicationController
5
5
  respond_to :json
6
6
 
7
7
  def index
@@ -1,6 +1,6 @@
1
1
  require_dependency "rearview/application_controller"
2
2
  module Rearview
3
- class HomeController < ApplicationController
3
+ class HomeController < Rearview::ApplicationController
4
4
  layout false
5
5
  end
6
6
  end
@@ -1,6 +1,11 @@
1
1
  module Rearview
2
- class JobsController < ApplicationController
2
+ class JobsController < Rearview::ApplicationController
3
3
  respond_to :json
4
+ before_action :underscore_params, only: [:create,:update]
5
+ before_action only: [:create, :update] do
6
+ clean_empty_array_vals(:metrics)
7
+ clean_empty_array_vals(:alert_keys)
8
+ end
4
9
 
5
10
  def index
6
11
  @jobs = if params[:dashboard_id].present?
@@ -11,13 +16,32 @@ module Rearview
11
16
  end
12
17
 
13
18
  def create
14
- upsert(allowed_create_params)
15
- render :show
19
+ dashboard_id = params.delete("dashboard_id")
20
+ @job = Rearview::Job.new(job_create_params)
21
+ @job.deep_validation = true
22
+ @job.user_id = current_user.id
23
+ @job.dashboard = Rearview::Dashboard.find(dashboard_id.to_i)
24
+ if @job.save
25
+ @job.sync_monitor_service
26
+ render :show
27
+ else
28
+ render :show, status: 422
29
+ end
16
30
  end
17
31
 
18
32
  def update
19
- upsert(allowed_update_params)
20
- render :show
33
+ @job = Rearview::Job.find(params[:id])
34
+ @job.deep_validation = true
35
+ dashboard_id = params.delete("dashboard_id")
36
+ if dashboard_id.present? && dashboard_id.to_i!=@job.app_id
37
+ @job.dashboard = Rearview::Dashboard.find(dashboard_id.to_i)
38
+ end
39
+ if @job.update_attributes(job_update_params)
40
+ @job.sync_monitor_service
41
+ render :show
42
+ else
43
+ render :show, status: 422
44
+ end
21
45
  end
22
46
 
23
47
  def destroy
@@ -49,32 +73,12 @@ module Rearview
49
73
 
50
74
  private
51
75
 
52
- def upsert(filtered_params)
53
- @job = Rearview::Job.find_or_initialize_by(id: params[:id])
54
- dashboard_id = filtered_params.delete("dashboard_id")
55
- if dashboard_id.present? && dashboard_id.to_i!=@job.app_id
56
- @job.dashboard = Rearview::Dashboard.find(dashboard_id.to_i)
57
- end
58
- @job.update_attributes!(filtered_params)
59
- @job.sync_monitor_service
60
- end
61
-
62
- def allowed_create_params
63
- filtered_params = underscore_params
64
- filtered_params.delete_if { |k,v|
65
- ["controller","job_type","version","action","job","id","format","created_at","modified_at"].include?(k)
66
- }
67
- end
68
-
69
- def allowed_update_params
70
- filtered_params = underscore_params
71
- filtered_params.delete_if { |k,v|
72
- !["dashboard_id","name","active","alert_keys","cron_expr","error_timeout","minutes","metrics","monitor_expr","to_date","description"].include?(k)
73
- }
76
+ def job_update_params
77
+ params.permit(:name,:active,{ :alert_keys => []},:cron_expr,:error_timeout,:minutes,{ :metrics => [] },:monitor_expr,:to_date,:description)
74
78
  end
75
79
 
76
- def underscore_params
77
- params.inject({}.with_indifferent_access) { |a,(k,v)| a[k.to_s.underscore] = v; a }
80
+ def job_create_params
81
+ params.permit(:dashboard_id,:name,:active,{ :alert_keys => []},:cron_expr,:error_timeout,:minutes,{ :metrics => [] },:monitor_expr,:to_date,:description)
78
82
  end
79
83
 
80
84
  end
@@ -1,9 +1,23 @@
1
1
 
2
2
  module Rearview
3
- class MonitorController < ApplicationController
3
+ class MonitorController < Rearview::ApplicationController
4
4
 
5
+ before_action only: [:create] do
6
+ clean_empty_array_vals(:metrics)
7
+ end
8
+
9
+ #
10
+ # TODO this should be moved to the JobsController#test and the UI changed to push the
11
+ # monitor job model instead of custom params
12
+ #
5
13
  def create
6
- results = Rearview::MonitorRunner.run(params[:metrics],params[:monitorExpr],params[:minutes],{},false,params[:toDate],true)
14
+ metrics_validator = Rearview::MetricsValidator.new({attributes: [:metrics]})
15
+ @errors = params[:metrics].inject([]) { |a,v| a << "Metrics contains an invalid metric: #{v}" unless(metrics_validator.metric_valid?(v)); a }
16
+ results = if @errors.empty?
17
+ Rearview::MonitorRunner.run(params[:metrics],params[:monitorExpr],params[:minutes],{},false,params[:toDate],true)
18
+ else
19
+ { }
20
+ end
7
21
  @monitor_output = Rearview::MonitorRunner.normalize_results(results)
8
22
  end
9
23
 
@@ -1,7 +1,7 @@
1
1
  require_dependency "rearview/application_controller"
2
2
 
3
3
  module Rearview
4
- class UserController < ApplicationController
4
+ class UserController < Rearview::ApplicationController
5
5
  respond_to :json
6
6
  def show
7
7
  @user = current_user
@@ -13,8 +13,8 @@ module Rearview
13
13
  @user = current_user
14
14
  if preferences.present?
15
15
  @user.preferences = preferences
16
- @user.save!
17
16
  end
17
+ @user.save!
18
18
  render :show
19
19
  end
20
20
  end
@@ -1,6 +1,6 @@
1
1
  module Rearview
2
2
  module ApplicationHelper
3
- def rearview_static_path(segment)
3
+ def rearview_static_path(segment=nil)
4
4
  prefix = if Rails.env.development?
5
5
  "/rearview-src"
6
6
  else
@@ -8,12 +8,12 @@ module Rearview
8
8
  end
9
9
  ( segment.present? ? prefix + segment : prefix )
10
10
  end
11
- def rearview_link_tag(href,options)
11
+ def rearview_link_tag(href,options={})
12
12
  options = options.symbolize_keys
13
13
  options[:href] = rearview_static_path(href)
14
14
  tag("link",options)
15
15
  end
16
- def rearview_img_tag(source,options)
16
+ def rearview_img_tag(source,options={})
17
17
  options = options.symbolize_keys
18
18
  options[:src] = rearview_static_path("/img"+source)
19
19
  tag("img", options)
@@ -1,5 +1,3 @@
1
- java_import "org.apache.commons.validator.EmailValidator"
2
-
3
1
  module Rearview
4
2
  class AlertMailer < ActionMailer::Base
5
3
  default from: Rearview.config.default_from
@@ -0,0 +1,12 @@
1
+
2
+ module Rearview
3
+ class MetricsValidationMailer < ActionMailer::Base
4
+ default from: Rearview.config.default_from
5
+ def validation_failed_email(recipient, job)
6
+ @job = job
7
+ mail(:to => recipient, :subject => "[Rearview ALERT] invalid metrics for #{@job.name}")
8
+ end
9
+ end
10
+ end
11
+
12
+
@@ -10,7 +10,12 @@ module Rearview
10
10
  make_constants_module :status,
11
11
  :constants => [:success,:failed,:error,:graphite_error,:graphite_metric_error,:security_error]
12
12
 
13
- attr_accessible :created_at, :updated_at, :name, :active, :last_run, :cron_expr, :status, :user_id, :alert_keys, :deleted_at, :error_timeout, :next_run, :description, :app_id, :metrics, :monitor_expr, :minutes, :to_date
13
+ attr_writer :deep_validation
14
+
15
+ attr_accessible :created_at, :updated_at, :name, :active, :last_run,
16
+ :cron_expr, :status, :user_id, :alert_keys, :deleted_at, :error_timeout,
17
+ :next_run, :description, :app_id, :metrics, :monitor_expr, :minutes,
18
+ :to_date
14
19
 
15
20
  belongs_to :dashboard, :foreign_key => :app_id
16
21
  belongs_to :user
@@ -25,8 +30,9 @@ module Rearview
25
30
  before_destroy :unschedule
26
31
 
27
32
  validates :app_id, :cron_expr, :name, :metrics, :presence => true
28
- validate :valid_cron_expression
29
- validate :valid_alert_keys
33
+ validates :cron_expr, :'rearview/cron_expression' => true, :if => :deep_validation?
34
+ validates :metrics, :'rearview/metrics' => true, :if => :deep_validation?
35
+ validate :valid_alert_keys, :if => :deep_validation?
30
36
 
31
37
  scope :schedulable, -> { where(:active=>true) }
32
38
 
@@ -110,12 +116,6 @@ module Rearview
110
116
  end
111
117
  end
112
118
 
113
- def valid_cron_expression
114
- if cron_expr.present? && !Rearview::CronHelper.valid_expression?(cron_expr)
115
- errors.add(:cron_expr, "not a valid cron expression")
116
- end
117
- end
118
-
119
119
  def valid_alert_keys
120
120
  if alert_keys.present?
121
121
  schemes = Rearview::Alerts.registry.keys
@@ -124,15 +124,15 @@ module Rearview
124
124
  uri = URI(key)
125
125
  scheme = uri.scheme
126
126
  unless scheme.present? && schemes.include?(scheme)
127
- errors.add(:alert_keys,"unsupported scheme")
127
+ errors.add(:alert_keys,"#{key} is not a supported alert type")
128
128
  else
129
129
  scheme_class = Rearview::Alerts.registry[scheme]
130
130
  unless scheme_class.key?(key)
131
- errors.add(:alert_keys,"#{scheme} URI is invalid")
131
+ errors.add(:alert_keys,"#{key} is invalid for supported alert type")
132
132
  end
133
133
  end
134
- rescue URI::InvalidURIError
135
- errors.add(:alert_keys,"invalid URI")
134
+ rescue URI::InvalidURIError, URI::InvalidComponentError
135
+ errors.add(:alert_keys,"#{key} is an invalid URI")
136
136
  end
137
137
  end
138
138
  end
@@ -154,6 +154,10 @@ module Rearview
154
154
  end
155
155
  end
156
156
 
157
+ def deep_validation?
158
+ @deep_validation
159
+ end
160
+
157
161
  protected
158
162
 
159
163
  def report_transition(transition)
@@ -41,10 +41,12 @@
41
41
  <section class='delete-monitor-wrap'></section>
42
42
  <section class='reset-monitor-wrap'></section>
43
43
  <section class='add-monitor-wrap'></section>
44
+ <section class='settings-wrap'></section>
44
45
  <section class='secondary-nav-wrap'></section>
45
46
  <script type='text/javascript'>
46
47
  var rearview = {};
47
48
  rearview.version = '<%= Rearview::VERSION %>';
49
+ rearview.path = '<%= rearview_static_path %>';
48
50
  <% if Rails.env.development? %>
49
51
  rearview.cache = false;
50
52
  <% end %>
@@ -2,3 +2,4 @@ json.(job,:id,:user_id,:name,:cron_expr,:metrics,:monitor_expr,:minutes,:to_date
2
2
  json.dashboardId job.app_id
3
3
  json.createdAt job.created_at.to_i
4
4
  json.modifiedAt job.updated_at.to_i
5
+ json.errors job.errors.full_messages
@@ -0,0 +1,13 @@
1
+ ALERT: Job has (<%= @job.errors[:metrics].count %>) invalid <%= "metric".pluralize(@job.errors[:metrics].count) %>
2
+
3
+ Monitor: <%= @job.name %>
4
+ Description: <%= @job.description.nil? ? "None" : @job.description %>
5
+
6
+ Alerted On: <%= Time.now.utc %>
7
+ Direct Link: <%= Rearview::UrlHelper.job_url(@job) %>
8
+
9
+ The following metric(s) are no longer valid in graphite:
10
+
11
+ <% @job.errors[:metrics].each do |metric_error| %>
12
+ <%= metric_error.match(/metric: (.*)$/).try(:[],1) %>
13
+ <% end %>
@@ -3,4 +3,5 @@ json.key_format! :underscore
3
3
  json.status @monitor_output[:status]
4
4
  json.output @monitor_output[:output]
5
5
  json.graph_data @monitor_output[:graph_data]
6
+ json.errors @errors
6
7
 
@@ -17,13 +17,13 @@ class BaseSchema < ActiveRecord::Migration
17
17
  t.integer "job_id", :default => 0, :null => false
18
18
  t.datetime "created_at"
19
19
  t.datetime "updated_at"
20
- t.text "data", :limit => 2147483647, :null => false
20
+ t.text "data", :limit => 1073741823, :null => false
21
21
  end
22
22
 
23
23
  create_table "job_errors", :force => true do |t|
24
24
  t.integer "job_id"
25
25
  t.datetime "created_at"
26
- t.text "message", :limit => 2147483647
26
+ t.text "message", :limit => 1073741823
27
27
  t.string "status"
28
28
  t.datetime "last_alerted_at"
29
29
  t.datetime "updated_at"
@@ -29,10 +29,20 @@ Rearview.configure do |config|
29
29
  # period the monitor script will be terminated.
30
30
  config.sandbox_timeout = 10
31
31
 
32
- # The url to your graphite web server
32
+ # The connection information for your graphite web server
33
33
  # ex:
34
- # config.graphite_url="http://graphite.mycompany.com"
35
- config.graphite_url = nil
34
+ # config.graphite_connection = { url: 'http://graphite.mycom.com' }
35
+ # config.graphite_connection = {
36
+ # url: 'http://graphite.mycompany.com'
37
+ # ssl: {
38
+ # verify: true,
39
+ # }
40
+ # basic_auth: {
41
+ # user: 'admin',
42
+ # password: 'xyzzy'
43
+ # }
44
+ # }
45
+ config.graphite_connection = { url: nil }
36
46
 
37
47
  # This is the email from: address used when sending alerts
38
48
  # ex:
@@ -42,7 +52,7 @@ Rearview.configure do |config|
42
52
  # The url options for rearview application host. Required to generate
43
53
  # monitor alerts with correct URL references.
44
54
  # ex:
45
- # config.default_url_options = { host: 'rearview.mycomopany.com', protocol: 'https'}
55
+ # config.default_url_options = { host: 'rearview.mycompany.com', protocol: 'https'}
46
56
  config.default_url_options = { host: 'localhost', port: '3000'}
47
57
 
48
58
  # Enable collection of stats for rearview itself. This will send JVM and monitor related
@@ -51,9 +61,15 @@ Rearview.configure do |config|
51
61
  config.enable_stats=false
52
62
 
53
63
  # The connection information for the stats service. Only necessary if enable_stats is true.
54
- # ex:
55
- # config.statsd_connection = { host: 'statsd.mycompany.com', port: 8125 , namespace: 'rearview' }
56
- #
64
+ config.statsd_connection = { host: 'statsd.mycompany.com', port: 8125 , namespace: 'rearview' }
65
+
66
+ # Enable periodic checking for invalid metrics used in monitors.
67
+ config.enable_metrics_validator = false
68
+
69
+ # Set schedule for checking for invalid metrics (cron expression). Recommended only once per day.
70
+ # see http://quartz-scheduler.org/api/2.0.0/org/quartz/CronExpression.html. Only necessary if
71
+ # enable_metrics_validator is true.
72
+ config.metrics_validator_schedule = '* * 23 * *'
57
73
 
58
74
  case Rails.env
59
75
  when "test"
@@ -67,6 +83,7 @@ Rearview.configure do |config|
67
83
  if File.basename($0) == "rake"
68
84
  config.enable_monitor = false
69
85
  config.enable_stats = false
86
+ config.enable_metrics_validator = false
70
87
  end
71
88
 
72
89
  # Options passed via environment will override anything else set to this point...