sensu-plugins-opsgenie 1.0.0 → 2.0.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 +8 -8
- data/CHANGELOG.md +17 -2
- data/README.md +47 -1
- data/bin/handler-opsgenie.rb +16 -4
- data/lib/sensu-plugins-opsgenie/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTc2NDQ4NmI1N2U3MDQ5ZmRhNzVmNWZiMDJkZDBkY2MwNzYzMjQzNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTc5MWFiMTU4NzRiNTdjZTQ4ZmUyNjQ0YjNhYTcwN2VjMjMzZmJjZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjEzNTE3YjRkYmNmODVmZGYwMmE5ZGY4ZDNhNTY4Y2UyYmI5MDA0ZTc2MTMx
|
10
|
+
ZWY2Yjg5MWFmMWQ2ZmRiMWY2ZDBlYmUzNmRhYzc3OGI5ODlkM2ZiOWVhYWRh
|
11
|
+
OWE4MWQ5NmQyZmIzMTJiYzNlN2UzNjAxNDI1ZTI4NTIyOTNhMzk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGZjZGJlZGNjZTIzMzM1MTUyZDg1YjY3YWZlMjlkZGMyMTk4OGZkYTA1MzU0
|
14
|
+
NjdjMjMxODUyZWNkOWFlNDRkYjEzYmY3ZGYwMmEwZTAwZDg0NDg2OTBkNTRk
|
15
|
+
YjRjZTJjOGZjMTk5YzdkMzdjZWMzMzVhYzFjZDcyY2E3ODU1NjY=
|
data/CHANGELOG.md
CHANGED
@@ -5,10 +5,23 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
-
## [
|
8
|
+
## [2.0.0] - 2016-06-29
|
9
|
+
### Added
|
10
|
+
- Added description support for OpsGenie alerts (@mnellemann)
|
11
|
+
- Report the client name as `entity` to OpsGenie (@steti)
|
12
|
+
- Support for Ruby 2.3.0
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
- Update to Rubocop 0.40 and cleanup
|
16
|
+
|
17
|
+
### Removed
|
18
|
+
- Support for Ruby 1.9.3
|
19
|
+
|
20
|
+
## [1.0.0] - 2016-04-12
|
9
21
|
### Changed
|
10
22
|
- Changed the `-j, --jsonconfig` parameter to specify a key in the already-parsed JSON config file
|
11
23
|
- The `-j, --jsonconfig` parameter no longer takes a JSON config file as input
|
24
|
+
- Update to rubocop 0.37
|
12
25
|
|
13
26
|
## [0.0.3] - 2015-11-26
|
14
27
|
### Added
|
@@ -34,7 +47,9 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
34
47
|
- initial release
|
35
48
|
- Fixed json configuration load
|
36
49
|
|
37
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-opsgenie/compare/0.0
|
50
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-opsgenie/compare/2.0.0...HEAD
|
51
|
+
[2.0.0]: https://github.com/sensu-plugins/sensu-plugins-opsgenie/compare/1.0.0...2.0.0
|
52
|
+
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-opsgenie/compare/0.0.3...1.0.0
|
38
53
|
[0.0.3]: https://github.com/sensu-plugins/sensu-plugins-opsgenie/compare/0.0.2...0.0.3
|
39
54
|
[0.0.2]: https://github.com/sensu-plugins/sensu-plugins-opsgenie/compare/0.0.1...0.0.2
|
40
55
|
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## Sensu-Plugins-opsgenie
|
2
2
|
|
3
|
-
[
|
3
|
+
[](https://travis-ci.org/sensu-plugins/sensu-plugins-opsgenie)
|
4
4
|
[](http://badge.fury.io/rb/sensu-plugins-opsgenie)
|
5
5
|
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-opsgenie)
|
6
6
|
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-opsgenie)
|
@@ -32,4 +32,50 @@
|
|
32
32
|
|
33
33
|
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
34
34
|
|
35
|
+
## Configuration
|
36
|
+
To get this to work you need to specify a few different things. For a list of fields that are required/available look at the [sensu documentation](https://sensuapp.org/docs/0.25/enterprise/integrations/opsgenie.html). These files need to be on the server and the client boxes. Once there restart sensu-server and sensu-api.
|
37
|
+
|
38
|
+
- declare this as a handler: `/etc/sensu/conf.d/handler_opsgenie.json`
|
39
|
+
``` json
|
40
|
+
{
|
41
|
+
"handlers": {
|
42
|
+
"opsgenie": {
|
43
|
+
"type": "pipe",
|
44
|
+
"command": "/opt/sensu/embedded/bin/handler-opsgenie.rb"
|
45
|
+
}
|
46
|
+
},
|
47
|
+
"opsgenie": {
|
48
|
+
"customerKey": "YOUR-KEY-HERE"
|
49
|
+
}
|
50
|
+
}
|
51
|
+
```
|
52
|
+
|
53
|
+
- add it to the check: `/etc/sensu/conf.d/check_xxx.json`
|
54
|
+
``` json
|
55
|
+
{
|
56
|
+
"checks": {
|
57
|
+
"check_elastinats_is_running": {
|
58
|
+
"command": "/opt/sensu/embedded/bin/check-process.rb -p cron",
|
59
|
+
"interval": 60,
|
60
|
+
"handlers": [ "opsgenie" ],
|
61
|
+
"subscribers": [ "core" ]
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
```
|
66
|
+
|
67
|
+
- optionally add it to the default handler: `/etc/sensu/conf.d/default_handler.json`
|
68
|
+
``` json
|
69
|
+
{
|
70
|
+
"handlers": {
|
71
|
+
"default": {
|
72
|
+
"type": "set",
|
73
|
+
"handlers": [
|
74
|
+
"opsgenie"
|
75
|
+
]
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
```
|
80
|
+
|
35
81
|
## Notes
|
data/bin/handler-opsgenie.rb
CHANGED
@@ -22,13 +22,13 @@ class Opsgenie < Sensu::Handler
|
|
22
22
|
if @event['check']['opsgenie']
|
23
23
|
@json_config.merge!(@event['check']['opsgenie'])
|
24
24
|
end
|
25
|
-
|
25
|
+
message = @event['notification'] || [@event['client']['name'], @event['check']['name'], @event['check']['output'].chomp].join(' : ')
|
26
26
|
|
27
27
|
begin
|
28
28
|
timeout(30) do
|
29
29
|
response = case @event['action']
|
30
30
|
when 'create'
|
31
|
-
create_alert(
|
31
|
+
create_alert(message)
|
32
32
|
when 'resolve'
|
33
33
|
close_alert
|
34
34
|
end
|
@@ -59,7 +59,11 @@ class Opsgenie < Sensu::Handler
|
|
59
59
|
@event['client']['tags']
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
62
|
+
def client_name
|
63
|
+
@event['client']['name']
|
64
|
+
end
|
65
|
+
|
66
|
+
def create_alert(message)
|
63
67
|
tags = []
|
64
68
|
tags << @json_config['tags'] if @json_config['tags']
|
65
69
|
tags << 'OverwriteQuietHours' if event_status == 2 && @json_config['overwrite_quiet_hours'] == true
|
@@ -70,10 +74,18 @@ class Opsgenie < Sensu::Handler
|
|
70
74
|
event_tags.each { |tag, value| tags << "#{tag}_#{value}" }
|
71
75
|
end
|
72
76
|
|
77
|
+
description = @json_config['description'] if @json_config['description']
|
73
78
|
recipients = @json_config['recipients'] if @json_config['recipients']
|
74
79
|
teams = @json_config['teams'] if @json_config['teams']
|
75
80
|
|
76
|
-
post_to_opsgenie(:create,
|
81
|
+
post_to_opsgenie(:create,
|
82
|
+
alias: event_id,
|
83
|
+
message: message,
|
84
|
+
description: description,
|
85
|
+
entity: client_name,
|
86
|
+
tags: tags.join(','),
|
87
|
+
recipients: recipients,
|
88
|
+
teams: teams)
|
77
89
|
end
|
78
90
|
|
79
91
|
def post_to_opsgenie(action = :create, params = {})
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-opsgenie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.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: 2016-
|
11
|
+
date: 2016-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.2
|
19
|
+
version: '1.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.2
|
26
|
+
version: '1.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 0.40.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - ~>
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 0.40.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: yard
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -183,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
183
183
|
requirements:
|
184
184
|
- - ! '>='
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
186
|
+
version: 2.0.0
|
187
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
188
|
requirements:
|
189
189
|
- - ! '>='
|