sensu-handlers-elasticsearch 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8c53ed56f1fecf8a05e55f036f3425eae261cc5
4
- data.tar.gz: 7eb1d47a3b87409106c1503fe664f5427496db62
3
+ metadata.gz: 8c39adbe4de69c69b698bd7ff69e4d38874480c1
4
+ data.tar.gz: c04eaee0aba2c5d4865f65c719e0f72c364ca38c
5
5
  SHA512:
6
- metadata.gz: 3cbffd39de1acd9fc647d9544190a67d35fbadf9d67b6b823e47d4cb0c984c7dfa9437b1348e54dbefa22c8f8f1c5e9950e49f0e0bfb676f21a717d5d755d1fd
7
- data.tar.gz: 954497f91c1b33ba16be9f42c59e4fd2fdc93f15b79effa0cfdfc0a71d8a6448343db7c4f5cf5485a9ad379ce4f70756d13e3728b803b8ad3c67006fa32daf70
6
+ metadata.gz: 9a6bb95af737a2ae3afc58ce17091adf5f3844de6ba4fff300dbbed3797bdfb7c760796ccbc96c63af7e59fe0484bc3a8d77598f213b2d7598f23aa78608e39a
7
+ data.tar.gz: 4cfc88fd7f2cccf662dabe6fff2d73d2201c4662721998a594a0881ecf7ff2c4261b819ad9fb66f0a062673bfccccc8da39d87d73a80110509ae50bbb117bd91
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## Unreleased
7
7
 
8
+ ## [0.0.2] - 2016-01-12
9
+ ### Added
10
+ - Adding support for date interpolation in the ES index
11
+
8
12
  ## [0.0.1] - 2016-01-12
9
13
  ### Added
10
14
  - Initial release
@@ -16,10 +16,10 @@ class HandlerElasticsearch < Sensu::Handler
16
16
  :default => "http://localhost:9200"
17
17
 
18
18
  option :index,
19
- :description => "Elasticsearch index (default: sensu)",
19
+ :description => "Elasticsearch index (default: sensu-%{Y}.%{m}.%{d})",
20
20
  :short => "-i <INDEX>",
21
21
  :long => "--index <INDEX>",
22
- :default => "sensu"
22
+ :default => "sensu-%{Y}.%{m}.%{d}"
23
23
 
24
24
  option :type,
25
25
  :description => "Elasticsearch index type (default: handler)",
@@ -46,7 +46,10 @@ class HandlerElasticsearch < Sensu::Handler
46
46
  }
47
47
  }
48
48
 
49
- uri = URI("#{config[:url]}/#{config[:index]}/#{config[:type]}/#{@event['id']}")
49
+ # interpolate %Y, %m and %d with today's date
50
+ index = config[:index] % {:Y => Time.now.year, :m => Time.now.month, :d => Time.now.day}
51
+
52
+ uri = URI("#{config[:url]}/#{index}/#{config[:type]}/#{@event['id']}")
50
53
  http = Net::HTTP.new(uri.host, uri.port)
51
54
  request = Net::HTTP::Post.new(uri.path, "Content-Type" => "application/json")
52
55
  request.body = JSON.dump(event)
@@ -2,7 +2,7 @@ module SensuHandlersElasticsearch
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 1
5
+ PATCH = 2
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-handlers-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Cerutti