riemann-babbler 1.0.0 → 1.0.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.
@@ -1,6 +1,6 @@
1
1
  require 'json'
2
2
 
3
- class Riemann::Babbler::CloudClients < Riemann::Babbler
3
+ class Riemann::Babbler::Cloudclients < Riemann::Babbler
4
4
 
5
5
  def init
6
6
  plugin.set_default(:service, 'cloud clients')
@@ -9,17 +9,10 @@ class Riemann::Babbler::CloudClients < Riemann::Babbler
9
9
  end
10
10
 
11
11
  def collect
12
-
13
- json = JSON.parse rest_get(plugin.url)
14
12
  clients = 0
15
-
16
- json.each do |client|
17
- client["state"] == "ESTABLISHED" ? clients += 1
18
- end
19
-
20
- [
21
- {:service => plugin.service + " ESTABLISHED state", :description => "online clients in #{plugin.url}", :metric => clients, :state => 'ok' }
22
- ]
13
+ json = JSON.parse rest_get(plugin.url)
14
+ json.each { |client| clients += 1 if client[1]["state"] == "ESTABLISHED" }
15
+ {:service => plugin.service + " established", :description => "online clients in #{plugin.url}", :metric => clients, :state => 'ok' }
23
16
  end
24
17
 
25
18
  end
@@ -20,7 +20,7 @@ class Riemann::Babbler::Panels < Riemann::Babbler
20
20
 
21
21
  [
22
22
  {:service => plugin.service + " online", :description => "online panels in #{plugin.url}", :metric => good, :state => 'ok' },
23
- {:service => plugin.service + " offline", :description => "offline panels in #{plugin.url}", :metric => bad }
23
+ {:service => plugin.service + " offline", :description => "all panels in #{plugin.url}", :metric => bad + good, :state => 'ok' }
24
24
  ]
25
25
  end
26
26
 
@@ -0,0 +1,19 @@
1
+ require 'json'
2
+
3
+ class Riemann::Babbler::Selfupdate < Riemann::Babbler
4
+
5
+ def init
6
+ plugin.set_default(:service, 'self update')
7
+ plugin.set_default(:file, '/var/run/status')
8
+ end
9
+
10
+ def collect
11
+ json = JSON.parse File.read(plugin.url)
12
+ if json["status"] == "ok"
13
+ {:service => plugin.service, :description => "Self update status in #{plugin.file}, state: OK", :metric => 1, :state => 'ok' }
14
+ else
15
+ {:service => plugin.service, :description => "Self update status in #{plugin.file}, state: #{state['status']}, code: #{state['code']}", :metric => 0, :state => 'critical' }
16
+ end
17
+ end
18
+
19
+ end
@@ -1,5 +1,5 @@
1
1
  module Riemann
2
2
  class Babbler
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.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: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -174,6 +174,7 @@ files:
174
174
  - lib/riemann/babbler/plugins/nginx.rb
175
175
  - lib/riemann/babbler/plugins/panels.rb
176
176
  - lib/riemann/babbler/plugins/runit.rb
177
+ - lib/riemann/babbler/plugins/selfupdate.rb
177
178
  - lib/riemann/babbler/support/deep_merge.rb
178
179
  - lib/riemann/babbler/support/monkey_patches.rb
179
180
  - lib/riemann/babbler/support/plugin_helpers.rb