nagios-probe 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/LICENSE +1 -1
  2. data/README.rdoc +1 -1
  3. data/VERSION +1 -1
  4. data/lib/nagios-probe.rb +12 -28
  5. metadata +25 -9
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 David Abdemoulaie
1
+ Copyright (c) 2009-2010 David Abdemoulaie
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -66,4 +66,4 @@ To use your probe you *must* wrap it in a begin/rescue block to catch any except
66
66
 
67
67
  == Copyright
68
68
 
69
- Copyright (c) 2009 David Abdemoulaie. See LICENSE for details.
69
+ Copyright (c) 2009-2010 David Abdemoulaie. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -4,49 +4,33 @@ module Nagios
4
4
  CRITICAL = 2
5
5
  UNKNOWN = 3
6
6
 
7
- def crit(message)
8
- "Critical: #{message}"
9
- end
10
-
11
- def warn(message)
12
- "Warning: #{message}"
13
- end
14
-
15
- def ok(message)
16
- "OK: #{message}"
17
- end
18
-
19
7
  class Probe
20
- include Nagios
21
8
  attr_reader :retval, :message
22
9
 
23
10
  def initialize(opts = {})
24
11
  @opts = opts
25
- @retval = OK
26
- @message = ok(ok_message)
12
+ @retval = Nagios::OK
13
+ @message = "OK: #{ok_message}"
27
14
  end
28
15
 
29
16
  def crit?
30
- is_crit = check_crit
31
- return false unless is_crit
32
- @retval = CRITICAL
33
- @message = crit(crit_message)
17
+ return false unless check_crit
18
+ @retval = Nagios::CRITICAL
19
+ @message = "Critical: #{crit_message}"
34
20
  true
35
21
  end
36
22
 
37
23
  def warn?
38
- is_warn = check_warn
39
- return false unless is_warn
40
- @retval = WARNING
41
- @message = warn(warn_message)
24
+ return false unless check_warn
25
+ @retval = Nagios::WARNING
26
+ @message = "Warning: #{warn_message}"
42
27
  true
43
28
  end
44
29
 
45
30
  def ok?
46
- is_ok = check_ok
47
- return false unless is_ok
48
- @retval = OK
49
- @message = ok(ok_message)
31
+ return false unless check_ok
32
+ @retval = Nagios::OK
33
+ @message = "OK: #{ok_message}"
50
34
  true
51
35
  end
52
36
 
@@ -58,7 +42,7 @@ module Nagios
58
42
  if !crit?
59
43
  if !warn?
60
44
  if !ok?
61
- @retval = UNKNOWN
45
+ @retval = Nagios::UNKNOWN
62
46
  raise RuntimeError, "crit? warn? and ok? all returned false"
63
47
  end
64
48
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nagios-probe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 2
10
+ version: 0.1.2
5
11
  platform: ruby
6
12
  authors:
7
13
  - David Abdemoulaie
@@ -9,19 +15,23 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-12-14 00:00:00 -06:00
18
+ date: 2010-10-19 00:00:00 -05:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: thoughtbot-shoulda
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
23
32
  version: "0"
24
- version:
33
+ type: :development
34
+ version_requirements: *id001
25
35
  description: Provides an easy to use API for generating custom probes and communicating probe success/failure to Nagios
26
36
  email: dave@hobodave.com
27
37
  executables: []
@@ -51,21 +61,27 @@ rdoc_options:
51
61
  require_paths:
52
62
  - lib
53
63
  required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
54
65
  requirements:
55
66
  - - ">="
56
67
  - !ruby/object:Gem::Version
68
+ hash: 3
69
+ segments:
70
+ - 0
57
71
  version: "0"
58
- version:
59
72
  required_rubygems_version: !ruby/object:Gem::Requirement
73
+ none: false
60
74
  requirements:
61
75
  - - ">="
62
76
  - !ruby/object:Gem::Version
77
+ hash: 3
78
+ segments:
79
+ - 0
63
80
  version: "0"
64
- version:
65
81
  requirements: []
66
82
 
67
83
  rubyforge_project:
68
- rubygems_version: 1.3.5
84
+ rubygems_version: 1.3.7
69
85
  signing_key:
70
86
  specification_version: 3
71
87
  summary: A very simple tool to assist with creating custom nagios probes in Ruby