sensu-handler-prowl 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 116a2b02ab1309acfdbf1131d073ca1dbbf9797a
4
+ data.tar.gz: 90ef69fb2f8c3c55ba20ebc4141d99178166a26f
5
+ SHA512:
6
+ metadata.gz: 448c6024b25c1f2089ea6fae1394e48ffbf5536d38ce7fe1134cb3071c5c4565a7a24d4019ba3ecc432073ca36bd71fe633409c8ded5a1d0c0c755597bd7f92b
7
+ data.tar.gz: 5689beaacbc9fc2bcfc164bc7c56d2db13d3f2b2b8a18beba6ae0df357c7ecab2a2a1a34ffffabca470be68066b54184c585c232ba7d8c2c0c9c76aabafdb7a3
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ #Change Log
2
+ This project adheres to [Semantic Versioning](http://semver.org/).
3
+
4
+ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
+
6
+ ## Unreleased
7
+
8
+ ## 0.0.1 - 2016-02-15
9
+ ### Added
10
+ - initial release
11
+
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Andre Tiengo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ ## sensu-handler-prowl
2
+
3
+ ## Functionality
4
+ This is a Sensu Handler to send notifications to a [Prowl](http://www.prowlapp.com/) user, and it follows some patterns from [sensu-plugins](http://sensu-plugins.io).
5
+
6
+ ## Files
7
+ * bin/handler-prowl.rb
8
+
9
+ ## Usage
10
+
11
+ ```
12
+ {
13
+ "prowl": {
14
+ "apikey": "abcdefg1234",
15
+ "application": "Sensu"
16
+ }
17
+ }
18
+ ```
19
+ ## Installation
20
+
21
+ [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
22
+
23
+ ## Notes
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Sensu Handler: prowl
4
+ #
5
+ # This handler script is used to send notifications to Prowl application.
6
+ #
7
+ # Note: The default prowl config is fetched from the predefined json config file which is "prowl.json" or any other
8
+ # file defiend using the "json_config" command line option. The apikey could also be configured on a per client basis
9
+ # by defining the "prowl_apikey" attribute in the client config file. This will override the default prowl apikey where the
10
+ # alerts are being routed to for that particular client.
11
+
12
+ require 'sensu-handler'
13
+ require 'prowl'
14
+ require 'timeout'
15
+
16
+ class ProwlSensu < Sensu::Handler
17
+ option :json_config,
18
+ description: 'Config Name',
19
+ short: '-j JsonConfig',
20
+ long: '--json_config JsonConfig',
21
+ required: false
22
+
23
+ def event_name
24
+ @event['client']['name'] + '/' + @event['check']['name']
25
+ end
26
+
27
+ def handle
28
+ json_config = config[:json_config] || 'prowl'
29
+ apikey = @event['client']['prowl_apikey'] || @event['check']['prowl_apikey'] || settings[json_config]['apikey']
30
+ application = settings[json_config]['application'] || 'SENSU'
31
+
32
+ prowl_message = Prowl.new(apikey: apikey, application: application)
33
+ message = @event['check']['notification'] || @event['check']['output']
34
+
35
+ begin
36
+ timeout(15) do
37
+ if @event['action'].eql?('resolve')
38
+ prowl_message.add(:event => "RESOLVED - [#{event_name}]", :description => "#{message}.")
39
+ else
40
+ prowl_message.add(:event => "ALERT - [#{event_name}]", :description => "#{message}.")
41
+ end
42
+ end
43
+ rescue Timeout::Error
44
+ puts "prowl -- timed out while attempting to message #{apikey}"
45
+ end
46
+ end
47
+ end
@@ -0,0 +1 @@
1
+ require 'sensu-handler-prowl/version'
@@ -0,0 +1,9 @@
1
+ module SensuHandlerProwl
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ PATCH = 1
6
+
7
+ VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,205 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-handler-prowl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Andre Tiengo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sensu-plugin
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: prowl
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.4
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codeclimate-test-reporter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: github-markup
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.10'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.10'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '10.5'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '10.5'
111
+ - !ruby/object:Gem::Dependency
112
+ name: redcarpet
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.2'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.2'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.4'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.4'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.37'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.37'
153
+ - !ruby/object:Gem::Dependency
154
+ name: yard
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '0.8'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '0.8'
167
+ description: Sensu handler for prowl notifications
168
+ email: "<andretiengo@gmail.com>"
169
+ executables:
170
+ - handler-prowl.rb
171
+ extensions: []
172
+ extra_rdoc_files: []
173
+ files:
174
+ - CHANGELOG.md
175
+ - LICENSE
176
+ - README.md
177
+ - bin/handler-prowl.rb
178
+ - lib/sensu-plugins-prowl.rb
179
+ - lib/sensu-plugins-prowl/version.rb
180
+ homepage: https://github.com/tiengo/sensu-handler-prowl
181
+ licenses:
182
+ - MIT
183
+ metadata: {}
184
+ post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
185
+ in /etc/default/sensu
186
+ rdoc_options: []
187
+ require_paths:
188
+ - lib
189
+ required_ruby_version: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: 1.9.3
194
+ required_rubygems_version: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
199
+ requirements: []
200
+ rubyforge_project:
201
+ rubygems_version: 2.5.1
202
+ signing_key:
203
+ specification_version: 4
204
+ summary: Sensu handler for prowl notifications
205
+ test_files: []