sensu-plugins-ecityruf 0.2.0 → 0.2.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 +4 -4
- data/bin/handler-ecityruf.rb +54 -0
- data/lib/sensu/plugins/ecityruf/version.rb +1 -1
- data/sensu-plugins-ecityruf.gemspec +5 -5
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec6a3eeefaabc2fa3b19c8f57577486a2d1607d8
|
4
|
+
data.tar.gz: 622b52568eb04bd08181086aaf31ac687f5c30b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc0a646d773f2ba207f90f0170e5a93b71abde141618ab806c40be7bed794df2b9191c74f50db96ab21b1b5b67bb969cc602d02e6abfebfc7cc0c179545a4f3e
|
7
|
+
data.tar.gz: 93dad9351e2fb5fada108490f481a6d5537bb59c6d840a17fe1f5f0d5440bb04b71ddb493c899a7f69d5742952353c2c89877e7f3d96c1c31d97cc285160eb5e
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Sensu Handler: ecityruf
|
4
|
+
#
|
5
|
+
# This handler formats alerts and sends them off to the ecityruf service.
|
6
|
+
#
|
7
|
+
# Copyright 2018 Hauke Altmann, about source GmbH
|
8
|
+
#
|
9
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
10
|
+
# for details.
|
11
|
+
|
12
|
+
require 'net/https'
|
13
|
+
require 'sensu-handler'
|
14
|
+
require 'timeout'
|
15
|
+
|
16
|
+
class Ecityruf < Sensu::Handler
|
17
|
+
def event_name
|
18
|
+
@event['client']['name'] + '/' + @event['check']['name']
|
19
|
+
end
|
20
|
+
|
21
|
+
def handle
|
22
|
+
apiurl = settings['ecityruf']['url'] || 'https://inetgateway.emessage.de/cgi-bin/funkruf2.cgi'
|
23
|
+
|
24
|
+
params = {
|
25
|
+
'action' => 'SendMessage',
|
26
|
+
'class' => '4',
|
27
|
+
'language' => settings['ecityruf']['language'] || 'de',
|
28
|
+
'number' => settings['ecityruf']['number'],
|
29
|
+
#'number' => '5200139',
|
30
|
+
'lengthAlert' => '',
|
31
|
+
'service' => '1',
|
32
|
+
'message' => event_name + '/' + @event['check']['output']
|
33
|
+
#'message' => 'https2'
|
34
|
+
}
|
35
|
+
|
36
|
+
uri = URI.parse(apiurl)
|
37
|
+
uri.query = URI.encode_www_form(params)
|
38
|
+
|
39
|
+
begin
|
40
|
+
Timeout.timeout(5) do
|
41
|
+
Net::HTTP.start(uri.host, uri.port,
|
42
|
+
:use_ssl => uri.scheme == 'https', :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
|
43
|
+
request = Net::HTTP::Get.new uri
|
44
|
+
|
45
|
+
response = http.request request
|
46
|
+
puts response.code
|
47
|
+
end
|
48
|
+
puts 'ecityruf -- sent alert to number: ' + params['number'] + '.'
|
49
|
+
end
|
50
|
+
rescue Timeout::Error
|
51
|
+
puts 'ecityruf -- timed out while attempting to alert about an incident -- ' + event_name
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -9,19 +9,20 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.version = Sensu::Plugins::Ecityruf::VERSION
|
10
10
|
spec.authors = ["Hauke Altmann"]
|
11
11
|
spec.email = ["hauke.altmann@aboutsource.net"]
|
12
|
+
spec.executables = Dir.glob('bin/**/*.rb').map { |file| File.basename(file) }
|
13
|
+
spec.files = Dir.glob('{bin,lib}/**/*') + %w(LICENSE.txt README.md)
|
14
|
+
spec.platform = Gem::Platform::RUBY
|
15
|
+
spec.require_paths = ['lib']
|
16
|
+
spec.required_ruby_version = '>= 2.0.0'
|
12
17
|
|
13
18
|
spec.summary = "Sensu handler for ecityruf service"
|
14
19
|
spec.description = "Handler to allow to alert connected pagers over ecityruf on events."
|
15
20
|
spec.homepage = "https://www.aboutsource.net"
|
16
21
|
spec.license = "MIT"
|
17
|
-
spec.required_ruby_version = '>= 2.0.0'
|
18
22
|
|
19
23
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
20
24
|
f.match(%r{^(test|spec|features)/})
|
21
25
|
end
|
22
|
-
spec.bindir = "exe"
|
23
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
-
spec.require_paths = ["lib"]
|
25
26
|
|
26
27
|
spec.add_runtime_dependency 'sensu-plugin', '~> 1.2'
|
27
28
|
|
@@ -33,5 +34,4 @@ Gem::Specification.new do |spec|
|
|
33
34
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
34
35
|
spec.add_development_dependency 'redcarpet', '~> 3.2'
|
35
36
|
spec.add_development_dependency 'yard', '~> 0.8'
|
36
|
-
|
37
37
|
end
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-ecityruf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hauke Altmann
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2018-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
@@ -139,7 +139,8 @@ dependencies:
|
|
139
139
|
description: Handler to allow to alert connected pagers over ecityruf on events.
|
140
140
|
email:
|
141
141
|
- hauke.altmann@aboutsource.net
|
142
|
-
executables:
|
142
|
+
executables:
|
143
|
+
- handler-ecityruf.rb
|
143
144
|
extensions: []
|
144
145
|
extra_rdoc_files: []
|
145
146
|
files:
|
@@ -151,6 +152,7 @@ files:
|
|
151
152
|
- README.md
|
152
153
|
- Rakefile
|
153
154
|
- bin/console
|
155
|
+
- bin/handler-ecityruf.rb
|
154
156
|
- bin/setup
|
155
157
|
- lib/sensu/plugins/ecityruf.rb
|
156
158
|
- lib/sensu/plugins/ecityruf/version.rb
|