sensu-plugins-opsgenie 0.0.2 → 0.0.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: bff39efa1e03424fb438e9860206a00713278837
4
- data.tar.gz: d653a38a482905d0bf37abc00f995c151bf66033
3
+ metadata.gz: 31093c642c4309185d9e15db4f902651f5d92331
4
+ data.tar.gz: 6355e040efdcdb47c5b7793fd0ced3889408d35d
5
5
  SHA512:
6
- metadata.gz: dbef237786b4ddad8e873ab8ce2fd6b906111ec9b41b1ba0684e9dc7ade7730df9690702038965d25c2b96732b56e60c9660c1f65a652ed4d9779197f1e3784f
7
- data.tar.gz: 0ecc157a8fced1794091881df03a8c74d5ee768a9b7c1acb7ff90482eb8919b50ddb1fbb3129dfe363b00cac3b55a6fb1bb84360164a395edf95810284c6d916
6
+ metadata.gz: 73d3c94b09a9d8acc07add9996341670291e050d0d370fe333a277fa0038c3197c4a8a4805ad37b30132b50c3714bcbb0cb2a27debee1b7d005bdd62fae444d6
7
+ data.tar.gz: 0158837c4386650f185eb094cca333f2eea31f5d7b2b8ff0aad083b8b251b5d155b5add5484af99cba43524ebc9d16dda894b99b71ca124361be42958b5180c5
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -3,7 +3,19 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
- ## Unreleased][unreleased]
6
+ ## [Unreleased]
7
+
8
+ ## [0.0.3] - 2015-11-26
9
+ ### Added
10
+ - Added team support for OpsGenie alerts.
11
+ - Added sensu tags integration.
12
+ - Allow check to override default handler config
13
+
14
+ ### Updated
15
+ - Moved adding "recipients" parameter to JSON content to create_alert function. Recipients parameter is not available for close_alert.
16
+
17
+ ### Fixed
18
+ - Fixed getting "source" field from JSON.
7
19
 
8
20
  ## [0.0.2] - 2015-07-14
9
21
  ### Changed
data/README.md CHANGED
@@ -20,6 +20,7 @@
20
20
  {
21
21
  "opsgenie": {
22
22
  "customerKey": "the-key",
23
+ "teams": ["teams"],
23
24
  "recipients": "the-recipients",
24
25
  "source": "alert-source",
25
26
  "overwrite_quiet_hours": true,
@@ -30,6 +31,6 @@
30
31
 
31
32
  ## Installation
32
33
 
33
- [Installation and Setup](https://github.com/sensu-plugins/documentation/blob/master/user_docs/installation_instructions.md)
34
+ [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
34
35
 
35
36
  ## Notes
@@ -18,6 +18,10 @@ class Opsgenie < Sensu::Handler
18
18
 
19
19
  def handle
20
20
  @json_config = JSON.parse(File.open(config[:json_config]).read)
21
+ # allow config to be changed by the check
22
+ if @event['check']['opsgenie']
23
+ @json_config['opsgenie'].merge!(@event['check']['opsgenie'])
24
+ end
21
25
  description = @event['notification'] || [@event['client']['name'], @event['check']['name'], @event['check']['output'].chomp].join(' : ')
22
26
 
23
27
  begin
@@ -51,6 +55,10 @@ class Opsgenie < Sensu::Handler
51
55
  post_to_opsgenie(:close, alias: event_id)
52
56
  end
53
57
 
58
+ def event_tags
59
+ @event['client']['tags']
60
+ end
61
+
54
62
  def create_alert(description)
55
63
  tags = []
56
64
  tags << @json_config['opsgenie']['tags'] if @json_config['opsgenie']['tags']
@@ -58,16 +66,21 @@ class Opsgenie < Sensu::Handler
58
66
  tags << 'unknown' if event_status >= 3
59
67
  tags << 'critical' if event_status == 2
60
68
  tags << 'warning' if event_status == 1
69
+ unless event_tags.nil?
70
+ event_tags.each { |tag, value| tags << "#{tag}_#{value}" }
71
+ end
72
+
73
+ recipients = @json_config['opsgenie']['recipients'] if @json_config['opsgenie']['recipients']
74
+ teams = @json_config['opsgenie']['teams'] if @json_config['opsgenie']['teams']
61
75
 
62
- post_to_opsgenie(:create, alias: event_id, message: description, tags: tags.join(','))
76
+ post_to_opsgenie(:create, alias: event_id, message: description, tags: tags.join(','), recipients: recipients, teams: teams)
63
77
  end
64
78
 
65
79
  def post_to_opsgenie(action = :create, params = {})
66
80
  params['customerKey'] = @json_config['opsgenie']['customerKey']
67
- params['recipients'] = @json_config['opsgenie']['recipients']
68
81
 
69
82
  # override source if specified, default is ip
70
- params['source'] = @json_config['source'] if @json_config['source']
83
+ params['source'] = @json_config['opsgenie']['source'] if @json_config['opsgenie']['source']
71
84
 
72
85
  uripath = (action == :create) ? '' : 'close'
73
86
  uri = URI.parse("https://api.opsgenie.com/v1/json/alert/#{uripath}")
@@ -6,7 +6,7 @@ module SensuPluginsOpsgenie
6
6
  module Version
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- PATCH = 2
9
+ PATCH = 3
10
10
 
11
11
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
12
12
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-opsgenie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
@@ -30,7 +30,7 @@ cert_chain:
30
30
  8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
31
  HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
32
  -----END CERTIFICATE-----
33
- date: 2015-07-14 00:00:00.000000000 Z
33
+ date: 2015-11-26 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sensu-plugin
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
213
  version: '0'
214
214
  requirements: []
215
215
  rubyforge_project:
216
- rubygems_version: 2.4.6
216
+ rubygems_version: 2.4.8
217
217
  signing_key:
218
218
  specification_version: 4
219
219
  summary: Sensu plugins for working with opsgenie
metadata.gz.sig CHANGED
Binary file