gaddygaddy 0.1.85 → 0.1.86
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gaddygaddy-client/notification/sensu.rb +7 -11
- data/lib/gaddygaddy-client/notification.rb +3 -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: e0d5dfb54a957d0045f0db7052db4d8da9b42964
|
4
|
+
data.tar.gz: eeff741eff969c4cbfde4835e6273389f648c6c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f05de2247d0dac16c8b242bec7217a6455e9aac84f517ca29c7fd4602b088d602c37ebabab5dbf7aee41687d3408038014ac91f010afa9394c8d5b2d239a787
|
7
|
+
data.tar.gz: 082013f33a9a40ed8d700fc930638234417182448f86b53189e16f01c3296bfd185e015abaa9fe101417b59a62ad8c683bb0a5b5c8b271dfc448a92fe8d349b8
|
@@ -22,19 +22,15 @@ module Notification
|
|
22
22
|
# To change this template use File | Settings | File Templates.
|
23
23
|
def self.notify(event, message_text)
|
24
24
|
report = {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
:name => "gaddy_notification",
|
26
|
+
:output => event.to_json,
|
27
|
+
:status => 2,
|
28
|
+
:handler => 'send_event'
|
29
29
|
}
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
s.close
|
35
|
-
rescue Exception => e
|
36
|
-
puts e.message
|
37
|
-
end
|
31
|
+
s = TCPSocket.open(SENSU_HOST, SENSU_PORT)
|
32
|
+
s.print JSON.generate(report)
|
33
|
+
s.close
|
38
34
|
end
|
39
35
|
end
|
40
36
|
end
|
@@ -14,6 +14,7 @@
|
|
14
14
|
#
|
15
15
|
|
16
16
|
require_relative '../logging/logging'
|
17
|
+
require_relative '../utils/retriable'
|
17
18
|
require_relative 'notification/file_notification'
|
18
19
|
require_relative 'notification/espeak'
|
19
20
|
require_relative 'notification/sensu'
|
@@ -23,6 +24,7 @@ require 'i18n'
|
|
23
24
|
module Notification
|
24
25
|
class Send
|
25
26
|
include Logging
|
27
|
+
include Retriable
|
26
28
|
|
27
29
|
def initialize(options = {})
|
28
30
|
I18n.load_path += Dir[File.join(File.dirname(__FILE__), '..','..','locales', '*.yml').to_s]
|
@@ -66,7 +68,7 @@ module Notification
|
|
66
68
|
should_speak = ! Notification::FileNotification.text_in_log_file(message_as_text)
|
67
69
|
Notification::Wall.notify(event, message_as_text)
|
68
70
|
Notification::FileNotification.notify(event, message_as_text)
|
69
|
-
Notification::Sensu.notify(event, message_as_text)
|
71
|
+
with_retries(:limit => 3, :sleep=> 10) {Notification::Sensu.notify(event, message_as_text)}
|
70
72
|
Notification::ESpeakNotification.notify(event, message_as_text) if should_speak && @speech_enabled
|
71
73
|
end
|
72
74
|
end
|