sensu-plugins-victorops 2.0.0 → 2.1.0

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
  SHA256:
3
- metadata.gz: e1438d310bbc76e827b3d2eafdc209185a52c248b8bb1f3dc3ae1b835c719cf6
4
- data.tar.gz: a6151d40038504026eb8c719015e0f534f16fc4300c599ac3f5d185cde9fa13b
3
+ metadata.gz: 965908392c154eb1fd40ded196f5f184b466cb9b49246d5e7d1429e2583844f5
4
+ data.tar.gz: 5546257223f4b6b6a714f3119d5af80c49e2040e0dd5dea6cb4214cc626beff3
5
5
  SHA512:
6
- metadata.gz: 391374de08cd4de08ac2ad4b11ddcdfa7e3bf9d4f0faf764c08cbddfb41712eb7f37706a1362caede9e08176ecd5129ae38648b09d10704451d2279743a14969
7
- data.tar.gz: d214e897aeb926a9a9e3dcf23f6408140f839ed98c22fe4caac6fceb0de35d13a3f3f00a9e00ac8a70cc0c011e9da122cdb775246d15372d8eadbc6bdd617338
6
+ metadata.gz: c465485b0e6cb7ead4963755d3d8a4970c5081004838d5280cbbcf44dcf2891a3266dbf719b29ecf7b331edfd1ee2fc121faecbe04c408c46e6398610b8c4dca
7
+ data.tar.gz: ec8edb81e43e88fb5eb476771f53ef230f0c26eaea6208b30bb4ff2e4b5aae9ffa6fc242feaa82dbbf5fb1a1351611ee4c607c8a86a0daf649b7704b4d88da66
@@ -1,9 +1,14 @@
1
1
  #Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
- This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
4
+ This CHANGELOG follows the format located [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
5
5
 
6
6
  ## [Unreleased]
7
+
8
+ ## [2.1.0] - 2019-10-25
9
+ ### Added
10
+ - Adds ability to use the environment variables `VICTOROPS_API_URL` & `VICTOROPS_ROUTING_KEY` for Sensu Go
11
+
7
12
  ## [2.0.0] - 2019-06-06
8
13
  ### Breaking Changes
9
14
  - Update minimum required ruby version to 2.3. Drop unsupported ruby versions.
@@ -46,7 +51,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
46
51
  ### Added
47
52
  - initial release
48
53
 
49
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-victorops/compare/2.0.0...HEAD
54
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-victorops/compare/2.1.0...HEAD
55
+ [2.1.0]: https://github.com/sensu-plugins/sensu-plugins-victorops/compare/2.0.0...2.1.0
50
56
  [2.0.0]: https://github.com/sensu-plugins/sensu-plugins-victorops/compare/1.0.0...2.0.0
51
57
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-victorops/compare/0.1.0...1.0.0
52
58
  [0.1.0]: https://github.com/sensu-plugins/sensu-plugins-victorops/compare/0.0.3...0.1.0
data/README.md CHANGED
@@ -19,6 +19,12 @@
19
19
  "victorops": {
20
20
  "api_url": "YOUR_API_URL_WHITOUT_ROUTING_KEY",
21
21
  "routing_key": "everyone"
22
+ },
23
+ "handlers": {
24
+ "victorops": {
25
+ "type": "pipe",
26
+ "command": "handler-victorops.rb"
27
+ }
22
28
  }
23
29
  }
24
30
  ```
@@ -36,4 +42,32 @@ If you have multiple VictorOps accounts and need to route alerts to different en
36
42
  "command": "/opt/sensu/embedded/bin/handler-victorops.rb -name victorops_endpoint1"
37
43
  },
38
44
  ```
