alerty-plugin-datadog_event 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -3
- data/example.yml +2 -0
- data/lib/alerty/plugin/datadog_event.rb +3 -2
- data/lib/alerty/plugin/datadog_event/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: 1f6f37d2ede15b4d93920d7e006af6eec5bf8a73
|
4
|
+
data.tar.gz: 6fe8c620b23ccb547b2732bb90cbf029a4872805
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
@@ -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 =>
|
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
|