steto 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/steto/base_check.rb +5 -0
- data/lib/steto/proc_check.rb +4 -2
- data/lib/steto/version.rb +1 -1
- data/lib/steto.rb +1 -0
- data/spec/steto/base_check_spec.rb +30 -0
- data/spec/steto/proc_check_spec.rb +2 -1
- data/steto.gemspec +1 -0
- metadata +20 -4
data/lib/steto/base_check.rb
CHANGED
data/lib/steto/proc_check.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
module Steto
|
2
2
|
class ProcCheck < BaseCheck
|
3
3
|
|
4
|
+
attr_accessor :block
|
5
|
+
|
4
6
|
def initialize(attributes = {}, &block)
|
5
7
|
self.attributes = attributes
|
6
|
-
|
8
|
+
self.block = block
|
7
9
|
end
|
8
10
|
|
9
11
|
def check
|
10
|
-
self.status = status_from_response(
|
12
|
+
self.status = status_from_response(block.call)
|
11
13
|
end
|
12
14
|
|
13
15
|
def status_from_response(response)
|
data/lib/steto/version.rb
CHANGED
data/lib/steto.rb
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Steto::BaseCheck do
|
4
|
+
|
5
|
+
subject do
|
6
|
+
Steto::BaseCheck.new.tap do |check|
|
7
|
+
check.stub :check
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#to_json" do
|
12
|
+
|
13
|
+
it "should include name" do
|
14
|
+
subject.name = "dummy"
|
15
|
+
JSON.parse(subject.to_json).should include("name" => "dummy")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should include text" do
|
19
|
+
subject.text = "dummy"
|
20
|
+
JSON.parse(subject.to_json).should include("text" => "dummy")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should include status" do
|
24
|
+
subject.status = :critical
|
25
|
+
JSON.parse(subject.to_json).should include("status" => "critical")
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -2,6 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Steto::ProcCheck do
|
4
4
|
|
5
|
+
subject { Steto::ProcCheck.new { true } }
|
6
|
+
|
5
7
|
describe "#status_from_response" do
|
6
8
|
|
7
9
|
it "should return ok when response is true" do
|
@@ -25,6 +27,5 @@ describe Steto::ProcCheck do
|
|
25
27
|
end
|
26
28
|
|
27
29
|
end
|
28
|
-
|
29
30
|
|
30
31
|
end
|
data/steto.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alban Peignier
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-06-
|
19
|
+
date: 2012-06-07 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
prerelease: false
|
@@ -102,6 +102,20 @@ dependencies:
|
|
102
102
|
version: "0"
|
103
103
|
name: parallel
|
104
104
|
version_requirements: *id006
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
prerelease: false
|
107
|
+
type: :runtime
|
108
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
hash: 3
|
114
|
+
segments:
|
115
|
+
- 0
|
116
|
+
version: "0"
|
117
|
+
name: json
|
118
|
+
version_requirements: *id007
|
105
119
|
description: Ruby engine to check system status (with Nagios or custom checks)
|
106
120
|
email:
|
107
121
|
- alban@tryphon.eu
|
@@ -133,6 +147,7 @@ files:
|
|
133
147
|
- lib/steto/status.rb
|
134
148
|
- lib/steto/version.rb
|
135
149
|
- spec/spec_helper.rb
|
150
|
+
- spec/steto/base_check_spec.rb
|
136
151
|
- spec/steto/beep_reporter_spec.rb
|
137
152
|
- spec/steto/config_spec.rb
|
138
153
|
- spec/steto/engine_spec.rb
|
@@ -175,6 +190,7 @@ specification_version: 3
|
|
175
190
|
summary: Check system status
|
176
191
|
test_files:
|
177
192
|
- spec/spec_helper.rb
|
193
|
+
- spec/steto/base_check_spec.rb
|
178
194
|
- spec/steto/beep_reporter_spec.rb
|
179
195
|
- spec/steto/config_spec.rb
|
180
196
|
- spec/steto/engine_spec.rb
|