monita 0.0.1.alpha
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.
- checksums.yaml +15 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +139 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +40 -0
- data/app/assets/images/monita/.gitkeep +0 -0
- data/app/assets/javascripts/monita/application.js +13 -0
- data/app/assets/stylesheets/monita/application.css +13 -0
- data/app/controllers/monita/application_controller.rb +4 -0
- data/app/controllers/monita/watches_controller.rb +25 -0
- data/app/helpers/monita/application_helper.rb +9 -0
- data/app/models/monita/watches/delayed_job.rb +29 -0
- data/app/models/monita/watches/resque.rb +31 -0
- data/app/models/monita/watches/watch.rb +42 -0
- data/app/views/layouts/monita/application.html.erb +13 -0
- data/app/views/layouts/monita/application.html.haml +9 -0
- data/app/views/monita/watches/index.html.haml +5 -0
- data/app/views/monita/watches/show.html.haml +12 -0
- data/app/views/monita/watches/show.text.haml +7 -0
- data/config/routes.rb +12 -0
- data/lib/monita.rb +10 -0
- data/lib/monita/engine.rb +10 -0
- data/lib/monita/version.rb +3 -0
- data/lib/monita/watch.rb +21 -0
- data/lib/tasks/monita_tasks.rake +4 -0
- data/monita.gemspec +27 -0
- data/script/rails +8 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/db/migrate/20130423095724_create_delayed_jobs.rb +22 -0
- data/test/dummy/db/schema.rb +32 -0
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/lib/tasks/resque.rake +1 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/delayed_job +5 -0
- data/test/dummy/script/rails +6 -0
- metadata +227 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MTViM2RmY2FhODVlNzIyOGRlYmNjNDVlYWVmNjQ3NDU0M2YyY2E2ZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZmVlMDIwNjk3M2U3MTg2ZWJhZmE3NWY1MWQ4NzFkY2NmNDc1YmU1Mg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTYxZGI4NjQ1MzNlYzBlZWIzZTQ1MmYwODlkY2FiNmQwNGQ4MzEyZGIxYmFj
|
10
|
+
MzhhNmYzMjY3NDU0NWY5NGUzZGJhNTM2Y2VhZjRhYjJiYjNmYjgyNDQ0NmNj
|
11
|
+
ODNmOTA2YTg2Y2NjNzYwZjU1ZGQ5ZjRhNDZkMjIyMjMwZDAxNjU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YmVkNmMxMmRmNTk1NTQxZjE4MTgzMzliMzMzZmMyZTE2MDRhYTkzZjM5ODI0
|
14
|
+
NjZlNGM4ZmJkOGYyZmIxOTc5MWFjZGRmNjBiYWJkMGJkZThhMTVmOTI5MzUy
|
15
|
+
NWYwZWU2YzlmYWQxOTU5YjI4YTFlNWRlOTllYmU1MDI0MjBjNTE=
|
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in monita.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "delayed_job"
|
9
|
+
gem "delayed_job_active_record"
|
10
|
+
gem "resque"
|
11
|
+
|
12
|
+
# Declare any dependencies that are still in development here instead of in
|
13
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
14
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
15
|
+
# your gem to rubygems.org.
|
16
|
+
|
17
|
+
# To use debugger
|
18
|
+
# gem 'debugger'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
monita (0.0.1alpha)
|
5
|
+
haml-rails
|
6
|
+
rails (~> 3.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionmailer (3.2.13)
|
12
|
+
actionpack (= 3.2.13)
|
13
|
+
mail (~> 2.5.3)
|
14
|
+
actionpack (3.2.13)
|
15
|
+
activemodel (= 3.2.13)
|
16
|
+
activesupport (= 3.2.13)
|
17
|
+
builder (~> 3.0.0)
|
18
|
+
erubis (~> 2.7.0)
|
19
|
+
journey (~> 1.0.4)
|
20
|
+
rack (~> 1.4.5)
|
21
|
+
rack-cache (~> 1.2)
|
22
|
+
rack-test (~> 0.6.1)
|
23
|
+
sprockets (~> 2.2.1)
|
24
|
+
activemodel (3.2.13)
|
25
|
+
activesupport (= 3.2.13)
|
26
|
+
builder (~> 3.0.0)
|
27
|
+
activerecord (3.2.13)
|
28
|
+
activemodel (= 3.2.13)
|
29
|
+
activesupport (= 3.2.13)
|
30
|
+
arel (~> 3.0.2)
|
31
|
+
tzinfo (~> 0.3.29)
|
32
|
+
activeresource (3.2.13)
|
33
|
+
activemodel (= 3.2.13)
|
34
|
+
activesupport (= 3.2.13)
|
35
|
+
activesupport (3.2.13)
|
36
|
+
i18n (= 0.6.1)
|
37
|
+
multi_json (~> 1.0)
|
38
|
+
arel (3.0.2)
|
39
|
+
builder (3.0.4)
|
40
|
+
delayed_job (3.0.3)
|
41
|
+
activesupport (~> 3.0)
|
42
|
+
delayed_job_active_record (0.3.2)
|
43
|
+
activerecord (> 2.1.0)
|
44
|
+
delayed_job (~> 3.0.0)
|
45
|
+
diff-lcs (1.2.1)
|
46
|
+
erubis (2.7.0)
|
47
|
+
haml (3.1.7)
|
48
|
+
haml-rails (0.3.4)
|
49
|
+
actionpack (~> 3.0)
|
50
|
+
activesupport (~> 3.0)
|
51
|
+
haml (~> 3.0)
|
52
|
+
railties (~> 3.0)
|
53
|
+
hike (1.2.2)
|
54
|
+
i18n (0.6.1)
|
55
|
+
journey (1.0.4)
|
56
|
+
json (1.7.7)
|
57
|
+
mail (2.5.3)
|
58
|
+
i18n (>= 0.4.0)
|
59
|
+
mime-types (~> 1.16)
|
60
|
+
treetop (~> 1.4.8)
|
61
|
+
mime-types (1.23)
|
62
|
+
mono_logger (1.0.1)
|
63
|
+
multi_json (1.7.2)
|
64
|
+
polyglot (0.3.3)
|
65
|
+
rack (1.4.5)
|
66
|
+
rack-cache (1.2)
|
67
|
+
rack (>= 0.4)
|
68
|
+
rack-protection (1.5.0)
|
69
|
+
rack
|
70
|
+
rack-ssl (1.3.3)
|
71
|
+
rack
|
72
|
+
rack-test (0.6.2)
|
73
|
+
rack (>= 1.0)
|
74
|
+
rails (3.2.13)
|
75
|
+
actionmailer (= 3.2.13)
|
76
|
+
actionpack (= 3.2.13)
|
77
|
+
activerecord (= 3.2.13)
|
78
|
+
activeresource (= 3.2.13)
|
79
|
+
activesupport (= 3.2.13)
|
80
|
+
bundler (~> 1.0)
|
81
|
+
railties (= 3.2.13)
|
82
|
+
railties (3.2.13)
|
83
|
+
actionpack (= 3.2.13)
|
84
|
+
activesupport (= 3.2.13)
|
85
|
+
rack-ssl (~> 1.3.2)
|
86
|
+
rake (>= 0.8.7)
|
87
|
+
rdoc (~> 3.4)
|
88
|
+
thor (>= 0.14.6, < 2.0)
|
89
|
+
rake (10.0.4)
|
90
|
+
rdoc (3.12.2)
|
91
|
+
json (~> 1.4)
|
92
|
+
redis (3.0.4)
|
93
|
+
redis-namespace (1.2.1)
|
94
|
+
redis (~> 3.0.0)
|
95
|
+
resque (1.24.1)
|
96
|
+
mono_logger (~> 1.0)
|
97
|
+
multi_json (~> 1.0)
|
98
|
+
redis-namespace (~> 1.2)
|
99
|
+
sinatra (>= 0.9.2)
|
100
|
+
vegas (~> 0.1.2)
|
101
|
+
rspec (2.13.0)
|
102
|
+
rspec-core (~> 2.13.0)
|
103
|
+
rspec-expectations (~> 2.13.0)
|
104
|
+
rspec-mocks (~> 2.13.0)
|
105
|
+
rspec-core (2.13.1)
|
106
|
+
rspec-expectations (2.13.0)
|
107
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
108
|
+
rspec-mocks (2.13.0)
|
109
|
+
sinatra (1.3.6)
|
110
|
+
rack (~> 1.4)
|
111
|
+
rack-protection (~> 1.3)
|
112
|
+
tilt (~> 1.3, >= 1.3.3)
|
113
|
+
sprockets (2.2.2)
|
114
|
+
hike (~> 1.2)
|
115
|
+
multi_json (~> 1.0)
|
116
|
+
rack (~> 1.0)
|
117
|
+
tilt (~> 1.1, != 1.3.0)
|
118
|
+
sqlite3 (1.3.7)
|
119
|
+
thor (0.18.1)
|
120
|
+
tilt (1.3.7)
|
121
|
+
treetop (1.4.12)
|
122
|
+
polyglot
|
123
|
+
polyglot (>= 0.3.1)
|
124
|
+
tzinfo (0.3.37)
|
125
|
+
vegas (0.1.11)
|
126
|
+
rack (>= 1.0.0)
|
127
|
+
|
128
|
+
PLATFORMS
|
129
|
+
ruby
|
130
|
+
|
131
|
+
DEPENDENCIES
|
132
|
+
bundler (~> 1.3)
|
133
|
+
delayed_job
|
134
|
+
delayed_job_active_record
|
135
|
+
monita!
|
136
|
+
rake
|
137
|
+
resque
|
138
|
+
rspec
|
139
|
+
sqlite3
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 Pieter Visser
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'Monita'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
24
|
+
load 'rails/tasks/engine.rake'
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
Bundler::GemHelper.install_tasks
|
29
|
+
|
30
|
+
require 'rake/testtask'
|
31
|
+
|
32
|
+
Rake::TestTask.new(:test) do |t|
|
33
|
+
t.libs << 'lib'
|
34
|
+
t.libs << 'test'
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
36
|
+
t.verbose = false
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
task :default => :test
|
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Monita
|
2
|
+
|
3
|
+
class WatchesController < Monita::ApplicationController
|
4
|
+
|
5
|
+
helper_method :watch
|
6
|
+
|
7
|
+
def index
|
8
|
+
end
|
9
|
+
|
10
|
+
def show
|
11
|
+
end
|
12
|
+
|
13
|
+
def touch
|
14
|
+
watch.touch
|
15
|
+
render :text => "Touching watch: #{watch.name}"
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def watch
|
21
|
+
@_watch ||= Monita::Watch.find_by_name params[:watch]
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Monita
|
2
|
+
module Watches
|
3
|
+
class DelayedJob < Monita::Watches::Watch
|
4
|
+
|
5
|
+
@name = "Delayed Job"
|
6
|
+
@path = "delayed_job"
|
7
|
+
|
8
|
+
def touch
|
9
|
+
Delayed::Job.enqueue TouchDjJob.new
|
10
|
+
end
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def applicable?
|
14
|
+
defined? Delayed::Job
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class TouchDjJob
|
22
|
+
|
23
|
+
def perform
|
24
|
+
Monita::Watch.find_by_name("Delayed Job").update_mtime
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Monita
|
2
|
+
module Watches
|
3
|
+
class Resque < Monita::Watches::Watch
|
4
|
+
|
5
|
+
@name = 'Resque'
|
6
|
+
@path = 'resque'
|
7
|
+
|
8
|
+
def touch
|
9
|
+
::Resque.enqueue ResqueJob
|
10
|
+
end
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def applicable?
|
14
|
+
defined? ::Resque
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class ResqueJob
|
22
|
+
|
23
|
+
@queue = :monitoring
|
24
|
+
|
25
|
+
def self.perform
|
26
|
+
Monita::Watch.find_by_name("Resque").update_mtime
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Monita
|
2
|
+
module Watches
|
3
|
+
class Watch
|
4
|
+
|
5
|
+
class << self
|
6
|
+
|
7
|
+
def applicable?
|
8
|
+
false
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
def name
|
14
|
+
self.class.instance_variable_get(:@name)
|
15
|
+
end
|
16
|
+
|
17
|
+
def path
|
18
|
+
self.class.instance_variable_get(:@path)
|
19
|
+
end
|
20
|
+
|
21
|
+
def touch
|
22
|
+
puts "Touching #{self}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def update_mtime
|
26
|
+
File.open(file_path, 'w') {|f| f.write("#{name} last update: #{Time.now}") }
|
27
|
+
end
|
28
|
+
|
29
|
+
def last_updated_at
|
30
|
+
update_mtime unless File.exists?(file_path)
|
31
|
+
File.mtime(file_path)
|
32
|
+
end
|
33
|
+
|
34
|
+
protected
|
35
|
+
|
36
|
+
def file_path
|
37
|
+
File.join(Rails.root, 'public', 'watches', "#{path}.txt")
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Monita</title>
|
5
|
+
<%= stylesheet_link_tag "monita/application", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "monita/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<%= yield %>
|
11
|
+
|
12
|
+
</body>
|
13
|
+
</html>
|