what 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +24 -0
- data/example/what.yml +5 -9
- data/lib/what/modules/base.rb +1 -3
- data/lib/what/modules/unicorn.rb +3 -1
- data/lib/what/monitor.rb +1 -0
- data/lib/what/version.rb +1 -1
- metadata +20 -2
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
What? A simple server monitoring tool.
|
2
|
+
======================================
|
3
|
+
|
4
|
+
What is still in the early stages of development.
|
5
|
+
|
6
|
+
Right now, the example config file monitors Unicorn workers. Observe:
|
7
|
+
|
8
|
+
$ what -c example/what.yml >/dev/null 2>&1 &
|
9
|
+
[1] 2392
|
10
|
+
$ curl localhost:9428
|
11
|
+
{"unicorn":{"details":[{"cpu_time":"0:00.02","pid":"11023"},{"cpu_time":"0:00.02","pid":"11022"}],"health":"ok","workers":2},"health":"ok"}
|
12
|
+
$ sudo /etc/init.d/unicorn stop
|
13
|
+
$ curl localhost:9428
|
14
|
+
{"unicorn":{"details":[],"health":"alert","workers":0},"health":"alert"}
|
15
|
+
|
16
|
+
When the health value of any module is set to "alert" instead of "ok",
|
17
|
+
the HTTP request returns 503 instead of 200. This means What can easily
|
18
|
+
be used in conjunction with monitoring tools like Pingdom.
|
19
|
+
|
20
|
+
Writing monitoring modules is easy: the only requirement is that they
|
21
|
+
implement a `health` method, which returns `:ok`, `:warning`, or `:alert`.
|
22
|
+
They can also implement a `details` method, which returns the hash
|
23
|
+
that's included in the HTTP response. See the included `What::Modules::Base`
|
24
|
+
and `What::Modules::Unicorn` classes for the implementation details.
|
data/example/what.yml
CHANGED
@@ -10,17 +10,13 @@ interval: 10
|
|
10
10
|
### List all modules to be monitored.
|
11
11
|
modules:
|
12
12
|
- unicorn
|
13
|
-
# - ram
|
14
|
-
# - redis
|
15
|
-
# - dir
|
16
|
-
# - whatever
|
17
13
|
|
18
14
|
### Pass parameters into modules.
|
19
|
-
|
20
|
-
|
21
|
-
#
|
22
|
-
|
23
|
-
|
15
|
+
module_config:
|
16
|
+
unicorn:
|
17
|
+
# minimum number of workers before warning and alert statuses
|
18
|
+
warning: 1
|
19
|
+
alert: 0
|
24
20
|
|
25
21
|
### Specify any other config files to load.
|
26
22
|
# configs:
|
data/lib/what/modules/base.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class What::Modules::Base
|
2
2
|
def initialize
|
3
|
-
@config = What::Config[self.name]
|
3
|
+
@config = What::Config['module_config'] && What::Config['module_config'][self.name]
|
4
4
|
end
|
5
5
|
|
6
6
|
def name
|
@@ -8,7 +8,6 @@ class What::Modules::Base
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def check!
|
11
|
-
raise "Module #{self.class.name} doesn't override 'check!'"
|
12
11
|
end
|
13
12
|
|
14
13
|
def status
|
@@ -23,4 +22,3 @@ class What::Modules::Base
|
|
23
22
|
{}
|
24
23
|
end
|
25
24
|
end
|
26
|
-
|
data/lib/what/modules/unicorn.rb
CHANGED
data/lib/what/monitor.rb
CHANGED
data/lib/what/version.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: what
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Ryan Lower
|
@@ -22,6 +27,9 @@ dependencies:
|
|
22
27
|
requirements:
|
23
28
|
- - ">="
|
24
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
25
33
|
version: "0"
|
26
34
|
type: :runtime
|
27
35
|
version_requirements: *id001
|
@@ -33,6 +41,9 @@ dependencies:
|
|
33
41
|
requirements:
|
34
42
|
- - ">="
|
35
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
36
47
|
version: "0"
|
37
48
|
type: :runtime
|
38
49
|
version_requirements: *id002
|
@@ -51,6 +62,7 @@ extra_rdoc_files: []
|
|
51
62
|
files:
|
52
63
|
- .gitignore
|
53
64
|
- Gemfile
|
65
|
+
- README.md
|
54
66
|
- Rakefile
|
55
67
|
- bin/what
|
56
68
|
- example/what.yml
|
@@ -79,17 +91,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
91
|
requirements:
|
80
92
|
- - ">="
|
81
93
|
- !ruby/object:Gem::Version
|
94
|
+
hash: 3
|
95
|
+
segments:
|
96
|
+
- 0
|
82
97
|
version: "0"
|
83
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
99
|
none: false
|
85
100
|
requirements:
|
86
101
|
- - ">="
|
87
102
|
- !ruby/object:Gem::Version
|
103
|
+
hash: 3
|
104
|
+
segments:
|
105
|
+
- 0
|
88
106
|
version: "0"
|
89
107
|
requirements: []
|
90
108
|
|
91
109
|
rubyforge_project: what
|
92
|
-
rubygems_version: 1.5.
|
110
|
+
rubygems_version: 1.5.1
|
93
111
|
signing_key:
|
94
112
|
specification_version: 3
|
95
113
|
summary: Modular server monitoring with JSON endpoint
|