alerty 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/alerty.gemspec +1 -1
- data/lib/alerty/command.rb +10 -8
- 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: ed50701fa9c60c4eeb6a23f0d95cac72949d1274
|
4
|
+
data.tar.gz: 98656e48c9a30c688340ce1c24b2293aff3893da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d67e7c6ba8a66a28b2de8d464d3a429fb10b1b6694e0957b5adf4eb85841b977c369538d4a189dc852e42ac999b6500556cb1fc0c3a8687d4e8d399ce0b9d32
|
7
|
+
data.tar.gz: e3c3ba190183bfff89960a8b0391f163735334ec842afed46081f1932d49d770c838bd782f8b7d86e163eea9a8f043c4cf20a991bb02a77b3fbeda6015781a1e
|
data/CHANGELOG.md
CHANGED
data/alerty.gemspec
CHANGED
data/lib/alerty/command.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'frontkick'
|
2
2
|
require 'socket'
|
3
|
+
require 'json'
|
3
4
|
|
4
5
|
class Alerty
|
5
6
|
class Command
|
@@ -12,17 +13,18 @@ class Alerty
|
|
12
13
|
def run!
|
13
14
|
started_at = Time.now
|
14
15
|
result = Frontkick.exec("#{@command} 2>&1", @opts)
|
16
|
+
record = {
|
17
|
+
hostname: @hostname,
|
18
|
+
command: @command,
|
19
|
+
exitstatus: result.exitstatus,
|
20
|
+
output: result.stdout,
|
21
|
+
started_at: started_at.to_f,
|
22
|
+
duration: result.duration,
|
23
|
+
}
|
24
|
+
Alerty.logger.info { "result: #{record.to_json}" }
|
15
25
|
if result.success?
|
16
26
|
exit 0
|
17
27
|
else
|
18
|
-
record = {
|
19
|
-
hostname: @hostname,
|
20
|
-
command: @command,
|
21
|
-
exitstatus: result.exitstatus,
|
22
|
-
output: result.stdout,
|
23
|
-
started_at: started_at.to_f,
|
24
|
-
duration: result.duration,
|
25
|
-
}
|
26
28
|
Config.plugins.each do |plugin|
|
27
29
|
begin
|
28
30
|
plugin.alert(record)
|