sensu-plugins-tcpping 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f7212b4150a11a06ac02c01188f92bb61c39301e
4
+ data.tar.gz: f4b2dfe08f34e21ab477b6e872577bbe199b474b
5
+ SHA512:
6
+ metadata.gz: 6603c63ef90ddcf8dac489f539b6109e93828c9295de3ee4f1a0a994bfad05aeea0d2994c263a3afa67f3b263011adaeed3cc7524f24407fc4802624c424e19d
7
+ data.tar.gz: db2e438b8590b2a7bb8b361807cf36503b646458f1477a5c88a329a7b9a7888356f1802dab0ee85ad1285bb0405af6569facefd7968a34d60ac77bd1092be122
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Pablo Gutiérrez del Castillo
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,14 @@
1
+ # sensu-plugins-tcpping
2
+
3
+ ## Installation
4
+
5
+ [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
6
+
7
+ ## Files
8
+
9
+ * bin/metrics-tcpping.rb
10
+
11
+ ## License
12
+
13
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
14
+
@@ -0,0 +1,73 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # metrics-tcpping
4
+ #
5
+ # DESCRIPTION:
6
+ # This plugin pings a tcp port and outputs ping statistics
7
+ #
8
+ # OUTPUT:
9
+ # <scheme>.duration 0.013854 1441900774
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ #
17
+ # USAGE:
18
+ # ./metrics-tcpping --host <host> --port <port> \
19
+ # --timeout <timeout> --scheme <scheme>
20
+ #
21
+ # NOTES:
22
+ #
23
+ # LICENSE:
24
+ # Copyright 2015 Pablo Gutierrez del Castillo <pablogutierrezdelc@gmail.com>
25
+ # Released under the same terms as Sensu (the MIT license); see LICENSE.txt
26
+ # for details.
27
+ #
28
+
29
+ require 'sensu-plugin/check/cli'
30
+ require 'socket'
31
+ require 'net/ping'
32
+
33
+ class TCPPingMetrics < Sensu::Plugin::Check::CLI
34
+ option :scheme,
35
+ description: 'Metric naming scheme, text to prepend to metric',
36
+ short: '-s SCHEME',
37
+ long: '--scheme SCHEME',
38
+ default: "#{Socket.gethostname}.tcpping"
39
+
40
+ option :host,
41
+ description: 'Host to ping',
42
+ short: '-h HOST',
43
+ long: '--host HOST',
44
+ default: 'localhost'
45
+
46
+ option :port,
47
+ description: 'Port to Ping',
48
+ short: '-p PORT',
49
+ long: '--port PORT',
50
+ default: 80
51
+
52
+ option :timeout,
53
+ description: 'Timeout',
54
+ short: '-t TIMEOUT',
55
+ long: '--timeout TIMEOUT',
56
+ default: 5
57
+
58
+ def timestamp
59
+ @timestamp ||= Time.now.to_i
60
+ end
61
+
62
+ def run
63
+ @check = Net::Ping::TCP.new(config[:host], config[:port], config[:timeout])
64
+
65
+ if @check.ping
66
+ puts "#{config[:scheme]}.duration #{@check.duration} #{timestamp}"
67
+ exit 0
68
+ else
69
+ critical "ping error: can't connect to host"
70
+ exit 1
71
+ end
72
+ end
73
+ end
@@ -0,0 +1 @@
1
+ require 'sensu-plugins-tcpping/version'
@@ -0,0 +1,3 @@
1
+ module SensuPluginsTcpping
2
+ VERSION = '0.0.1'
3
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-tcpping
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Pablo Gutiérrez del Castillo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-10 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: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.32.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.32.1
69
+ description: This plugin allows you to ping a TCP port and collect metrics
70
+ email:
71
+ - pablogutierrezdelc@gmail.com
72
+ executables:
73
+ - metrics-tcpping.rb
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - LICENSE.txt
78
+ - README.md
79
+ - bin/metrics-tcpping.rb
80
+ - lib/sensu-plugins-tcpping.rb
81
+ - lib/sensu-plugins-tcpping/version.rb
82
+ homepage: https://github.com/mool/sensu-plugins-tcpping
83
+ licenses:
84
+ - MIT
85
+ metadata: {}
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 2.2.2
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: Sensu plugins for collect tcp ping metrics
106
+ test_files: []