sensu-plugins-victorops 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -2
- data/README.md +35 -1
- data/bin/handler-victorops.rb +21 -5
- data/lib/sensu-plugins-victorops/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 965908392c154eb1fd40ded196f5f184b466cb9b49246d5e7d1429e2583844f5
|
4
|
+
data.tar.gz: 5546257223f4b6b6a714f3119d5af80c49e2040e0dd5dea6cb4214cc626beff3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c465485b0e6cb7ead4963755d3d8a4970c5081004838d5280cbbcf44dcf2891a3266dbf719b29ecf7b331edfd1ee2fc121faecbe04c408c46e6398610b8c4dca
|
7
|
+
data.tar.gz: ec8edb81e43e88fb5eb476771f53ef230f0c26eaea6208b30bb4ff2e4b5aae9ffa6fc242feaa82dbbf5fb1a1351611ee4c607c8a86a0daf649b7704b4d88da66
|
data/CHANGELOG.md
CHANGED
@@ -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
|
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.
|
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.
|
data/bin/handler-victorops.rb
CHANGED
@@ -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
|
-
|
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 -
|
41
|
-
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?
|
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.
|
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-
|
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
|
-
|
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
|