sensu-plugins-opsgenie 4.0.1 → 4.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 +4 -4
- data/CHANGELOG.md +11 -3
- data/README.md +53 -0
- data/bin/handler-opsgenie.rb +7 -5
- data/lib/sensu-plugins-opsgenie/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faf5d85fd7a0b67c548f58d23def4e94a60c371898ae21a8def6b85190a90d13
|
4
|
+
data.tar.gz: c30d35754b9edf57a5293895701918eb09290900636258ad57d7f62e06cafd37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 462592d60faf80d7bbd44bf97b0e77f8576ce393cb9463cd28d04b5a76f44a8edf71f2019462eeacf4c89c9f0a9d54668433946e7756ed02384ef12528b4873f
|
7
|
+
data.tar.gz: 6979f09f5efde25851ee26ca38ee2686b98277f57c358c5ae841f50a5c7dfe9df66ac16058664cbe39d146dca8605a0b9a59d1c71454a845e54de1842530c3a6
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,17 @@
|
|
1
|
-
#Change Log
|
1
|
+
# Change Log
|
2
2
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
3
3
|
|
4
|
-
This CHANGELOG follows the format listed
|
4
|
+
This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [4.1.0] 2018-01-14
|
9
|
+
### Added
|
10
|
+
- Added possibility to specify custom alias for event ID, this acts in a similar way to proxy/JIT clients to dedupe alerts (@Castaglia)
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- updated Changelog guidelines location (@majormoses)
|
14
|
+
|
8
15
|
## [4.0.1] - 2018-01-06
|
9
16
|
### Fixed
|
10
17
|
- Use Alert v2 API, as the Alert v1 API is deprecated (@Castaglia)
|
@@ -78,7 +85,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
78
85
|
- initial release
|
79
86
|
- Fixed json configuration load
|
80
87
|
|
81
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-opsgenie/compare/4.0
|
88
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-opsgenie/compare/4.1.0...HEAD
|
89
|
+
[4.1.0]: https://github.com/sensu-plugins/sensu-plugins-opsgenie/compare/4.0.1...4.1.0
|
82
90
|
[4.0.1]: https://github.com/sensu-plugins/sensu-plugins-opsgenie/compare/4.0.0...4.0.1
|
83
91
|
[4.0.0]: https://github.com/sensu-plugins/sensu-plugins-opsgenie/compare/3.1.0...4.0.0
|
84
92
|
[3.1.0]: https://github.com/sensu-plugins/sensu-plugins-opsgenie/compare/3.0.0...3.1.0
|
data/README.md
CHANGED
@@ -79,3 +79,56 @@ To get this to work you need to specify a few different things. For a list of fi
|
|
79
79
|
```
|
80
80
|
|
81
81
|
## Notes
|
82
|
+
|
83
|
+
If the check definition uses the custom `alias` attribute, _e.g._:
|
84
|
+
```
|
85
|
+
{
|
86
|
+
"checks": {
|
87
|
+
"check_mysql_access": {
|
88
|
+
"opsgenie": {
|
89
|
+
"alias": "MyCustomAlias",
|
90
|
+
|
91
|
+
```
|
92
|
+
then the `handler-opsgenie.rb` handler will use that attribute value as the
|
93
|
+
OpsGenie event ID. This can be useful for alert deduplication; checks on
|
94
|
+
different clients for the same downstream resource can specify the same
|
95
|
+
`alias` attribute, so that multiple alerts for the same resource are
|
96
|
+
de-duplicated.
|
97
|
+
|
98
|
+
By default, `handler-opsgenie.rb` creates an event ID from the client name
|
99
|
+
and the check name. Thus:
|
100
|
+
```
|
101
|
+
{
|
102
|
+
"checks": {
|
103
|
+
"check_mysql_access": {
|
104
|
+
"command": "/opt/sensu/embedded/bin/check-database.rb -h mysqldb",
|
105
|
+
"interval": 60,
|
106
|
+
"handlers": [ "opsgenie" ],
|
107
|
+
"standalone": true
|
108
|
+
}
|
109
|
+
}
|
110
|
+
```
|
111
|
+
running on a client named `web01` will create an alert using an event ID of
|
112
|
+
`web01:check_mysql_access`. And on a client named `web02`, it would create an
|
113
|
+
alert with a _different_ event ID of `web02:check_mysql_access`, even though
|
114
|
+
the `mysqldb` server being checked is the same for these clients.
|
115
|
+
|
116
|
+
We can define a custom `alias` attribute in this check:
|
117
|
+
```
|
118
|
+
{
|
119
|
+
"checks": {
|
120
|
+
"check_mysql_access": {
|
121
|
+
"command": "/opt/sensu/embedded/bin/check-database.rb -h mysqldb",
|
122
|
+
"interval": 60,
|
123
|
+
"handlers": [ "opsgenie" ],
|
124
|
+
"standalone": true,
|
125
|
+
|
126
|
+
"opsgenie": {
|
127
|
+
"alias": "mysqldb"
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
```
|
132
|
+
And with this, running on multiple clients, any alerts would be generated
|
133
|
+
with the same event ID of `mysqldb`, by using that `alias` attribute as the
|
134
|
+
event ID.
|
data/bin/handler-opsgenie.rb
CHANGED
@@ -52,18 +52,18 @@ class Opsgenie < Sensu::Handler
|
|
52
52
|
end
|
53
53
|
case response.code.to_s
|
54
54
|
when '200', '202'
|
55
|
-
puts
|
55
|
+
puts "opsgenie -- #{@event['action'].capitalize}d incident -- #{event_id}"
|
56
56
|
when '401'
|
57
|
-
puts
|
57
|
+
puts "opsgenie -- failed to #{@event['action']} incident -- #{event_id}: not authorized"
|
58
58
|
when '404'
|
59
|
-
puts
|
59
|
+
puts "opsgenie -- failed to #{@event['action']} incident -- #{event_id} not found"
|
60
60
|
else
|
61
|
-
puts
|
61
|
+
puts "opsgenie -- failed to #{@event['action']} incident -- #{event_id}"
|
62
62
|
puts "HTTP #{response.code} #{response.message}: #{response.body}"
|
63
63
|
end
|
64
64
|
end
|
65
65
|
rescue Timeout::Error
|
66
|
-
puts
|
66
|
+
puts "opsgenie -- timed out while attempting to #{@event['action']} a incident -- #{event_id}"
|
67
67
|
end
|
68
68
|
|
69
69
|
def message
|
@@ -83,6 +83,8 @@ class Opsgenie < Sensu::Handler
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def event_id
|
86
|
+
return @event['check']['opsgenie']['alias'] unless @event['check']['opsgenie'].nil? || @event['check']['opsgenie']['alias'].nil?
|
87
|
+
|
86
88
|
# Do not use slashes in the event ID, as this alias becomes part of the URI
|
87
89
|
# in the RESTful interactions with OpsGenie; use characters which can be
|
88
90
|
# easily embedded into a URI.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-opsgenie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.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: 2018-01-
|
11
|
+
date: 2018-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|