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 +4 -4
- data/CHANGELOG.md +4 -0
- data/bin/handler-elasticsearch.rb +6 -3
- data/lib/sensu-handlers-elasticsearch/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c39adbe4de69c69b698bd7ff69e4d38874480c1
|
4
|
+
data.tar.gz: c04eaee0aba2c5d4865f65c719e0f72c364ca38c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a6bb95af737a2ae3afc58ce17091adf5f3844de6ba4fff300dbbed3797bdfb7c760796ccbc96c63af7e59fe0484bc3a8d77598f213b2d7598f23aa78608e39a
|
7
|
+
data.tar.gz: 4cfc88fd7f2cccf662dabe6fff2d73d2201c4662721998a594a0881ecf7ff2c4261b819ad9fb66f0a062673bfccccc8da39d87d73a80110509ae50bbb117bd91
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
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)
|