nrpe_check 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.
- data/lib/nrpe_check/check.rb +34 -0
- data/lib/nrpe_check/extend.rb +3 -0
- data/lib/nrpe_check/status.rb +6 -0
- data/lib/nrpe_check.rb +4 -0
- metadata +50 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
module NRPE
|
2
|
+
module Check
|
3
|
+
|
4
|
+
def run
|
5
|
+
set_default_status
|
6
|
+
|
7
|
+
yield if block_given?
|
8
|
+
rescue Exception => message
|
9
|
+
exit_with_status :unknown, message
|
10
|
+
end
|
11
|
+
|
12
|
+
def status status, message = nil
|
13
|
+
at_exit do
|
14
|
+
exit_with_status status, message
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def exit_with_status status, message = nil
|
19
|
+
case status.downcase
|
20
|
+
when :ok, :warning, :critical, :unknown
|
21
|
+
puts "#{status.upcase}: " + message if message
|
22
|
+
|
23
|
+
exit! eval ['NRPE', 'Status', status.upcase].join '::'
|
24
|
+
else
|
25
|
+
raise 'invalid NRPE::Check exit status'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def set_default_status
|
30
|
+
status :unknown, "#{$0} failed to set an exit status"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
data/lib/nrpe_check.rb
ADDED
metadata
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nrpe_check
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dallas Marlow
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-02 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description:
|
15
|
+
email:
|
16
|
+
- dallasmarlow@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- lib/nrpe_check.rb
|
22
|
+
- lib/nrpe_check/check.rb
|
23
|
+
- lib/nrpe_check/status.rb
|
24
|
+
- lib/nrpe_check/extend.rb
|
25
|
+
homepage:
|
26
|
+
licenses: []
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
none: false
|
33
|
+
requirements:
|
34
|
+
- - ! '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubyforge_project:
|
45
|
+
rubygems_version: 1.8.23
|
46
|
+
signing_key:
|
47
|
+
specification_version: 3
|
48
|
+
summary: nrpe check helper
|
49
|
+
test_files: []
|
50
|
+
has_rdoc:
|