39
-
45
+
46
+ ### Sensu Go Enabled
47
+
48
+ This plugin is also Sensu Go enabled. You can map events into ruby by using the flag `--map_go_event_into_ruby` as part of your command. Practically, this might look like:
49
+
50
+ ```
51
+ ---
52
+ type: Handler
53
+ spec:
54
+ metadata:
55
+ name: victorops
56
+ namespace: default
57
+ labels:
58
+ annotations:
59
+ type: pipe
60
+ command: handler-victorops.rb --map_go_event_into_ruby
61
+ timeout: 0
62
+ handlers: []
63
+ filters:
64
+ - is_incident
65
+ env_vars:
66
+ - KEEPALIVE_SLACK_WEBHOOK=https://alert.victorops.com/integrations/generic/01234567/alert/0123456789101112
67
+ - VICTOROPS_ROUTING_KEY=testing
68
+ runtime_assets:
69
+ - sensu-plugins-victorops
70
+ - sensu-ruby-runtime
71
+ ```
72
+
73
+ You'll also note that the plugin also supports environment variables. You can use these without having to have a file locally to load in those values.
@@ -7,6 +7,10 @@
7
7
  # arguments:
8
8
  # - settingsname: Sensu settings name, defaults to victorops
9
9
  # - routingkey: VictorOps routing key
10
+ #
11
+ # NOTE: This plugin is Sensu Go enabled. To use this plugin with Sensu Go, add --map_go_event_into_ruby as part of the command.
12
+ # Example:
13
+ # handler-victorops.rb --map_go_event_into_ruby
10
14
 
11
15
  require 'sensu-handler'
12
16
  require 'uri'
@@ -15,6 +19,12 @@ require 'net/https'
15
19
  require 'json'
16
20
 
17
21
  class VictorOps < Sensu::Handler
22
+ option :api_url,
23
+ description: 'VictorOps API URL without routing key',
24
+ short: '-a APIURL',
25
+ long: '--api-url APIURL',
26
+ default: nil
27
+
18
28
  option :settingsname,
19
29
  description: 'Sensu settings name',
20
30
  short: '-n NAME',
@@ -28,17 +38,23 @@ class VictorOps < Sensu::Handler
28
38
  default: nil
29
39
 
30
40
  def handle
31
- # validate that we have settings
41
+ # validate that we have a settings name
32
42
  unless defined? settings[config[:settingsname]] && !settings[config[:settingsname]].nil?
33
43
  raise "victorops.rb sensu setting '#{config[:settingsname]}' not found or empty"
34
44
  end
35
- unless defined? settings[config[:settingsname]]['api_url'] && !settings[config[:settingsname]]['api_url'].nil?
45
+
46
+ # validate that we have an api url - environment variables take precedence
47
+ api_url = ENV['VICTOROPS_API_URL']
48
+ api_url = config[:api_url] if api_url.nil?
49
+ api_url = settings[config[:settingsname]]['api_url'] if api_url.nil?
50
+
51
+ unless defined? api_url && !api_url.nil?
36
52
  raise "victorops.rb sensu setting '#{config[:settingsname]}.api_url' not found or empty"
37
53
  end
38
- api_url = settings[config[:settingsname]]['api_url']
39
54
 
40
- # validate that we have a routing key - command arguments take precedence
41
- routing_key = config[:routing_key]
55
+ # validate that we have a routing key - environment variables take precedence
56
+ routing_key = ENV['VICTOROPS_ROUTING_KEY']
57
+ routing_key = config[:routing_key] if routing_key.nil?
42
58
  routing_key = settings[config[:settingsname]]['routing_key'] if routing_key.nil?
43
59
 
44
60
  unless defined? routing_key && !routing_key.nil?
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsVictorops
2
2
  module Version
3
3
  MAJOR = 2
4
- MINOR = 0
4
+ MINOR = 1
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-victorops
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-07 00:00:00.000000000 Z
11
+ date: 2019-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -202,7 +202,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  - !ruby/object:Gem::Version
203
203
  version: '0'
204
204
  requirements: []
205
- rubygems_version: 3.0.3
205
+ rubyforge_project:
206
+ rubygems_version: 2.7.7
206
207
  signing_key:
207
208
  specification_version: 4
208
209
  summary: Sensu plugins for Victorops alerting service