sensu-plugins-pagerduty 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 +4 -4
- data/CHANGELOG.md +10 -3
- data/README.md +16 -1
- data/bin/handler-pagerduty.rb +16 -3
- data/lib/sensu-plugins-pagerduty/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8013c82be04050d5d1a5be48b6ac670a77b1c0e7
|
4
|
+
data.tar.gz: 9b3a495d37dd59456b85de2ca0f5d414ad5ec1c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d852b6dfdac69026817475ab7e3adf5a6f6cf6155b17cdfecc23fc75ee7f9f8d1cce68c5fe86f5669f9883191deb091fbf5153ed6f79280f1cd5801774a0209
|
7
|
+
data.tar.gz: d4d3f55744b81324f7b411de262f7cec5fa828a11d70ae4bbc3d3c86ef794775064cb663f3fc44a3fd93c1ee37c4abd1dcffa1c823bdaa5e7bac41d98718a2db
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [2.1.0] - 2017-02-28
|
9
|
+
### Added
|
10
|
+
- Add contexts support (@zroger)
|
11
|
+
- Update timeout syntax and extend to 10 seconds. (@luckymike)
|
12
|
+
- Allow adding some dynamic fields (from the event sensu client config) to the PD event description (@Oded-B)
|
13
|
+
|
8
14
|
## [2.0.0] - 2016-06-29
|
9
15
|
### Added
|
10
16
|
- Proxy support (@lcrisci)
|
@@ -37,8 +43,8 @@ marking it as a stable 1.0.0 release.
|
|
37
43
|
|
38
44
|
## [0.0.8] - 2015-12-10
|
39
45
|
### Added
|
40
|
-
- Added a handler to allow overrides based on priority, now you can different
|
41
|
-
alerts trigger different PagerDuty API endpoints. For example one can hit a high
|
46
|
+
- Added a handler to allow overrides based on priority, now you can different
|
47
|
+
alerts trigger different PagerDuty API endpoints. For example one can hit a high
|
42
48
|
priority endpoint but warning can hit a lowpriority point.
|
43
49
|
|
44
50
|
### Changed
|
@@ -88,7 +94,8 @@ marking it as a stable 1.0.0 release.
|
|
88
94
|
### Added
|
89
95
|
- initial release
|
90
96
|
|
91
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-pagerduty/compare/2.
|
97
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-pagerduty/compare/2.1.0...HEAD
|
98
|
+
[2.1.0]: https://github.com/sensu-plugins/sensu-plugins-pagerduty/compare/2.0.0...2.1.0
|
92
99
|
[2.0.0]: https://github.com/sensu-plugins/sensu-plugins-pagerduty/compare/1.0.0...2.0.0
|
93
100
|
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-pagerduty/compare/0.0.9...1.0.0
|
94
101
|
[0.0.9]: https://github.com/sensu-plugins/sensu-plugins-pagerduty/compare/0.0.8...0.0.9
|
data/README.md
CHANGED
@@ -52,6 +52,8 @@ In the Client hash you can define a `pager_team` key value pair. If the the cli
|
|
52
52
|
|
53
53
|
Please note, this sets the escalation path on the whole host. If you want more granular control on escalation paths please view the Mutator section below.
|
54
54
|
|
55
|
+
In the Check hash you can define a `pagerduty_contexts` list to send contextual links and images with your events. This list should conform to the [PagerDuty documentation](https://developer.pagerduty.com/documentation/integration/events/trigger#contexts) about contexts.
|
56
|
+
|
55
57
|
## Usage of Priority Overide Mutator
|
56
58
|
|
57
59
|
This mutator allows you to have fine grain control on PagerDuty escalation paths based on data within the client hash. The mutator will look in the following locations where `#{event_level}` is `warning` and `critical` (unknown, is replaced by critical), and `#{check_name}` is the name of the check. Items located lower in the list take precedence:
|
@@ -118,9 +120,22 @@ And I also have the following client hash:
|
|
118
120
|
}
|
119
121
|
```
|
120
122
|
|
121
|
-
|
122
123
|
If a `critical` event is triggered from "my.host.fqdn" that is not named `check_disk` it will alert the default (with value api_key: 12345). If a `warning` event is triggered that is not `check_disk` it will alert the `low_proirity` escalation service. If any `check_disk` alert is triggerd it will the alert the `ops` escalation.
|
123
124
|
|
125
|
+
|
126
|
+
## Adding Dynamic Event Description Prefix
|
127
|
+
|
128
|
+
You can add a custom field from the Sensu client config as a description prefix, like the host name, to add more context to the event description:
|
129
|
+
|
130
|
+
```
|
131
|
+
{
|
132
|
+
"pagerduty": {
|
133
|
+
"api_key": "12345",
|
134
|
+
"dynamic_description_prefix_key" : "name",
|
135
|
+
}
|
136
|
+
}
|
137
|
+
```
|
138
|
+
|
124
139
|
## Installation
|
125
140
|
|
126
141
|
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
data/bin/handler-pagerduty.rb
CHANGED
@@ -67,12 +67,24 @@ class PagerdutyHandler < Sensu::Handler
|
|
67
67
|
proxy_settings
|
68
68
|
end
|
69
69
|
|
70
|
+
def contexts
|
71
|
+
@contexts ||= @event['check']['pagerduty_contexts'] || []
|
72
|
+
end
|
73
|
+
|
74
|
+
def description_prefix
|
75
|
+
@description_prefix = if @event['client'].key?(settings[json_config]['dynamic_description_prefix_key'])
|
76
|
+
"(#{@event['client'][settings[json_config]['dynamic_description_prefix_key']]})"
|
77
|
+
else
|
78
|
+
settings[json_config]['description_prefix']
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
70
82
|
def handle(pd_client = nil)
|
71
83
|
incident_key_prefix = settings[json_config]['incident_key_prefix']
|
72
|
-
description_prefix =
|
84
|
+
description_prefix = description_prefix()
|
73
85
|
proxy_settings = proxy_settings()
|
74
86
|
begin
|
75
|
-
timeout(
|
87
|
+
Timeout.timeout(10) do
|
76
88
|
if proxy_settings['proxy_host']
|
77
89
|
pagerduty = pd_client || Pagerduty.new(api_key,
|
78
90
|
proxy_host: proxy_settings['proxy_host'],
|
@@ -88,7 +100,8 @@ class PagerdutyHandler < Sensu::Handler
|
|
88
100
|
when 'create'
|
89
101
|
pagerduty.trigger([description_prefix, event_summary].compact.join(' '),
|
90
102
|
incident_key: [incident_key_prefix, incident_key].compact.join(''),
|
91
|
-
details: @event
|
103
|
+
details: @event,
|
104
|
+
contexts: contexts)
|
92
105
|
when 'resolve'
|
93
106
|
pagerduty.get_incident([incident_key_prefix, incident_key].compact.join('')).resolve(
|
94
107
|
[description_prefix, event_summary].compact.join(' '), @event
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-pagerduty
|
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:
|
11
|
+
date: 2017-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -205,9 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
version: '0'
|
206
206
|
requirements: []
|
207
207
|
rubyforge_project:
|
208
|
-
rubygems_version: 2.5
|
208
|
+
rubygems_version: 2.4.5
|
209
209
|
signing_key:
|
210
210
|
specification_version: 4
|
211
211
|
summary: Sensu plugins for pagerduty
|
212
212
|
test_files: []
|
213
|
-
has_rdoc:
|