alerty-plugin-datadog_event 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e4a53b3496783042d745768feb1843aadf71c82
4
- data.tar.gz: 684f3eb6956d7c93707b60022add0045c62a1125
3
+ metadata.gz: 1f6f37d2ede15b4d93920d7e006af6eec5bf8a73
4
+ data.tar.gz: 6fe8c620b23ccb547b2732bb90cbf029a4872805
5
5
  SHA512:
6
- metadata.gz: 485ee68fb36399d8acbed8028b1edfdf7889e9a5895a884ba70f6030936760a3a5ecfd893739ff849d85443728be1b54e4973c2990fe62d661aeb8d05d0078af
7
- data.tar.gz: 0cb578d82e698a6336aa9cc149e3a549d4dc1f45c6e92ce8e2fadeb0b9b89d438c52dbc635157ec8f184cb7967bb86502918701190eeb1e80f67cd5cb88268f2
6
+ metadata.gz: 544d9e1fdf2d6094c9609300a7a8f29bcfdefb6a9952d9c2c3b52c0108d1f6af5a71b65a5937700daaa117edeec3ed75ea1435c6a2bbb4a9fa4edf7a52e8243f
7
+ data.tar.gz: c29c17c2892df522701003b1fda973f2f11b38373ac3a57b9ccf64f00a6e58749d79a1e9723732fa1eba07580d50da6789bcc345e41e6c1f82dd5f01b268ae91
data/README.md CHANGED
@@ -22,9 +22,11 @@ Or install it yourself as:
22
22
 
23
23
  following is required.
24
24
 
25
- - type: must be datadog_event
26
- - api_key: Datadog API Key
27
- - subject: subject of alert. ${command} is replaced with a given command, ${hostname} is replaced with the hostname ran a command
25
+ - **type** : must be datadog_event
26
+ - **api_key** : Datadog API Key
27
+ - **subject** : subject of alert. ${command} is replaced with a given command, ${hostname} is replaced with the hostname ran a command
28
+ - **alert_type** : "error", "warning", "info" or "success". See [Datadog API Document](http://docs.datadoghq.com/ja/api/#events).
29
+ - **source_type_name** : The type of event being posted. See [Datadog API Document](http://docs.datadoghq.com/ja/api/#events).
28
30
 
29
31
  following is an example.
30
32
 
@@ -37,6 +39,8 @@ plugins:
37
39
  - type: datadog_event
38
40
  api_key: API Key
39
41
  subject: "FAILURE [${hostname}] : ${command}"
42
+ subject: "FAILURE [${hostname}] : ${command}"
43
+ subject: "FAILURE [${hostname}] : ${command}"
40
44
  ```
41
45
 
42
46
  See [examle.yml](https://github.com/inokappa/alerty-plugin-datadog_event/blob/master/example.yml).
data/example.yml CHANGED
@@ -6,3 +6,5 @@ plugins:
6
6
  - type: datadog_event
7
7
  api_key: API_KEY
8
8
  subject: "FAILURE [${hostname}] : ${command}"
9
+ alert_type: error
10
+ source_type_name : cron_job
@@ -9,17 +9,18 @@ class Alerty
9
9
  def initialize(config)
10
10
  @client = Dogapi::Client.new(config.api_key)
11
11
  @subject = config.subject
12
+ @alert_type = config.alert_type
13
+ @source_type_name = config.source_type_name
12
14
  @num_retries = config.num_retries || 3
13
15
  end
14
16
 
15
17
  def alert(record)
16
18
  message = record[:output]
17
- hostname = record[:hostname]
18
19
  subject = expand_placeholder(@subject, record)
19
20
  timestamp = Time.now.to_i
20
21
  retries = 0
21
22
  begin
22
- @client.emit_event(Dogapi::Event.new(message, :msg_title => subject, :alert_type => "error", :date_happened => timestamp), :host => hostname)
23
+ @client.emit_event(Dogapi::Event.new(message, :msg_title => subject, :alert_type => @alert_type, :source_type_name => @source_type_name ,:date_happened => timestamp), :host => record[:hostname])
23
24
  Alerty.logger.info "Sent #{{subject: subject, message: message}} to Datadog Event"
24
25
  rescue => e
25
26
  retries += 1
@@ -1,7 +1,7 @@
1
1
  module Alerty
2
2
  module Plugin
3
3
  module DatadogEvent
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alerty-plugin-datadog_event
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yohei Kawahara(inokappa)