sensu-plugins-pagerduty 2.2.0 → 3.0.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 +7 -1
- data/README.md +35 -3
- data/bin/handler-pagerduty.rb +5 -5
- data/lib/sensu-plugins-pagerduty/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4a3db515ce06dab242e7320817c87b43fbd0c2a
|
4
|
+
data.tar.gz: 5b64f3cd4e67a5c0c8ffea459cf67ab219067130
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd550d76ca2c81a70db7a0d172b21d043bad843c0996e239aaefb700082efb0ce5c506594790df6ff6be52f667f9a916f4a3454516de1800b8e4de55515b605d
|
7
|
+
data.tar.gz: f288cfa4f3d08c0a53b8968f3d6d28f1569d13dc4f0973c49e412850a304c45fd4cd311a54d2bcc0eaa8654eafd1a2eead94907235878edda432667fc743423d
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
|
+
## [3.0.0] - 2017-06-01
|
8
|
+
### Breaking Change
|
9
|
+
- changed the precedence of pager_team evaluation from `client -> check -> json_config` to `check -> client -> json_config` (@guru-beach)
|
10
|
+
### Added
|
11
|
+
- support for flapping events to be created (@majormoses)
|
7
12
|
|
8
13
|
## [2.2.0] - 2017-03-23
|
9
14
|
### Added
|
@@ -98,7 +103,8 @@ marking it as a stable 1.0.0 release.
|
|
98
103
|
### Added
|
99
104
|
- initial release
|
100
105
|
|
101
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-pagerduty/compare/
|
106
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-pagerduty/compare/3.0.0...HEAD
|
107
|
+
[3.0.0]: https://github.com/sensu-plugins/sensu-plugins-pagerduty/compare/2.2.0...3.0.0
|
102
108
|
[2.2.0]: https://github.com/sensu-plugins/sensu-plugins-pagerduty/compare/2.1.0...2.2.0
|
103
109
|
[2.1.0]: https://github.com/sensu-plugins/sensu-plugins-pagerduty/compare/2.0.0...2.1.0
|
104
110
|
[2.0.0]: https://github.com/sensu-plugins/sensu-plugins-pagerduty/compare/1.0.0...2.0.0
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
## Usage of Handler
|
16
16
|
|
17
|
-
PagerDuty supports dedup. Dedup is useful when you want to create a single alert (for a group of checks). Only one alert is sent out even if the checks fail at the same time. The following example groups check_service_`n` together for a single host. `dedup_rules` take in regular expressions as keys and re-write rules as values. `dedup_rules` entry is optional.
|
17
|
+
PagerDuty supports dedup. Dedup is useful when you want to create a single alert (for a group of checks). Only one alert is sent out even if the checks fail at the same time. The following example groups check_service_`n` together for a single host. `dedup_rules` take in regular expressions as keys and re-write rules as values. `dedup_rules` entry is optional.
|
18
18
|
|
19
19
|
```
|
20
20
|
{
|
@@ -33,7 +33,7 @@ PagerDuty supports dedup. Dedup is useful when you want to create a single alert
|
|
33
33
|
}
|
34
34
|
```
|
35
35
|
|
36
|
-
In the Client hash you can define a `pager_team` key value pair. If the the client hash contains the `pager_team` key it will then no longer use the default `pagerduty.api_key` from the above hash but will look for the value given in the client. The following client hash will alert using the team_name1 api key instead of the default api_key. This will allow different teams/hosts to alert different escalation paths.
|
36
|
+
In the Client hash you can define a `pager_team` key value pair. If the the client hash contains the `pager_team` key it will then no longer use the default `pagerduty.api_key` from the above hash but will look for the value given in the client. The following client hash will alert using the team_name1 api key instead of the default api_key. This will allow different teams/hosts to alert different escalation paths.
|
37
37
|
|
38
38
|
```
|
39
39
|
{
|
@@ -54,6 +54,27 @@ Please note, this sets the escalation path on the whole host. If you want more g
|
|
54
54
|
|
55
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
56
|
|
57
|
+
Another approach would be define this on a per check basis like so:
|
58
|
+
```
|
59
|
+
{
|
60
|
+
"checks": {
|
61
|
+
"cpu": {
|
62
|
+
"command": "check-cpu.rb -w 90 -c 100",
|
63
|
+
"subscribers": [
|
64
|
+
"base"
|
65
|
+
],
|
66
|
+
"handlers": [
|
67
|
+
"pagerduty"
|
68
|
+
],
|
69
|
+
"interval": 15,
|
70
|
+
"pager_team": "team1",
|
71
|
+
"notification": "CPU is running hot!",
|
72
|
+
"occurrences": 8
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
```
|
77
|
+
|
57
78
|
## Usage of Priority Overide Mutator
|
58
79
|
|
59
80
|
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:
|
@@ -123,7 +144,7 @@ And I also have the following client hash:
|
|
123
144
|
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.
|
124
145
|
|
125
146
|
|
126
|
-
## Adding Dynamic Event Description Prefix
|
147
|
+
## Adding Dynamic Event Description Prefix
|
127
148
|
|
128
149
|
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
150
|
|
@@ -136,6 +157,17 @@ You can add a custom field from the Sensu client config as a description prefix,
|
|
136
157
|
}
|
137
158
|
```
|
138
159
|
|
160
|
+
## Flapping Incidents
|
161
|
+
By default handlers do not handle flapping incidents: [handler configuration documentation](https://sensuapp.org/docs/0.24/reference/handlers.html#handler-configuration) in order to change this you must set handle_flapping in your handler config like this:
|
162
|
+
```json
|
163
|
+
{
|
164
|
+
"pagerduty": {
|
165
|
+
"api_key": "12345",
|
166
|
+
"handle_flapping": true
|
167
|
+
}
|
168
|
+
}
|
169
|
+
```
|
170
|
+
|
139
171
|
## Installation
|
140
172
|
|
141
173
|
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
data/bin/handler-pagerduty.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
#
|
11
11
|
# Note: The sensu api token could also be configured on a per client or per check basis.
|
12
12
|
# By defining the "pager_team" attribute in the client config file or the check config.
|
13
|
-
# The override order will be
|
13
|
+
# The override order will be check > client > json_config
|
14
14
|
#
|
15
15
|
# Dependencies:
|
16
16
|
#
|
@@ -47,10 +47,10 @@ class PagerdutyHandler < Sensu::Handler
|
|
47
47
|
|
48
48
|
def api_key
|
49
49
|
@api_key ||=
|
50
|
-
if @event['
|
51
|
-
settings[json_config][@event['client']['pager_team']]['api_key']
|
52
|
-
elsif @event['check']['pager_team']
|
50
|
+
if @event['check']['pager_team']
|
53
51
|
settings[json_config][@event['check']['pager_team']]['api_key']
|
52
|
+
elsif @event['client']['pager_team']
|
53
|
+
settings[json_config][@event['client']['pager_team']]['api_key']
|
54
54
|
else
|
55
55
|
settings[json_config]['api_key']
|
56
56
|
end
|
@@ -98,7 +98,7 @@ class PagerdutyHandler < Sensu::Handler
|
|
98
98
|
|
99
99
|
begin
|
100
100
|
case @event['action']
|
101
|
-
when 'create'
|
101
|
+
when 'create', 'flapping'
|
102
102
|
pagerduty.trigger([description_prefix, event_summary].compact.join(' '),
|
103
103
|
incident_key: [incident_key_prefix, incident_key].compact.join(''),
|
104
104
|
details: @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:
|
4
|
+
version: 3.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: 2017-
|
11
|
+
date: 2017-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|