riemann-tools 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -63,13 +63,22 @@ class Riemann::Tools::Diskstats
63
63
 
64
64
  if @old_state
65
65
  state.each do |service, metric|
66
- delta = metric - @old_state[service]
67
66
 
68
- report(
69
- :service => "diskstats " + service,
70
- :metric => (delta.to_f / opts[:interval]),
71
- :state => "ok"
72
- )
67
+ if service =~ /io reqs$/
68
+ report(
69
+ :service => "diskstats " + service,
70
+ :metric => metric,
71
+ :state => "ok"
72
+ )
73
+ else
74
+ delta = metric - @old_state[service]
75
+
76
+ report(
77
+ :service => "diskstats " + service,
78
+ :metric => (delta.to_f / opts[:interval]),
79
+ :state => "ok"
80
+ )
81
+ end
73
82
 
74
83
  if service =~ /io time$/
75
84
  report(:service => "diskstats " + service.gsub(/time/, 'util'),
@@ -11,6 +11,7 @@ class Riemann::Tools::Elasticsearch
11
11
 
12
12
  opt :read_timeout, 'Faraday read timeout', type: :int, default: 2
13
13
  opt :open_timeout, 'Faraday open timeout', type: :int, default: 1
14
+ opt :path_prefix, 'Elasticsearch path prefix for proxied installations e.g. "els" for target http://localhost/els/_cluster/health', default: "/"
14
15
  opt :es_host, 'Elasticsearch host', default: "localhost"
15
16
  opt :es_port, 'Elasticsearch port', type: :int, default: 9200
16
17
 
@@ -36,7 +37,10 @@ class Riemann::Tools::Elasticsearch
36
37
  end
37
38
 
38
39
  def health_url
39
- "http://#{options[:es_host]}:#{options[:es_port]}/_cluster/health"
40
+ path_prefix = options[:path_prefix]
41
+ path_prefix[0] = '' if path_prefix[0]=='/'
42
+ path_prefix[path_prefix.length-1] = '' if path_prefix[path_prefix.length-1]=='/'
43
+ "http://#{options[:es_host]}:#{options[:es_port]}#{path_prefix.length>0?'/':''}#{path_prefix}/_cluster/health"
40
44
  end
41
45
 
42
46
  def tick
@@ -65,6 +65,8 @@ class Riemann::Tools::FreeSWITCH
65
65
  fs_pid = -666
66
66
  end
67
67
 
68
+ fs_threads = fs_pid > 0 ? %x[ps huH p #{fs_pid} | wc -l].to_i : 0
69
+
68
70
  # Submit calls to riemann
69
71
  if fs_calls > @limits[:calls][:critical]
70
72
  alert "FreeSWITCH current calls", :critical, fs_calls, "Number of calls are #{fs_calls}"
@@ -92,6 +94,11 @@ class Riemann::Tools::FreeSWITCH
92
94
  alert "FreeSWITCH current conferences", :ok, fs_conferences, "Number of conferences are #{fs_conferences}"
93
95
  end
94
96
 
97
+ # Submit threads to riemann
98
+ if fs_threads
99
+ alert "FreeSWITCH current threads", :ok, fs_threads, "Number of threads are #{fs_threads}"
100
+ end
101
+
95
102
  # Submit status to riemann
96
103
  if dead_proc?(fs_pid)
97
104
  alert "FreeSWITCH status", :critical, -1, "FreeSWITCH service status: not running"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
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: 2015-04-21 00:00:00.000000000 Z
12
+ date: 2015-07-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: riemann-client