riemann-babbler 0.9.9.8 → 0.9.9.8.1

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.
data/.gitignore CHANGED
@@ -1,2 +1,4 @@
1
1
  pkg/
2
2
  .idea
3
+ .rvmrc
4
+ *.swp
data/bin/riemann-babbler CHANGED
File without changes
@@ -0,0 +1,37 @@
1
+ class Riemann::Babbler::Http < Riemann::Babbler
2
+
3
+ def init
4
+ plugin.set_default(:service, 'http check')
5
+ plugin.set_default(:interval, 60)
6
+
7
+ plugin.states.set_default(:critical, 1)
8
+
9
+ plugin.set_default(:http_code, 200)
10
+ plugin.set_default(:http_method, 'GET')
11
+ plugin.set_default(:connect_timeout, 5)
12
+ plugin.set_default(:retry, 0)
13
+ plugin.set_default(:retry_delay, 0)
14
+ plugin.set_default(:max_time, 10)
15
+
16
+ plugin.set_default(:url, 'http://127.0.0.1:80')
17
+ end
18
+
19
+ def collect
20
+ command = "curl -X#{plugin.http_method} -s"
21
+ command += " --connect-timeout #{plugin.connect_timeout}"
22
+ command += " -w '%{http_code}\\n'"
23
+ command += " --retry #{plugin.retry} --retry-delay #{plugin.retry_delay}"
24
+ command += " --max-time #{plugin.max_time} --fail"
25
+ command += " #{plugin.url} -o /dev/null"
26
+
27
+ out = shell(command)
28
+
29
+ if out.to_i != plugin.http_code
30
+ metric = 1
31
+ else
32
+ metric = 0
33
+ end
34
+
35
+ {:service => plugin.service, :metric => metric, :description => "http_code: #{out}"}
36
+ end
37
+ end
@@ -1,5 +1,5 @@
1
1
  module Riemann
2
2
  class Babbler
3
- VERSION = '0.9.9.8'
3
+ VERSION = '0.9.9.8.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-babbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9.8
4
+ version: 0.9.9.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -163,6 +163,7 @@ files:
163
163
  - lib/riemann/babbler/plugins/disk.rb
164
164
  - lib/riemann/babbler/plugins/dummy.rb
165
165
  - lib/riemann/babbler/plugins/exim4.rb
166
+ - lib/riemann/babbler/plugins/http.rb
166
167
  - lib/riemann/babbler/plugins/la.rb
167
168
  - lib/riemann/babbler/plugins/mdadm.rb
168
169
  - lib/riemann/babbler/plugins/megacli.rb