what 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/what/modules/http.rb +33 -0
- data/lib/what/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7547e3ff15bde71d6ea54f59868e2b124607b31
|
4
|
+
data.tar.gz: 2185de6ea7439e8f42194fa7b02ca50c88f61044
|
5
5
|
!binary "U0hBNTEy":
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f0b2654728e3e86043c8597f365867c0d822c49a0f0731b2f9b6de35a906df0956e99aec2938603de012b2214e39d1741e095e750bca57ef38a3ba63c42add2
|
7
|
+
data.tar.gz: f1b70e9215cb2e340211c2274ee59704c2080ff14c6d4e3079a1722a45b8ebec89df4c6746863616116611b75370355f3edb900fbcf169f852e1786df8b35fae
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
module What
|
4
|
+
class Modules::Http < Modules::Base
|
5
|
+
def initialize_module
|
6
|
+
@url = URI.parse @config['url']
|
7
|
+
@expect = @config['expect'].strip if @config['expect']
|
8
|
+
|
9
|
+
@status = -1
|
10
|
+
@body = ''
|
11
|
+
end
|
12
|
+
|
13
|
+
def check
|
14
|
+
resp = Net::HTTP.get_response(@url)
|
15
|
+
@status = resp.code.to_i
|
16
|
+
@body = resp.body.strip
|
17
|
+
end
|
18
|
+
|
19
|
+
def health
|
20
|
+
if @status != 200
|
21
|
+
'alert'
|
22
|
+
elsif @expect && @expect != @body
|
23
|
+
'alert'
|
24
|
+
else
|
25
|
+
'ok'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def details
|
30
|
+
{ 'status' => @status, 'last_response' => @body[0..200] }
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/what/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: what
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Fitzgerald
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/what/modules/base.rb
|
96
96
|
- lib/what/modules/disk.rb
|
97
97
|
- lib/what/modules/existence.rb
|
98
|
+
- lib/what/modules/http.rb
|
98
99
|
- lib/what/modules/memory.rb
|
99
100
|
- lib/what/modules/process.rb
|
100
101
|
- lib/what/modules/unicorn.rb
|