sensu-plugins-ecityruf 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d8a42198ed7228360e92cece40358e51f99e639a
4
- data.tar.gz: 46913b6f90b12257db4305ea69aa6a65bbf3f1f7
2
+ SHA256:
3
+ metadata.gz: d2f4592201d5b06488344a01df862fcb70a50f7c6332c384b8532eb0343437c5
4
+ data.tar.gz: 919b5a5434ffe2771a7ce4c106c6aacf19c17a1a7db1370feeca920c9924df17
5
5
  SHA512:
6
- metadata.gz: 77a5a73e2741ce2669fad4468156982975b9ad0365678d9b122713d327e770abdf9308e82f9b730530a2624ea47c711aaa5924f2339e0b43a7dd3788cf1e1b9d
7
- data.tar.gz: 51f7dd8ef7c33325db5063483813b36e11f8dcfda7ec0de9c8dbec55af6072a46cf77ce07cc5033e1178b75cff544b7a347508282aa552cbba76edd05771e5fa
6
+ metadata.gz: 3f5e011bb5dad5c7ec63acc3f2772766dc7fe0ea66a5d5b8632c546b30b0f76639d3718962c4dcdc754231c7a2e3625828f239736061ed6a495fcb47936ee181
7
+ data.tar.gz: 2ce44a3b0fe5049cc9693b5e817d92e0bc20381f78531787b4cc8ead70cae90a42d4f6acfd9595a46adcb7cfd1311b1a3784f7ed07d7d1af85c80542c26a5980
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
1
+ Copyright (c) 2018 about:source GmbH
2
2
 
3
- Copyright (c) 2018 Hauke Altmann
3
+ MIT License
4
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:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
11
 
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
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
21
- THE SOFTWARE.
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Sensu::Plugins::Ecityruf
2
2
 
3
+ [![Build Status](https://travis-ci.org/aboutsource/sensu-plugins-ecityruf.svg?branch=master)](https://travis-ci.org/aboutsource/sensu-plugins-ecityruf)
4
+
3
5
  Sensu Handler to send messages to pagers using eCityruf with a `Sammelrufnummer`.
4
6
 
5
7
  ## Installation
@@ -37,6 +39,11 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
37
39
 
38
40
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
39
41
 
42
+ ## Contributing
43
+
44
+ Bug reports and pull requests are welcome on GitHub at
45
+ https://github.com/aboutsource/sensu-plugins-ecityruf.
46
+
40
47
  ## License
41
48
 
42
49
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'sensu/plugins/ecityruf'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require 'pry'
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
@@ -13,11 +13,7 @@ require 'net/https'
13
13
  require 'sensu-handler'
14
14
  require 'timeout'
15
15
 
16
- class Ecityruf < Sensu::Handler
17
- def event_name
18
- @event['client']['name'] + '/' + @event['check']['name']
19
- end
20
-
16
+ class HandlerEcityruf < Sensu::Handler
21
17
  def handle
22
18
  apiurl = settings['ecityruf']['url'] || 'https://inetgateway.emessage.de/cgi-bin/funkruf2.cgi'
23
19
 
@@ -28,23 +24,28 @@ class Ecityruf < Sensu::Handler
28
24
  'number' => settings['ecityruf']['number'],
29
25
  'lengthAlert' => '',
30
26
  'service' => '1',
31
- 'message' => event_name + '/' + @event['check']['output']
27
+ 'message' => format('%<message>0.79s',
28
+ message: [@event['client']['name'],
29
+ @event['check']['output']].join('/'))
32
30
  }
33
31
 
34
32
  uri = URI.parse(apiurl)
35
33
  uri.query = URI.encode_www_form(params)
36
34
 
37
35
  Timeout.timeout(60) do
38
- Net::HTTP.start(uri.host,
39
- uri.port,
36
+ Net::HTTP.start(uri.host, uri.port,
40
37
  use_ssl: uri.scheme == 'https',
41
38
  verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
42
39
  request = Net::HTTP::Get.new uri
43
-
44
40
  response = http.request request
45
- puts response.code
41
+
42
+ puts format('sent alert %<alert>s to number %<number>d',
43
+ alert: [@event['client']['name'],
44
+ @event['check']['name']].join('/'),
45
+ number: params['number'])
46
+
47
+ puts format('response: %<response_code>d', response_code: response.code)
46
48
  end
47
- puts 'ecityruf -- sent alert ' + event_name + ' to number ' + params['number'] + '.'
48
49
  end
49
50
  end
50
51
  end
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install --path vendor/bundle
7
+
8
+ # Do any other automated setup that you need to do here
@@ -1,7 +1,7 @@
1
1
  module Sensu
2
2
  module Plugins
3
3
  module Ecityruf
4
- VERSION = '0.3.2'
4
+ VERSION = '0.4.0'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-ecityruf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hauke Altmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-05 00:00:00.000000000 Z
11
+ date: 2018-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
@@ -39,48 +39,62 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.16'
41
41
  - !ruby/object:Gem::Dependency
42
- name: pry
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.10'
47
+ version: '10.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.10'
54
+ version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '3.7'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '3.7'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.32.1
75
+ version: '0.54'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.54'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.3'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: 0.32.1
83
- description: Handler to allow to alert connected pagers over ecityruf on events.
96
+ version: '3.3'
97
+ description: Handler to alert e*Cityruf pagers
84
98
  email:
85
99
  - hauke.altmann@aboutsource.net
86
100
  executables:
@@ -88,9 +102,11 @@ executables:
88
102
  extensions: []
89
103
  extra_rdoc_files: []
90
104
  files:
91
- - LICENSE.txt
105
+ - LICENSE
92
106
  - README.md
107
+ - bin/console
93
108
  - bin/handler-ecityruf.rb
109
+ - bin/setup
94
110
  - lib/sensu/plugins/ecityruf.rb
95
111
  - lib/sensu/plugins/ecityruf/version.rb
96
112
  homepage: https://www.aboutsource.net
@@ -113,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
129
  version: '0'
114
130
  requirements: []
115
131
  rubyforge_project:
116
- rubygems_version: 2.6.14
132
+ rubygems_version: 2.7.6
117
133
  signing_key:
118
134
  specification_version: 4
119
135
  summary: Sensu handler for ecityruf service