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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
- metadata.gz: 96f3b91d61bb7a68a690acf38401504339a12c88
4
- data.tar.gz: d131acd36708a8d4065dd385c18b7ba44025dfd5
3
+ metadata.gz: b7547e3ff15bde71d6ea54f59868e2b124607b31
4
+ data.tar.gz: 2185de6ea7439e8f42194fa7b02ca50c88f61044
5
5
  !binary "U0hBNTEy":
6
- metadata.gz: ac945b2c71cc2ae3941597756921169cb7389fa871b556d3716075ad73762bfa4f47a0dbfc2e54ea5af783af861d3af101fd79e708fc14ebe2aef830c6601c40
7
- data.tar.gz: 42087da9046c443e15e05ccbe7549139637123f82a4a7394704846e07d4aca4bb42ed52cf5e3374ed1910ddaa2e502116aa4b288fce544d30b4b1413a9229aff
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
@@ -1,3 +1,3 @@
1
1
  module What
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
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
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