riemann-babbler 0.9.9.9 → 1.0.0

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/config.yml CHANGED
@@ -4,6 +4,7 @@ riemann:
4
4
  proto: auto # auto use tcp + udp(max size 16384), tcp - tcp only
5
5
  interval: 60 # update interval for all plugins
6
6
  use_fqdn: true
7
+ test_connect_on_start: true
7
8
 
8
9
  logger:
9
10
  level: DEBUG
@@ -73,7 +73,11 @@ module Riemann
73
73
  def get_hostname
74
74
  # разбор fqdn
75
75
  if options.riemann.use_fqdn.nil? || options.riemann.use_fqdn == false
76
- hostname = File.read('/proc/sys/kernel/hostname').strip.downcase
76
+ if File.exist? '/proc/sys/kernel/hostname'
77
+ hostname = File.read('/proc/sys/kernel/hostname').strip.downcase
78
+ else
79
+ hostname = `hostname`
80
+ end
77
81
  else
78
82
  hostname = Socket.gethostbyname(Socket.gethostname).first
79
83
  end
@@ -0,0 +1,25 @@
1
+ require 'json'
2
+
3
+ class Riemann::Babbler::CloudClients < Riemann::Babbler
4
+
5
+ def init
6
+ plugin.set_default(:service, 'cloud clients')
7
+ plugin.set_default(:interval, 60)
8
+ plugin.set_default(:url, 'http://localhost/client/all')
9
+ end
10
+
11
+ def collect
12
+
13
+ json = JSON.parse rest_get(plugin.url)
14
+ 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
+ ]
23
+ end
24
+
25
+ end
@@ -1,5 +1,5 @@
1
1
  module Riemann
2
2
  class Babbler
3
- VERSION = '0.9.9.9'
3
+ VERSION = '1.0.0'
4
4
  end
5
5
  end
data/lib/start.rb CHANGED
@@ -120,7 +120,7 @@ class Riemann::Babbler::Starter
120
120
  :port => config.riemann.port
121
121
  )
122
122
  riemann = ( config.riemann.proto == 'tcp' ) ? riemann.tcp : riemann
123
- riemann.connect
123
+ riemann.connect if config.test_connect_on_start
124
124
  rescue
125
125
  logger.fatal "Can't resolv or connect to riemann host: #{config.riemann.host}"
126
126
  sleep 5
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.9
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-28 00:00:00.000000000 Z
12
+ date: 2013-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: riemann-client
@@ -157,6 +157,7 @@ files:
157
157
  - bin/riemann-babbler
158
158
  - config.yml
159
159
  - lib/riemann/babbler/plugin.rb
160
+ - lib/riemann/babbler/plugins/cloudclients.rb
160
161
  - lib/riemann/babbler/plugins/cpu.rb
161
162
  - lib/riemann/babbler/plugins/cpufan.rb
162
163
  - lib/riemann/babbler/plugins/cputemp.rb