nagios_helper 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  NagiosHelper
2
2
  ============
3
3
 
4
- Rails gem for writing, testing, executing Nagios checks inside Rails application.
4
+ Gem for writing, testing, executing Nagios checks inside Rails application.
5
5
  Checks running throught http or binary(nrpe).
6
6
 
7
7
  ```
@@ -47,19 +47,17 @@ Create controller: app/controllers/nagios_controller.rb
47
47
 
48
48
  ```ruby
49
49
  class NagiosController < ApplicationController
50
+ http_basic_authenticate_with :name => "nagios", :password => "password"
50
51
 
51
52
  def check
52
53
  status, message = Nagios::Runner.check(params)
53
-
54
- respond_to do |f|
55
- f.html{ status + "," + message }
56
- end
54
+ render :text => "#{status}|#{message}", :layout => false
57
55
  end
58
56
 
59
57
  end
60
58
  ```
61
59
 
62
- $ curl localhost:3000/nagios/check?method=some&x=1
60
+ $ curl http://nagios:password@localhost:3000/nagios/check?method=some&x=1
63
61
 
64
62
  ### Outside rails server
65
63
 
data/lib/nagios_helper.rb CHANGED
@@ -13,49 +13,49 @@ module Nagios
13
13
  WARN = 1
14
14
  CRIT = 2
15
15
  OTHER = 3
16
-
16
+
17
17
  CONCURRENCY_LEVEL = 100 # for server
18
-
18
+
19
19
  STATUS_NAMES = {
20
20
  OK => 'ok',
21
21
  WARN => 'warn',
22
22
  CRIT => 'crit',
23
23
  OTHER => 'other'
24
24
  }
25
-
25
+
26
26
  class << self
27
27
  def logger
28
28
  @logger ||= Logger.new(File.join(rails_root, "/log/nagios.log")).tap do |logger|
29
29
  logger.formatter = lambda { |s, d, p, m| "#{d.strftime("%d.%m.%Y %H:%M:%S")} #{m}\n" }
30
30
  end
31
31
  end
32
-
32
+
33
33
  attr_accessor :project_initializer_loaded
34
-
34
+
35
35
  def concurrency_level
36
36
  @concurrency_level
37
37
  end
38
-
38
+
39
39
  def mutex
40
40
  @mutex ||= Mutex.new
41
41
  end
42
-
42
+
43
43
  def concurrency_level=(cl)
44
44
  @concurrency_level = cl
45
45
  EM.threadpool_size = cl
46
46
  end
47
-
47
+
48
48
  def status_name(status)
49
- ':' + STATUS_NAMES[status] || 'unknown'
49
+ ":#{ STATUS_NAMES[status] || 'unknown' }"
50
50
  end
51
-
51
+
52
52
  def rails_root
53
53
  defined?(RAILS_ROOT) ? RAILS_ROOT : (defined?(Rails) ? Rails.root : nil)
54
54
  end
55
55
  end
56
-
56
+
57
57
  autoload :Check, 'nagios_helper/check'
58
58
  autoload :CheckEM, 'nagios_helper/check_em'
59
59
  autoload :Runner, 'nagios_helper/runner'
60
60
  autoload :RunnerAsync, 'nagios_helper/runner_async'
61
- end
61
+ end
@@ -3,12 +3,12 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = %q{nagios_helper}
6
- s.version = "0.1.1"
6
+ s.version = "0.1.2"
7
7
 
8
8
  s.authors = ["Makarchev Konstantin"]
9
9
 
10
- s.description = %q{Rails gem for writing, testing, executing nagios checks inside Rails application. Checks running throught http or binary(nrpe).}
11
- s.summary = %q{Rails gem for writing, testing, executing nagios checks inside Rails application. Checks running throught http or binary(nrpe).}
10
+ s.description = %q{Gem for writing, testing, executing nagios checks inside Rails application. Checks running throught http or binary(nrpe).}
11
+ s.summary = %q{Gem for writing, testing, executing nagios checks inside Rails application. Checks running throught http or binary(nrpe).}
12
12
 
13
13
  s.email = %q{kostya27@gmail.com}
14
14
  s.homepage = %q{http://github.com/kostya/nagios_helper}
data/spec/spec_helper.rb CHANGED
@@ -4,7 +4,7 @@ Bundler.setup
4
4
  ENV['RAILS_ENV'] ||= 'test'
5
5
 
6
6
  $:.unshift(File.dirname(__FILE__) + '/../lib')
7
- require 'nagios_check'
7
+ require 'nagios_helper'
8
8
 
9
9
  require 'nagios_support'
10
10
 
metadata CHANGED
@@ -1,88 +1,88 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: nagios_helper
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Makarchev Konstantin
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-09-15 00:00:00 +04:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 3
28
- segments:
29
- - 0
30
- version: "0"
31
- prerelease: false
32
- type: :runtime
33
- requirement: *id001
12
+ date: 2012-12-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
34
15
  name: activesupport
35
- - !ruby/object:Gem::Dependency
36
- version_requirements: &id002 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
37
17
  none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- hash: 3
42
- segments:
43
- - 0
44
- version: "0"
45
- prerelease: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
46
22
  type: :runtime
47
- requirement: *id002
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
48
31
  name: eventmachine
49
- - !ruby/object:Gem::Dependency
50
- version_requirements: &id003 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
51
33
  none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- hash: 3
56
- segments:
57
- - 0
58
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
59
39
  prerelease: false
60
- type: :development
61
- requirement: *id003
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
62
47
  name: rspec
63
- - !ruby/object:Gem::Dependency
64
- version_requirements: &id004 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
65
49
  none: false
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- hash: 3
70
- segments:
71
- - 0
72
- version: "0"
73
- prerelease: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
74
54
  type: :development
75
- requirement: *id004
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
76
63
  name: rake
77
- description: Rails gem for writing, testing, executing nagios checks inside Rails application. Checks running throught http or binary(nrpe).
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: Gem for writing, testing, executing nagios checks inside Rails application.
79
+ Checks running throught http or binary(nrpe).
78
80
  email: kostya27@gmail.com
79
- executables:
81
+ executables:
80
82
  - nagios_check
81
83
  extensions: []
82
-
83
84
  extra_rdoc_files: []
84
-
85
- files:
85
+ files:
86
86
  - .gitignore
87
87
  - Gemfile
88
88
  - LICENSE
@@ -107,39 +107,35 @@ files:
107
107
  - spec/nagios_spec.rb
108
108
  - spec/nagios_support.rb
109
109
  - spec/spec_helper.rb
110
- has_rdoc: true
111
110
  homepage: http://github.com/kostya/nagios_helper
112
111
  licenses: []
113
-
114
112
  post_install_message:
115
113
  rdoc_options: []
116
-
117
- require_paths:
114
+ require_paths:
118
115
  - lib
119
- required_ruby_version: !ruby/object:Gem::Requirement
116
+ required_ruby_version: !ruby/object:Gem::Requirement
120
117
  none: false
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- hash: 3
125
- segments:
118
+ requirements:
119
+ - - ! '>='
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ segments:
126
123
  - 0
127
- version: "0"
128
- required_rubygems_version: !ruby/object:Gem::Requirement
124
+ hash: -299628239
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
126
  none: false
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- hash: 3
134
- segments:
127
+ requirements:
128
+ - - ! '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ segments:
135
132
  - 0
136
- version: "0"
133
+ hash: -299628239
137
134
  requirements: []
138
-
139
135
  rubyforge_project:
140
- rubygems_version: 1.4.2
136
+ rubygems_version: 1.8.24
141
137
  signing_key:
142
138
  specification_version: 3
143
- summary: Rails gem for writing, testing, executing nagios checks inside Rails application. Checks running throught http or binary(nrpe).
139
+ summary: Gem for writing, testing, executing nagios checks inside Rails application.
140
+ Checks running throught http or binary(nrpe).
144
141
  test_files: []
145
-