sensu-plugins-elasticsearch 0.4.0 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7cd67baf0aee4b5113c8168a5ab1497825578e3
4
- data.tar.gz: f68dcbde8239e84eb7bd7a2ff6a4749a4229ebbd
3
+ metadata.gz: 9fd8010eda690389a21ef9f1b9704b8803bbfd8b
4
+ data.tar.gz: 9272fcbaa1ed975af17b3639aaee86a396d181f0
5
5
  SHA512:
6
- metadata.gz: 738b0414e12bf04a69d85a82cf6cb7c01e3183030b850636d2a1181eff66d9786c8a4599b3286b1ed83c1a6524ee63cb2af86505b72b13409255ee719143b61a
7
- data.tar.gz: 71695dab68c8fea9b76bbabab4d97b532871069eea58eef198dee4c0bc73b893d1dc5b4ee0ac28f26d6435623897318490e498d0fd37fe57dda138eaa9905b4d
6
+ metadata.gz: 9e2580830a11b829a518cfa81e8e51c208bd64d6b747e0ebd3692b31ab71f0fb7cd36e2f4692bcbf2a9d6771f41ee09df802537a5981a4f86363e532c3f174ce
7
+ data.tar.gz: e760023498bf149017232302fa6b54e9409bdbceb1516ea2e4c9da7e048db1725e8b22789c0f5450b604a0b45b50171e47474ae24e460ff6e26389ac12ffc8f3
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## [0.4.1] - 2016-01-26
9
+ ### Fixed
10
+ - metrics-es-cluster.rb: Allow metrics to be gathered even if the cluster has zero documents. Also updated cache name for Elasticsearch 2.0+
11
+ - metrics-es-node-graphite.rb: Update node stats for Elasticsearch 2.0+
12
+
8
13
  ## [0.4.0] - 2016-01-22
9
14
  ### Added
10
15
  - metrics-es-node-graphite.rb: Added file system and cpu stats
@@ -122,7 +122,12 @@ class ESClusterMetrics < Sensu::Plugin::Metric::CLI::Graphite
122
122
 
123
123
  def acquire_document_count
124
124
  document_count = get_es_resource('/_stats/docs')
125
- document_count['_all']['total']['docs']['count']
125
+ count = document_count['_all']['total']
126
+ if count.empty?
127
+ return 0
128
+ else
129
+ return count['docs']['count']
130
+ end
126
131
  end
127
132
 
128
133
  def acquire_cluster_metrics
@@ -133,9 +138,14 @@ class ESClusterMetrics < Sensu::Plugin::Metric::CLI::Graphite
133
138
  cluster_metrics['fs']['store_in_bytes'] = cluster_stats['indices']['store']['size_in_bytes']
134
139
  cluster_metrics['fielddata']['memory_size_in_bytes'] = cluster_stats['indices']['fielddata']['memory_size_in_bytes']
135
140
  cluster_metrics['fielddata']['evictions'] = cluster_stats['indices']['fielddata']['evictions']
136
- cluster_metrics['filter_cache']['memory_size_in_bytes'] = cluster_stats['indices']['filter_cache']['memory_size_in_bytes']
137
- cluster_metrics['filter_cache']['evictions'] = cluster_stats['indices']['filter_cache']['evictions']
141
+
142
+ # Elasticsearch changed the name filter_cache to query_cache in 2.0+
143
+ cache_name = Gem::Version.new(acquire_es_version) < Gem::Version.new('2.0.0') ? 'filter_cache' : 'query_cache'
144
+
145
+ cluster_metrics[cache_name]['memory_size_in_bytes'] = cluster_stats['indices'][cache_name]['memory_size_in_bytes']
146
+ cluster_metrics[cache_name]['evictions'] = cluster_stats['indices'][cache_name]['evictions']
138
147
  cluster_metrics['mem'] = cluster_stats['nodes']['jvm']['mem']
148
+
139
149
  if config[:enable_percolate]
140
150
  cluster_metrics['percolate']['total'] = cluster_stats['indices']['percolate']['total']
141
151
  cluster_metrics['percolate']['time_in_millis'] = cluster_stats['indices']['percolate']['time_in_millis']
@@ -146,7 +156,12 @@ class ESClusterMetrics < Sensu::Plugin::Metric::CLI::Graphite
146
156
 
147
157
  def acquire_allocation_status
148
158
  cluster_config = get_es_resource('/_cluster/settings')
