sensu-plugins- 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 84874dba88f8fe4e838ae681c2a74e40a5e41259
4
+ data.tar.gz: ec930a99767b08d8d98b72c70589ae3ecdc2d620
5
+ SHA512:
6
+ metadata.gz: f88f332b9567938826dfb7fd1684d08838a265a44db0dd26a50f703e47e7118a8ac28f6f1d69665ec2e34b9ed6fa6cdeb3ed58403b0d61eb155d6800e2638903
7
+ data.tar.gz: a4a25d3e4ca11d4b6a589fa51ebd7177a63b443f0449c4c6cb0d05e702e87142b6989aaec575e9565516ab0a0909ce85831aaa2408d54fde0697e941cc23bf3d
@@ -0,0 +1,12 @@
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][unreleased]
7
+
8
+ ## 0.0.1.alpha.1 - 1970-01-01
9
+
10
+ ### Added
11
+
12
+ ##
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Sensu Plugins, sensu-plugin@sensu-plugins.io
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,21 @@
1
+ ## Sensu-Plugins-
2
+
3
+ [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-)
4
+ [![Gem Version](https://badge.fury.io/rb/sensu-plugins-.svg)](http://badge.fury.io/rb/sensu-plugins-)
5
+ [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-)
6
+ [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-)
7
+ [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-)
8
+
9
+ ## Functionality
10
+
11
+ ## Files
12
+ *
13
+ *
14
+ *
15
+ *
16
+
17
+ ## Usage
18
+
19
+ [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
20
+
21
+ ## Notes
@@ -0,0 +1,75 @@
1
+ #!/opt/sensu/embedded/bin/ruby
2
+ # encoding: UTF-8
3
+ #
4
+ # check-lan
5
+ #
6
+ # DESCRIPTION:
7
+ # This plugin uses checks (standalone) if a given ip is reachable and if it is not restarts the given interface.
8
+ # If this is not successfull this plugin reboots the client machine.
9
+ #
10
+ # PLATFORMS:
11
+ # Linux
12
+ #
13
+ # DEPENDENCIES:
14
+ # gem: sensu-plugin
15
+ #
16
+ # USAGE:
17
+ #
18
+ # NOTES:
19
+ #
20
+ # LICENSE:
21
+ # Copyright 2017 Max
22
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
23
+ # for details.
24
+
25
+ require 'sensu-plugin/check/cli'
26
+
27
+ class CheckLan < Sensu::Plugin::Check::CLI
28
+ #change the IP whatever IP you want to ping.
29
+ IP_TO_PING = "172.22.1.100"
30
+ PING_COUNT = 1
31
+ #change interface to the interface you want to check
32
+ INTERFACE="eth0"
33
+
34
+ PING = "/bin/ping"
35
+ IFUP="/sbin/ifup"
36
+ IFDOWN="/sbin/ifdown --force"
37
+
38
+ #Method to ping the IP_TO_PING
39
+ def ping
40
+ `#{PING} -c #{PING_COUNT} #{IP_TO_PING} > /dev/null 2> /dev/null`
41
+ end
42
+
43
+ def run
44
+
45
+ puts "ping #{IP_TO_PING} for checking conectivity..."
46
+ ping()
47
+ if $?.exitstatus >= 1
48
+ puts "#{INTERFACE} seems to be down, trying to bring it up..."
49
+ puts "executing ifdown #{INTERFACE}"
50
+ `sudo #{IFDOWN} #{INTERFACE} `
51
+ puts "waiting 10 seconds to bring #{INTERFACE} up..."
52
+ `sleep 10`
53
+ puts "executing ifup #{INTERFACE}"
54
+ `sudo #{IFUP} #{INTERFACE}`
55
+ puts "waiting 10 seconds to ping again..."
56
+ `sleep 10`
57
+ puts "ping server again..."
58
+ ping()
59
+ if $?.exitstatus >= 1
60
+ puts "#{INTERFACE} is still down, REBOOT to recover..."
61
+ `sudo reboot`
62
+ critical "REBOOT to recover"
63
+ else
64
+ #puts "Resetting #{INTERFACE} was successfull"
65
+ ok "Resetting #{INTERFACE} was successfull"
66
+ end
67
+ else
68
+ #puts "#{INTERFACE} is up"
69
+ ok "#{INTERFACE} is up"
70
+ end
71
+ end
72
+ end
73
+
74
+
75
+
@@ -0,0 +1 @@
1
+ require 'sensu-plugins-check-lan/version'
@@ -0,0 +1,28 @@
1
+ require 'json'
2
+
3
+ # encoding: utf-8
4
+ module SensuPluginsCheckLan
5
+ # This defines the version of the gem
6
+ module Version
7
+ MAJOR = 0
8
+ MINOR = 0
9
+ PATCH = 1
10
+
11
+ VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
12
+
13
+ NAME = 'sensu-plugins-check-lan'
14
+ BANNER = "#{NAME} v%s"
15
+
16
+ module_function
17
+
18
+ def version
19
+ format(BANNER, VER_STRING)
20
+ end
21
+
22
+ def json_version
23
+ {
24
+ 'version' => VER_STRING
25
+ }.to_json
26
+ end
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Max
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - certs/sensu-plugins.pem
12
+ date: 2017-03-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: sensu-plugin
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '='
19
+ - !ruby/object:Gem::Version
20
+ version: 1.1.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '='
26
+ - !ruby/object:Gem::Version
27
+ version: 1.1.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: codeclimate-test-reporter
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '0.4'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '0.4'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rubocop
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '='
47
+ - !ruby/object:Gem::Version
48
+ version: '0.30'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '='
54
+ - !ruby/object:Gem::Version
55
+ version: '0.30'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.1'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '3.1'
70
+ - !ruby/object:Gem::Dependency
71
+ name: bundler
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '1.7'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '1.7'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rake
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '10.0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '10.0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: github-markup
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '1.3'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '1.3'
112
+ - !ruby/object:Gem::Dependency
113
+ name: redcarpet
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '3.2'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '3.2'
126
+ - !ruby/object:Gem::Dependency
127
+ name: yard
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '0.8'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '0.8'
140
+ - !ruby/object:Gem::Dependency
141
+ name: pry
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '0.10'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: '0.10'
154
+ description: "Check (standalone) if a certain ip is reachable. If not reset the network
155
+ interface and if it is still not reachable \n\t\t\t\t\t\t\t reboot the machine."
156
+ email:
157
+ executables:
158
+ - check-check-lan.rb
159
+ extensions: []
160
+ extra_rdoc_files: []
161
+ files:
162
+ - CHANGELOG.md
163
+ - LICENSE
164
+ - README.md
165
+ - bin/check-check-lan.rb
166
+ - lib/sensu-plugins-check-lan.rb
167
+ - lib/sensu-plugins-check-lan/version.rb
168
+ homepage:
169
+ licenses:
170
+ - MIT
171
+ metadata:
172
+ maintainer: ''
173
+ development_status: unmaintained
174
+ production_status: unstable - testing recommended
175
+ release_draft: 'false'
176
+ release_prerelease: 'false'
177
+ post_install_message: You can use the embedded Ruby by setting EMBEDDED_RUBY=true
178
+ in /etc/default/sensu
179
+ rdoc_options: []
180
+ require_paths:
181
+ - lib
182
+ required_ruby_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: 1.9.3
187
+ required_rubygems_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ requirements: []
193
+ rubyforge_project:
194
+ rubygems_version: 2.5.2
195
+ signing_key:
196
+ specification_version: 4
197
+ summary: Check for Wlan or Lan conectivity
198
+ test_files: []