notifu 1.5.2 → 1.5.3

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: 2aa5507b0ffeed3526ade6f22cb7200953cdeb76
4
- data.tar.gz: c443dab0b7ef7903e8c15d1e1666a02a3a3ec197
3
+ metadata.gz: f92de92fa8ed5338a3a54546f11e62cf02982df2
4
+ data.tar.gz: a70a4ba335761cf875d6612f8cbdd7779026aee8
5
5
  SHA512:
6
- metadata.gz: 6867a6a1334b0309b86000c8a13ca374102fa3f206ffadb16a3dd92fee34f04f749599d61685ec236ad38b3a8e6aeac7cad7957b4b3cdee124ec35baa52d1fa4
7
- data.tar.gz: 636abd755c1d221051dea74f2e9821be9d251d8aa1783b6d841673025de6d6c64b1ef901224ffaf80b78d2e9a29ca3d966cb0a3063ca6cb689a705e99d90cef6
6
+ metadata.gz: a253fc18bdfdffc429cf0bdcc754b7fc62f2d772f63836b13c7246bf7a1f2de7adf55fcb0b18cf2ef21d48c89f0a59036db101d2bebdd69c57e777b0009932ac
7
+ data.tar.gz: 0145b469d863bed91589af43da48b5c7af7b472685e60455065eed0c20c144381574bb01ddb8c5e9d9d8e0f41f589507d7882574c9888ac515e3a40eb41fac86
@@ -15,22 +15,52 @@ module Notifu
15
15
 
16
16
  def post_data
17
17
  {
18
- text: self.text,
19
18
  username: "notifu",
20
- icon_emoji: self.emoji
19
+ icon_emoji: ":loudspeaker:",
20
+ attachments: [
21
+ {
22
+ fallback: self.text,
23
+ color: self.color,
24
+ title: "#{self.issue.host} - #{self.issue.service}",
25
+ title_link: "https://sensu.skypicker.com/#/client/#{Notifu::CONFIG[:actors][:slack][:dc]}/#{self.issue.host}?check=#{self.issue.service}",
26
+ text: self.issue.message,
27
+ fields: [
28
+ {
29
+ title: "duration",
30
+ value: (Time.now.to_i - self.issue.time_created.to_i).duration,
31
+ short: true
32
+ },
33
+ {
34
+ title: "started",
35
+ value: Time.at(self.issue.time_created.to_i),
36
+ short: true
37
+ },
38
+ {
39
+ title: "occurrences/trigger",
40
+ value: "#{self.issue.occurrences_count}/#{self.issue.occurrences_trigger}",
41
+ short: true
42
+ },
43
+ {
44
+ title: "notifu ID",
45
+ value: self.issue.notifu_id,
46
+ short: true
47
+ }
48
+ ]
49
+ }
50
+ ]
21
51
  }.to_json
22
52
  end
23
53
 
24
- def emoji
54
+ def color
25
55
  case self.issue.code
26
56
  when 0
27
- ":happy_obama:"
57
+ "good"
28
58
  when 1
29
- ":sad_obama:"
59
+ "warning"
30
60
  when 2
31
- ":surprised_obama:"
61
+ "danger"
32
62
  else
33
- ":obama_mic_drop:"
63
+ "#999999"
34
64
  end
35
65
  end
36
66
 
@@ -55,6 +55,6 @@ module Notifu
55
55
  end
56
56
 
57
57
  # load all actors
58
- Dir[File.dirname(__FILE__).sub(/\/lib\/workers$/, "/") + 'actors/*.rb'].each do |file|
58
+ Dir[File.dirname(__FILE__).sub(/\/workers$/, "/") + 'actors/*.rb'].each do |file|
59
59
  require file
60
60
  end
data/lib/notifu.rb CHANGED
@@ -6,6 +6,7 @@ require "notifu/mixins"
6
6
  require "notifu/util"
7
7
  require "notifu/config"
8
8
  require "notifu/logger"
9
+ require "notifu/model"
9
10
  require "notifu/model/contact"
10
11
  require "notifu/model/event"
11
12
  require "notifu/model/group"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notifu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Radek 'blufor' Slavicinsky