149
- %w(none new_primaries primaries all).index(cluster_config['transient']['cluster']['routing']['allocation']['enable'])
159
+ transient_settings = cluster_config['transient']
160
+ if transient_settings.empty?
161
+ return nil
162
+ else
163
+ return %w(none new_primaries primaries all).index(transient_settings['cluster']['routing']['allocation']['enable'])
164
+ end
150
165
  end
151
166
 
152
167
  def run
@@ -160,7 +175,7 @@ class ESClusterMetrics < Sensu::Plugin::Metric::CLI::Graphite
160
175
  end
161
176
  end
162
177
  output(config[:scheme] + '.document_count', acquire_document_count)
163
- output(config[:scheme] + '.allocation_status', acquire_allocation_status)
178
+ output(config[:scheme] + '.allocation_status', acquire_allocation_status) unless acquire_allocation_status.nil?
164
179
  end
165
180
  ok
166
181
  end
@@ -182,20 +182,19 @@ class ESNodeGraphiteMetrics < Sensu::Plugin::Metric::CLI::Graphite
182
182
  metrics['os.load_average.1'] = node['os']['load_average'][0]
183
183
  metrics['os.load_average.5'] = node['os']['load_average'][1]
184
184
  metrics['os.load_average.15'] = node['os']['load_average'][2]
185
+ metrics['os.cpu.sys'] = node['os']['cpu']['sys']
186
+ metrics['os.cpu.user'] = node['os']['cpu']['user']
187
+ metrics['os.cpu.idle'] = node['os']['cpu']['idle']
188
+ metrics['os.cpu.usage'] = node['os']['cpu']['usage']
189
+ metrics['os.cpu.stolen'] = node['os']['cpu']['stolen']
190
+ metrics['os.uptime'] = node['os']['uptime_in_millis']
185
191
  end
186
192
  metrics['os.mem.free_in_bytes'] = node['os']['mem']['free_in_bytes']
187
- # ... Process uptime in millis?
188
- metrics['os.uptime'] = node['os']['uptime_in_millis'] if node['os']['uptime_in_millis']
189
-
190
- metrics['os.cpu.sys'] = node['os']['cpu']['sys']
191
- metrics['os.cpu.user'] = node['os']['cpu']['user']
192
- metrics['os.cpu.idle'] = node['os']['cpu']['idle']
193
- metrics['os.cpu.usage'] = node['os']['cpu']['usage']
194
- metrics['os.cpu.stolen'] = node['os']['cpu']['stolen']
195
193
  end
196
194
 
197
195
  if process_stats
198
- metrics['process.mem.resident_in_bytes'] = node['process']['mem']['resident_in_bytes']
196
+ metrics['process.cpu.percent'] = node['process']['cpu']['percent']
197
+ metrics['process.mem.resident_in_bytes'] = node['process']['mem']['resident_in_bytes'] if node['process']['mem']['resident_in_bytes']
199
198
  end
200
199
 
201
200
  if jvm_stats
@@ -2,7 +2,7 @@ module SensuPluginsElasticsearch
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- PATCH = 0
5
+ PATCH = 1
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu Plugins and contributors
@@ -30,7 +30,7 @@ cert_chain:
30
30
  8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
31
  HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
32
  -----END CERTIFICATE-----
33
- date: 2016-01-22 00:00:00.000000000 Z
33
+ date: 2016-01-26 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rest-client
metadata.gz.sig CHANGED
@@ -1,3 +1 @@
1
- }��L�h�?��E*������Mp]7Ϣ3Ukڎ)r�-�Bbo��r(������R��הdlM]:cj>��C��R�Ő��ƇY��1y>#@H��~3R���5������L�X���*~���Bΰi
2
- ΋��9��0T�DC�9���0����Sx<B��!Eup���� ���,ٓ�8� H�V֕�H�q���\��k�U�f��B�ؔ��5�NׇG
3
- 'J,ԋ�O�R����Vw��-@
1
+ �?��H�|w�eO!ɹ�}���X$��>���u���_��I�撸~TȏXCG_����]h/q(P�����<X6sTD{��5Vv����O�:yepIQ;LȻ����qO��}�z������_*�+��?Is7���>Ǵlz��Z2]��]4�o����}��U˦�� ���o%�t�5�/�4</�J�.�Z��f�J.���ʽ�H0u�F��]G�,\�O�&�X�k*��u�a2����ʤ`F�A���{l