sensu-plugins-statuspage 0.0.3 → 1.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 +4 -4
- data/CHANGELOG.md +19 -3
- data/README.md +23 -3
- data/bin/handler-statuspage.rb +83 -27
- data/lib/sensu-plugins-statuspage/version.rb +2 -2
- metadata +14 -36
- checksums.yaml.gz.sig +0 -3
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17f82413bbc20447f8047aaa45918250ff8cfbe8
|
4
|
+
data.tar.gz: 2ee59c6f4026607abd7ff6a1d2b48976ec7c9132
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f64d08b60b7c8711e80af99b34a94c9657ee28f1da2d5157dedaad2a39c0924be9b5b0fb637de0962a6d1c130cec5acee4e6934e0795c8ffd1833a914be76fc3
|
7
|
+
data.tar.gz: 62928df748d60ae9e0a488c33f211775748b6311b70418d5ea54046c1267adcf742429c5ca7f8709202ca732616dd9d34b03893692ae2483068ad6b0cb4dab54
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,23 @@
|
|
1
|
-
#Change Log
|
1
|
+
# Change Log
|
2
2
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
3
3
|
|
4
4
|
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [1.0.0] - 2017-05-16
|
9
|
+
### Added
|
10
|
+
- Support for Ruby 2.3 and 2.4 (@eheydrick)
|
11
|
+
|
12
|
+
### Removed
|
13
|
+
- Support for Ruby < 2 (@eheydrick)
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
- Allow desired component/incident status configuration per check. (@athal7)
|
17
|
+
- Update existing incidents on any change, not just on resolution. (@athal7)
|
18
|
+
- 'minor' alerts are now mapped to 'partial_outage' component status (@athal7)
|
19
|
+
- All alerts make the incident status 'identified' rather than 'investigating' (@athal7)
|
20
|
+
|
8
21
|
## [0.0.3] - 2015-12-30
|
9
22
|
### Changed
|
10
23
|
- fixed incident resolving
|
@@ -13,8 +26,11 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
13
26
|
### Changed
|
14
27
|
- updated sensu-plugin gem to 1.2.0
|
15
28
|
|
16
|
-
##
|
17
|
-
|
29
|
+
## 0.0.1 - 2015-07-04
|
18
30
|
### Added
|
19
31
|
- initial release
|
20
32
|
|
33
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-statuspage/compare/1.0.0...HEAD
|
34
|
+
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-statuspage/compare/0.0.3...1.0.0
|
35
|
+
[0.0.3]: https://github.com/sensu-plugins/sensu-plugins-statuspage/compare/0.0.2...0.0.3
|
36
|
+
[0.0.2]: https://github.com/sensu-plugins/sensu-plugins-statuspage/compare/0.0.1...0.0.2
|
data/README.md
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
## Sensu-Plugins-statuspage
|
2
2
|
|
3
|
-
[
|
3
|
+
[](https://travis-ci.org/sensu-plugins/sensu-plugins-statuspage)
|
4
4
|
[](http://badge.fury.io/rb/sensu-plugins-statuspage)
|
5
5
|
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-statuspage)
|
6
6
|
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-statuspage)
|
7
7
|
[](https://gemnasium.com/sensu-plugins/sensu-plugins-statuspage)
|
8
|
-
[ ](https://codeship.com/projects/84066)
|
9
8
|
|
10
9
|
## Functionality
|
11
10
|
|
@@ -61,7 +60,7 @@ gem build redphone.gemspec OR /opt/sensu/embedded/bin/gem build redphone.gemsp
|
|
61
60
|
gem install redphone-0.0.6.gem OR /opt/sensu/embedded/bin/gem install redphone-0.0.6.gem
|
62
61
|
```
|
63
62
|
|
64
|
-
To update a component add a
|
63
|
+
To update a component add a `"component_id": "IDHERE"` attribute to the corresponding check definition
|
65
64
|
|
66
65
|
Example:
|
67
66
|
```
|
@@ -77,3 +76,24 @@ Example:
|
|
77
76
|
}
|
78
77
|
}
|
79
78
|
```
|
79
|
+
|
80
|
+
To choose your own component or incident statuses instead of the defaults add the `statuspage_<component/incident>_<status>` in the check definition.
|
81
|
+
|
82
|
+
Example:
|
83
|
+
```
|
84
|
+
{
|
85
|
+
"checks": {
|
86
|
+
"check_sshd": {
|
87
|
+
"handlers": ["statuspage"],
|
88
|
+
"component_id": "IDHERE",
|
89
|
+
"statuspage_component_warning": "degraded_performance",
|
90
|
+
"statuspage_component_critical": "partial_outage",
|
91
|
+
"statuspage_incident_warning": "ignore",
|
92
|
+
"statuspage_incident_critical": "identified",
|
93
|
+
"command": "/etc/sensu/plugins/check-procs.rb -p sshd -C 1 ",
|
94
|
+
"interval": 60,
|
95
|
+
"subscribers": [ "default" ]
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
```
|
data/bin/handler-statuspage.rb
CHANGED
@@ -13,57 +13,113 @@
|
|
13
13
|
require 'sensu-handler'
|
14
14
|
require 'redphone/statuspage'
|
15
15
|
|
16
|
+
ALLOWED_COMPONENT_STATUSES = %w(operational degraded_performance partial_outage major_outage ignore).freeze
|
17
|
+
DEFAULT_COMPONENT_STATUSES = {
|
18
|
+
'warning' => 'partial_outage',
|
19
|
+
'critical' => 'major_outage'
|
20
|
+
}.freeze
|
21
|
+
|
22
|
+
ALLOWED_INCIDENT_STATUSES = %w(investigating identified monitoring resolved ignore).freeze
|
23
|
+
DEFAULT_INCIDENT_STATUSES = {
|
24
|
+
'warning' => 'identified',
|
25
|
+
'critical' => 'identified'
|
26
|
+
}.freeze
|
27
|
+
|
16
28
|
# main plugin class
|
17
29
|
class StatusPage < Sensu::Handler
|
18
30
|
def incident_key
|
19
31
|
@event['client']['name'] + '/' + @event['check']['name']
|
20
32
|
end
|
21
33
|
|
34
|
+
def status_name
|
35
|
+
case @event['check']['status']
|
36
|
+
when 1
|
37
|
+
'warning'
|
38
|
+
when 2
|
39
|
+
'critical'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def component_status
|
44
|
+
case @event['action']
|
45
|
+
when 'create'
|
46
|
+
desired_status = @event['check']["statuspage_component_#{status_name}"]
|
47
|
+
if desired_status && ALLOWED_COMPONENT_STATUSES.include?(desired_status)
|
48
|
+
desired_status
|
49
|
+
else
|
50
|
+
DEFAULT_COMPONENT_STATUSES[status_name]
|
51
|
+
end
|
52
|
+
when 'resolve'
|
53
|
+
'operational'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def incident_status
|
58
|
+
case @event['action']
|
59
|
+
when 'create'
|
60
|
+
desired_status = @event['check']["statuspage_incident_#{status_name}"]
|
61
|
+
if desired_status && ALLOWED_INCIDENT_STATUSES.include?(desired_status)
|
62
|
+
desired_status
|
63
|
+
else
|
64
|
+
DEFAULT_INCIDENT_STATUSES[status_name]
|
65
|
+
end
|
66
|
+
when 'resolve'
|
67
|
+
'resolved'
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def ignore_status?(status)
|
72
|
+
['ignore', nil].include?(status)
|
73
|
+
end
|
74
|
+
|
75
|
+
def description
|
76
|
+
@event['notification'] || [@event['client']['name'], @event['check']['name'], @event['check']['output']].join(' : ')
|
77
|
+
end
|
78
|
+
|
79
|
+
def incident_message(status)
|
80
|
+
if status == 'resolved'
|
81
|
+
"Problem with #{incident_key} has been resolved."
|
82
|
+
else
|
83
|
+
"There has been a problem: #{description}."
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
22
87
|
def handle
|
23
88
|
statuspage = Redphone::Statuspage.new(
|
24
89
|
page_id: settings['statuspage']['page_id'],
|
25
90
|
api_key: settings['statuspage']['api_key']
|
26
91
|
)
|
27
|
-
description = @event['notification'] || [@event['client']['name'], @event['check']['name'], @event['check']['output']].join(' : ')
|
28
92
|
begin
|
29
93
|
timeout(3) do
|
30
94
|
if @event['check'].key?('component_id')
|
31
|
-
|
32
|
-
when 'create'
|
33
|
-
'major_outage'
|
34
|
-
when 'resolve'
|
35
|
-
'operational'
|
36
|
-
end
|
37
|
-
unless status.nil?
|
95
|
+
unless ignore_status?(component_status)
|
38
96
|
statuspage.update_component(
|
39
97
|
component_id: @event['check']['component_id'],
|
40
|
-
status:
|
98
|
+
status: component_status
|
99
|
+
)
|
41
100
|
end
|
42
101
|
end
|
43
|
-
|
44
|
-
|
45
|
-
statuspage.
|
102
|
+
existing_incident = statuspage.get_all_incidents.detect { |incident| incident['name'] == incident_key && incident['status'] != 'resolved' }
|
103
|
+
response = if existing_incident
|
104
|
+
statuspage.update_incident(
|
46
105
|
name: incident_key,
|
47
|
-
status: 'investigating',
|
48
106
|
wants_twitter_update: 'f',
|
49
|
-
|
107
|
+
status: incident_status,
|
108
|
+
incident_id: existing_incident['id'],
|
109
|
+
message: incident_message(incident_status)
|
50
110
|
)
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
incident_id = incident['id']
|
56
|
-
break
|
57
|
-
end
|
58
|
-
end
|
59
|
-
statuspage.update_incident(
|
60
|
-
name: "Problem with #{incident_key} has been resolved.",
|
111
|
+
elsif !ignore_status?(incident_status)
|
112
|
+
statuspage.create_realtime_incident(
|
113
|
+
name: incident_key,
|
114
|
+
status: incident_status,
|
61
115
|
wants_twitter_update: 'f',
|
62
|
-
|
63
|
-
incident_id: incident_id
|
116
|
+
message: incident_message(incident_status)
|
64
117
|
)
|
65
118
|
end
|
66
|
-
if (
|
119
|
+
if ignore_status?(incident_status) ||
|
120
|
+
(response['status'] == incident_status && @event['action'] == 'create') ||
|
121
|
+
(response['status'] == 'resolved' && @event['action'] == 'resolve')
|
122
|
+
|
67
123
|
puts 'statuspage -- ' + @event['action'].capitalize + 'd incident -- ' + incident_key
|
68
124
|
else
|
69
125
|
puts 'statuspage -- failed to ' + @event['action'] + ' incident -- ' + incident_key
|
metadata
CHANGED
@@ -1,51 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-statuspage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu-Plugins and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
-
|
12
|
-
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRIwEAYDVQQDDAltYXR0
|
14
|
-
am9uZXMxGDAWBgoJkiaJk/IsZAEZFgh5aWVsZGJvdDETMBEGCgmSJomT8ixkARkW
|
15
|
-
A2NvbTAeFw0xNTAxMjgyMTAyNTFaFw0xNjAxMjgyMTAyNTFaMEMxEjAQBgNVBAMM
|
16
|
-
CW1hdHRqb25lczEYMBYGCgmSJomT8ixkARkWCHlpZWxkYm90MRMwEQYKCZImiZPy
|
17
|
-
LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyTSzVYnO
|
18
|
-
CLgyrIyT1mBQakArQyW8xhi6MlDqyzXHJGeERT790U6EgoBVeS4XoK0ptFZNR8Tf
|
19
|
-
zko0w+Nv47TarSCgkPOaxY+mxWnAVR10dOmfeLr7huiMyps+YD56/EF2FqQ3jf/+
|
20
|
-
qohENfKD91qy1ieEy+Fn7Pf74ltbNKUdkb9a9eFXQ0DQ4ip5vik7DzjQkUTj4lca
|
21
|
-
k6ArwnmHX4YDhZoYtrQJ8jVktN0/+NtA40M5qkCYHNe5tUW25b/tKVYuioxG6b2Z
|
22
|
-
oIzaZxRLxf6HVAWpCVRT/F5+/yjigkX4u++eYacfLGleXQzoK7BL65vHGMJygWEE
|
23
|
-
0TKGqFOrl/L0AQIDAQABo38wfTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
|
24
|
-
HQ4EFgQUEf6a8Td7MrSZc8ImbLFZAENPbz0wIQYDVR0RBBowGIEWbWF0dGpvbmVz
|
25
|
-
QHlpZWxkYm90LmNvbTAhBgNVHRIEGjAYgRZtYXR0am9uZXNAeWllbGRib3QuY29t
|
26
|
-
MA0GCSqGSIb3DQEBBQUAA4IBAQBbzXAYA3BVGw8DZ0YYoY1VHPNEcH5qPIApmHO8
|
27
|
-
rvSmuUT0yMEi7u00H/5uHRFf4LleGT/+sTdyXKsNPGT9kdRuQEgwi+vf7Zfvd8aX
|
28
|
-
UF/+4VkEYf/8rV8Ere6u2QaWPgApdMV6JjKr1fAwCTd8AuGXNaWItiPPMseSQzLJ
|
29
|
-
JKP4hVvbc1d+oS925B1lcBiqn2aYvElbyNAVmQPywNNqkWmvtlqj9ZVJfV5HQLdu
|
30
|
-
8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
|
31
|
-
HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
|
32
|
-
-----END CERTIFICATE-----
|
33
|
-
date: 2016-01-05 00:00:00.000000000 Z
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-17 00:00:00.000000000 Z
|
34
12
|
dependencies:
|
35
13
|
- !ruby/object:Gem::Dependency
|
36
14
|
name: sensu-plugin
|
37
15
|
requirement: !ruby/object:Gem::Requirement
|
38
16
|
requirements:
|
39
|
-
- -
|
17
|
+
- - "~>"
|
40
18
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.2
|
19
|
+
version: '1.2'
|
42
20
|
type: :runtime
|
43
21
|
prerelease: false
|
44
22
|
version_requirements: !ruby/object:Gem::Requirement
|
45
23
|
requirements:
|
46
|
-
- -
|
24
|
+
- - "~>"
|
47
25
|
- !ruby/object:Gem::Version
|
48
|
-
version: 1.2
|
26
|
+
version: '1.2'
|
49
27
|
- !ruby/object:Gem::Dependency
|
50
28
|
name: httparty
|
51
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,16 +112,16 @@ dependencies:
|
|
134
112
|
name: rubocop
|
135
113
|
requirement: !ruby/object:Gem::Requirement
|
136
114
|
requirements:
|
137
|
-
- -
|
115
|
+
- - "~>"
|
138
116
|
- !ruby/object:Gem::Version
|
139
|
-
version: 0.
|
117
|
+
version: 0.40.0
|
140
118
|
type: :development
|
141
119
|
prerelease: false
|
142
120
|
version_requirements: !ruby/object:Gem::Requirement
|
143
121
|
requirements:
|
144
|
-
- -
|
122
|
+
- - "~>"
|
145
123
|
- !ruby/object:Gem::Version
|
146
|
-
version: 0.
|
124
|
+
version: 0.40.0
|
147
125
|
- !ruby/object:Gem::Dependency
|
148
126
|
name: rspec
|
149
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -203,8 +181,8 @@ dependencies:
|
|
203
181
|
description: Sensu statuspage plugins
|
204
182
|
email: "<sensu-users@googlegroups.com>"
|
205
183
|
executables:
|
206
|
-
- metrics-statuspageio.rb
|
207
184
|
- handler-statuspage.rb
|
185
|
+
- metrics-statuspageio.rb
|
208
186
|
extensions: []
|
209
187
|
extra_rdoc_files: []
|
210
188
|
files:
|
@@ -233,7 +211,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
233
211
|
requirements:
|
234
212
|
- - ">="
|
235
213
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
214
|
+
version: 2.0.0
|
237
215
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
238
216
|
requirements:
|
239
217
|
- - ">="
|
@@ -241,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
219
|
version: '0'
|
242
220
|
requirements: []
|
243
221
|
rubyforge_project:
|
244
|
-
rubygems_version: 2.4.
|
222
|
+
rubygems_version: 2.4.5
|
245
223
|
signing_key:
|
246
224
|
specification_version: 4
|
247
225
|
summary: Sensu plugins for statuspage
|
checksums.yaml.gz.sig
DELETED
data.tar.gz.sig
DELETED
Binary file
|
metadata.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
#{)^�+5����><���$3������<_S��Je�����*2����ܑՀ��˒��#�8�j��6fN�~�U�;��ty����)�����9�=��M��(B�������f$0Z�B�����ָ�Gj����UdHq�y�_�B�m����\��q0�R���
|