riemann-elasticsearch 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/riemann-elasticsearch +37 -0
  3. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 491ca44659943eebc94c4eaa056480a4e7021cef
4
- data.tar.gz: d1856d1eadb18e55bb1080ccd1bb0b3590f6560d
3
+ metadata.gz: a150bc9f0e28b4a26dd6c0a897bfb3d1a484c42c
4
+ data.tar.gz: 21cbd6c24b3fb27157300760755fee7373b4d274
5
5
  SHA512:
6
- metadata.gz: e90efda09605d6b06cb64c0ed5555fea9a21ee74e547cf6e43e4339d71deb136a9e5a9ad6eaeeb94ce720d5b3795195c88b0b581f4bf02be41bcdba9bba2f88d
7
- data.tar.gz: 6938d042d812cf60f15180574281a75f1745899b264aa26596e89d9ec2c4aed89612a8f4ae67943c1315709e827881b7c50e1365a4a9880bbf315377b5b222f9
6
+ metadata.gz: a79cbb77d1f89e5419d7393e40335dba5635ea3a5f0bcaebd4d56f51a056bfed18714b3bd26e925cfaf2f1f9cca42aa8f181534113d493f62de64f5191c8953b
7
+ data.tar.gz: b91194acde151ebdbd02eaa4ed2303a3192291af66459b7ec0812ba8d0c14380eae53693da576c2264f6c143d208dd6c50c23764c1a893066facec0f457d023e
@@ -42,7 +42,44 @@ class Riemann::Tools::Elasticsearch
42
42
  "http://#{options[:es_host]}:#{options[:es_port]}#{path_prefix.length>0?'/':''}#{path_prefix}/_cluster/health"
43
43
  end
44
44
 
45
+ def indices_url
46
+ path_prefix = options[:path_prefix]
47
+ path_prefix[0] = '' if path_prefix[0]=='/'
48
+ path_prefix[path_prefix.length-1] = '' if path_prefix[path_prefix.length-1]=='/'
49
+ "http://#{options[:es_host]}:#{options[:es_port]}#{path_prefix.length>0?'/':''}#{path_prefix}/_stats/index,store"
50
+ end
51
+
52
+ def tick_indices
53
+ uri = URI(indices_url)
54
+ response = safe_get(uri)
55
+
56
+ return if response.nil?
57
+
58
+ if response.status != 200
59
+ report(:host => uri.host,
60
+ :service => "elasticsearch health",
61
+ :state => "critical",
62
+ :description => "HTTP connection error: #{response.status} - #{response.body}"
63
+ )
64
+ else
65
+ # Assuming that a 200 will give json
66
+ json = JSON.parse(response.body)
67
+
68
+ json["indices"].each_pair do |k,v|
69
+ report(:host => uri.host,
70
+ :service => "elasticsearch index/#{k}/primaries/size_in_bytes",
71
+ :metric => v["primaries"]["store"]["size_in_bytes"]
72
+ )
73
+ report(:host => uri.host,
74
+ :service => "elasticsearch index/#{k}/total/size_in_bytes",
75
+ :metric => v["total"]["store"]["size_in_bytes"]
76
+ )
77
+ end
78
+ end
79
+ end
80
+
45
81
  def tick
82
+ tick_indices
46
83
  uri = URI(health_url)
47
84
  response = safe_get(uri)
48
85
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Sandie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-21 00:00:00.000000000 Z
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riemann-tools
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.7
19
+ version: 0.2.8
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.7
26
+ version: 0.2.8
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -62,8 +62,9 @@ files:
62
62
  - LICENSE
63
63
  - README.md
64
64
  - bin/riemann-elasticsearch
65
- homepage: https://github.com/riemann/riemann-elasticsearch
66
- licenses: []
65
+ homepage: https://github.com/riemann/riemann-tools
66
+ licenses:
67
+ - MIT
67
68
  metadata: {}
68
69
  post_install_message:
69
70
  rdoc_options: []