nagios_rails_server 0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ log
2
+ TODO
3
+ locks
4
+ *.gem
5
+ Gemfile.lock
6
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Makarchev K
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,15 @@
1
+ NagiosRailsServer
2
+ =================
3
+
4
+ Async server for gem [nagios_helper](http://github.com/kostya/nagios_helper), based on rack,thin and async-sinatra. Runned with rails environment.
5
+
6
+ ```
7
+ gem 'nagios_rails_server'
8
+ ```
9
+
10
+ $ RAILS_ENV=production bundle exec nagios_server -p 3005
11
+
12
+ $ curl localhost:3005/check/some?x=1
13
+
14
+ AR connections and other should be configured to work with concurrency.
15
+ AR config = pool: 100;
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
data/bin/nagios_server ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'nagios_helper/boot'
4
+ require 'rack'
5
+
6
+ raise "RAILS_ROOT not found" unless defined?(RAILS_ROOT)
7
+ require File.join(RAILS_ROOT, %w{config environment})
8
+
9
+ require 'eventmachine'
10
+ require 'nagios_helper'
11
+
12
+ Rack # preload
13
+ Rack::Server # preload
14
+
15
+ $default_nagios_server_condig = File.expand_path(File.join(File.dirname(__FILE__), %w{.. lib nagios_rails_server nagios_server_default.ru}))
16
+
17
+ module Rack
18
+ class Server
19
+ def default_options
20
+ {
21
+ :environment => ENV['RAILS_ENV'] || "development",
22
+ :pid => nil,
23
+ :Port => 9292,
24
+ :Host => "0.0.0.0",
25
+ :AccessLog => [],
26
+ :config => $default_nagios_server_condig
27
+ }
28
+ end
29
+ end
30
+ end
31
+
32
+ Nagios.concurrency_level = Nagios::CONCURRENCY_LEVEL
33
+ Rack::Server.start
@@ -0,0 +1,15 @@
1
+ require 'sinatra'
2
+ require 'async_sinatra'
3
+
4
+ class NagiosDefaultApp < Sinatra::Base
5
+ register Sinatra::Async
6
+
7
+ aget '/check/:method' do
8
+ Nagios::RunnerAsync.new(params) do |res|
9
+ body res * ','
10
+ end
11
+ end
12
+
13
+ end
14
+
15
+ run NagiosDefaultApp.new
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{nagios_rails_server}
5
+ s.version = "0.1"
6
+
7
+ s.authors = ["Makarchev Konstantin"]
8
+
9
+ s.description = %q{Async server for gem nagios_helper, based on rack,thin and async-sinatra. Runned with rails environment.}
10
+ s.summary = %q{Async server for gem nagios_helper, based on rack,thin and async-sinatra. Runned with rails environment.}
11
+
12
+ s.email = %q{kostya27@gmail.com}
13
+ s.homepage = %q{http://github.com/kostya/nagios_rails_server}
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_dependency 'nagios_helper'
21
+ s.add_dependency 'async_sinatra'
22
+ s.add_dependency 'thin'
23
+ s.add_development_dependency "rake"
24
+
25
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nagios_rails_server
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Makarchev Konstantin
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-09-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: nagios_helper
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
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
31
+ name: async_sinatra
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
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
47
+ name: thin
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
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
63
+ name: rake
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: Async server for gem nagios_helper, based on rack,thin and async-sinatra.
79
+ Runned with rails environment.
80
+ email: kostya27@gmail.com
81
+ executables:
82
+ - nagios_server
83
+ extensions: []
84
+ extra_rdoc_files: []
85
+ files:
86
+ - .gitignore
87
+ - Gemfile
88
+ - LICENSE
89
+ - README.md
90
+ - Rakefile
91
+ - bin/nagios_server
92
+ - lib/nagios_rails_server/nagios_server_default.ru
93
+ - nagios_rails_server.gemspec
94
+ homepage: http://github.com/kostya/nagios_rails_server
95
+ licenses: []
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ! '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ segments:
107
+ - 0
108
+ hash: -354790413
109
+ required_rubygems_version: !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ segments:
116
+ - 0
117
+ hash: -354790413
118
+ requirements: []
119
+ rubyforge_project:
120
+ rubygems_version: 1.8.24
121
+ signing_key:
122
+ specification_version: 3
123
+ summary: Async server for gem nagios_helper, based on rack,thin and async-sinatra.
124
+ Runned with rails environment.
125
+ test_files: []