nagira 0.2.12 → 0.3.0
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.
- checksums.yaml +4 -4
- data/History.md +6 -0
- data/Rakefile +6 -118
- data/config/defaults.rb +23 -1
- data/config/nagira.defaults +25 -0
- data/lib/app/routes/get/status.rb +6 -2
- data/lib/tasks/config.rake +109 -0
- data/lib/tasks/debug.rake +49 -0
- data/lib/tasks/doc.rake +8 -0
- data/spec/get/endpoints_spec.rb +40 -9
- data/spec/get/services_spec.rb +4 -0
- data/test/data/status.dat +118 -0
- data/version.txt +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a527fc662d7e3b6219167e10099f3c34ffa6e84
|
4
|
+
data.tar.gz: 77ec09dd1e3fab0057f3679168efb249fef63ea1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dd228893c307314d2a672a41f8b6a9481f78fbb757b16076c6863b69f1fd8f22cb45aa12e1dc1407530de100a5162921c9f00aa168a01b940bc5d91ad051038
|
7
|
+
data.tar.gz: 4b9a585a556f951961b2435e93a6fecfc8f2a48d9bd57d63a96a8e23276d74ba03ec7aea9b2f8d8dd1a7a982b9ad3334cd44fff34ce5d7d674fa68d6033c1175
|
data/History.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
### v.0.3.0
|
2
|
+
* Mon Aug 26 2013 -- Dmytro Kovalov
|
3
|
+
- Feature: Configurable hostname regex (see `NAGIOS_HOST_CUSTOM_REGEXi` in `config/nagira.defaults`)
|
4
|
+
* Mon Aug 12 2013 -- Dmytro Kovalov
|
5
|
+
- rake ask for collecting debug information (issues #2)
|
6
|
+
|
1
7
|
### v.0.2.12
|
2
8
|
* Thr Aug 08 2013 -- Dmytro Kovalov
|
3
9
|
- Implementation for GET comments endpoints:
|
data/Rakefile
CHANGED
@@ -1,128 +1,16 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require_relative 'lib/nagira'
|
3
3
|
|
4
|
-
|
5
|
-
puts "#{Time.now} -- #{msg.chomp}"
|
6
|
-
end
|
7
|
-
|
8
|
-
namespace :doc do
|
9
|
-
|
10
|
-
desc 'Generate YARD documentation'
|
11
|
-
task :yard do
|
12
|
-
sh 'yardoc'
|
13
|
-
end
|
4
|
+
$nagira_root = File.dirname File.expand_path __FILE__ # Where Nagira installed
|
14
5
|
|
6
|
+
Dir.glob(File.join($nagira_root, 'lib', 'tasks','*.rake')).each do |rake|
|
7
|
+
load rake
|
15
8
|
end
|
16
9
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
@nagira_config = File.join(@nagira_root, 'config') # Config directory of Nagira installation
|
21
|
-
|
22
|
-
target_os = nil
|
23
|
-
|
24
|
-
%x{ sherlock }.split($\).each do |line|
|
25
|
-
next unless line =~ /^FAMILY=/
|
26
|
-
l,target_os = line.chomp.split '='
|
27
|
-
target_os = target_os.chomp.strip.to_sym
|
28
|
-
end
|
29
|
-
|
30
|
-
namespace :test do
|
31
|
-
|
32
|
-
desc "Test Nagira production config: Nagios files in proper locations and parseable"
|
33
|
-
task :prod do
|
34
|
-
ENV['RACK_ENV'] = 'production'
|
35
|
-
Rake::Task['config:test:test'].invoke
|
36
|
-
end
|
37
|
-
|
38
|
-
desc "Test Nagira installation: test Nagios files and parse"
|
39
|
-
task :install do
|
40
|
-
ENV['RACK_ENV'] = 'test'
|
41
|
-
Rake::Task['config:test:test'].invoke
|
42
|
-
end
|
43
|
-
|
44
|
-
task :test do
|
45
|
-
p "Starting test in #{ENV['RACK_ENV']} environment"
|
46
|
-
sh "rspec --format doc --color spec/00_configuration_spec.rb"
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
desc "Create Nagira configuration, allow start on boot and start it"
|
52
|
-
task :all => [:config, :chkconfig, :start]
|
53
|
-
|
54
|
-
def test?
|
55
|
-
ENV['RAKE_ENV'] == 'test'
|
56
|
-
end
|
57
|
-
|
58
|
-
etc = test? ? 'tmp/etc' : "/etc"
|
59
|
-
init_d = File.join etc, 'init.d'
|
60
|
-
|
61
|
-
directory etc
|
62
|
-
directory init_d
|
63
|
-
|
64
|
-
|
65
|
-
desc "Create configuration for Nagira in /etc"
|
66
|
-
task :config => [:init_d, :defaults]
|
67
|
-
|
68
|
-
|
69
|
-
#desc "Install /etc/init.d startup file for Nagira"
|
70
|
-
task :init_d => init_d do
|
71
|
-
src = File.join(@nagira_config, 'nagira.init_d')
|
72
|
-
dst = "#{init_d}/nagira"
|
73
|
-
|
74
|
-
FileUtils.copy src, dst
|
75
|
-
FileUtils.chown 0, 0, dst unless test?
|
76
|
-
FileUtils.chmod 0755, dst
|
77
|
-
|
78
|
-
log_user "Installed startup file at #{dst}"
|
79
|
-
end
|
80
|
-
|
81
|
-
#desc "Install defaults file for Nagira service in /etc"
|
82
|
-
task :defaults do
|
83
|
-
src = File.join(@nagira_config, 'nagira.defaults')
|
84
|
-
dst = case target_os
|
85
|
-
when :rh
|
86
|
-
'/etc/sysconfig/nagira'
|
87
|
-
when :debian
|
88
|
-
'/etc/default/nagira'
|
89
|
-
else
|
90
|
-
log_user "Unknown or unsupported target OS: #{target_os}"
|
91
|
-
log_user " >>> Skipped defaults file installation"
|
92
|
-
next
|
93
|
-
end
|
94
|
-
unless File.exists? dst
|
95
|
-
FileUtils.copy src, dst
|
96
|
-
FileUtils.chown 0, 0, dst unless test?
|
97
|
-
FileUtils.chmod 0644, dst
|
98
|
-
|
99
|
-
log_user "Installed new defaults file for Nagira in #{dst}."
|
100
|
-
log_user " >>> You might want to tune some of the variables."
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
desc "Start Nagira API service"
|
105
|
-
task :start => [:init_d, :defaults] do
|
106
|
-
log_user "Starting Nagira for the first time"
|
107
|
-
sh "/etc/init.d/nagira start"
|
108
|
-
end
|
109
|
-
|
110
|
-
desc "Configure Nagira to start on system boot"
|
111
|
-
task :chkconfig => [:init_d, :defaults] do
|
10
|
+
def log_user msg
|
11
|
+
puts "#{Time.now} -- #{msg.chomp}"
|
12
|
+
end
|
112
13
|
|
113
|
-
log_user "Configuring Nagira to start at boot"
|
114
|
-
case target_os
|
115
|
-
when :rh
|
116
|
-
sh "/sbin/chkconfig --add nagira"
|
117
|
-
sh "/sbin/chkconfig nagira on"
|
118
|
-
when :debian
|
119
|
-
sh "/usr/sbin/update-rc.d nagira defaults"
|
120
|
-
else
|
121
|
-
abort "Unknown or unsupported target OS: #{target_os}"
|
122
|
-
end
|
123
|
-
log_user "[OK]"
|
124
|
-
end
|
125
14
|
|
126
|
-
end
|
127
15
|
|
128
16
|
|
data/config/defaults.rb
CHANGED
@@ -53,7 +53,29 @@ DEFAULT = {
|
|
53
53
|
# intervals slightly shorter than `ttl` to ensure that data are
|
54
54
|
# always updated. So, `ttl` should be larger than 1.
|
55
55
|
#
|
56
|
-
start_background_parser: (ENV['NAGIRA_BG_PARSING'] == '1')
|
56
|
+
start_background_parser: (ENV['NAGIRA_BG_PARSING'] == '1'),
|
57
|
+
|
58
|
+
##
|
59
|
+
# By default hostname regular expression accepts alpha-numerics,
|
60
|
+
# dashes and dots, as specified by http://tools.ietf.org/html/rfc952
|
61
|
+
# for hostnames. Extended to accept dots in the middle for FQHN's.
|
62
|
+
#
|
63
|
+
#
|
64
|
+
# - default: '\w([\w\-\.]+)?\w'
|
65
|
+
# - simple hostname: '\w([\w\-]+)?\w'
|
66
|
+
# - allow space in hostname: '\w([\w\-\.(%20)]+)?\w'
|
67
|
+
#
|
68
|
+
# Explanation regarding spaces:
|
69
|
+
# ---------------------------------
|
70
|
+
#
|
71
|
+
# Nagios works OK with hostnames with spaces. This is against RFC's
|
72
|
+
# and can't really used for real hosts, but for aggregated checks
|
73
|
+
# (like cluster name for example), you might want to consider this
|
74
|
+
# option.
|
75
|
+
|
76
|
+
hostname_regex: ENV['NAGIOS_HOST_CUSTOM_REGEX'] || '\w([\w\-\.]+)?\w'
|
77
|
+
|
78
|
+
|
57
79
|
}
|
58
80
|
|
59
81
|
require 'sinatra'
|
data/config/nagira.defaults
CHANGED
@@ -64,3 +64,28 @@
|
|
64
64
|
# not need to change.
|
65
65
|
#
|
66
66
|
# NAGIOS_CFG_FILE=/etc/nagios/nagios.cfg
|
67
|
+
#
|
68
|
+
# ----------------------
|
69
|
+
# Custom regex for hostnames
|
70
|
+
# ----------------------
|
71
|
+
#
|
72
|
+
# By default hostname regular expression accepts alpha-numerics,
|
73
|
+
# dashes and dots, as specified by http://tools.ietf.org/html/rfc952
|
74
|
+
# for hostnames. Extended to accept dots in the middle for FQHN's.
|
75
|
+
#
|
76
|
+
# Possible settings:
|
77
|
+
#
|
78
|
+
# - default: '\w([\w\-\.]+)?\w' FQHN
|
79
|
+
# - short hostname: '\w([\w\-]+)?\w'
|
80
|
+
# - FQHN allow space in hostname: '\w([\w\-\.(%20)]+)?\w'
|
81
|
+
#
|
82
|
+
# Explanation regarding spaces:
|
83
|
+
# ---------------------------------
|
84
|
+
#
|
85
|
+
# Nagios works OK with hostnames with spaces. This is against RFC's
|
86
|
+
# and can't really used for real hosts, but for aggregated checks
|
87
|
+
# (like cluster name for example), you might want to consider this
|
88
|
+
# option.
|
89
|
+
#
|
90
|
+
# NAGIOS_HOST_CUSTOM_REGEX='\w([\w\-\.]+)?\w'
|
91
|
+
#
|
@@ -87,7 +87,7 @@ class Nagira < Sinatra::Base
|
|
87
87
|
# @!macro state
|
88
88
|
# @!macro list
|
89
89
|
# @!macro full
|
90
|
-
get %r{^/_status/(?<hostname
|
90
|
+
get %r{^/_status/(?<hostname>#{hostname_regex})/_(?<service>(services|hostcomments|servicecomments))$} do |hostname,service|
|
91
91
|
|
92
92
|
hostname = hostname.to_i if hostname =~ /^\d+$/
|
93
93
|
key = case service
|
@@ -156,6 +156,10 @@ class Nagira < Sinatra::Base
|
|
156
156
|
#
|
157
157
|
# @method get_status_hostname
|
158
158
|
#
|
159
|
+
# Endpoint
|
160
|
+
#
|
161
|
+
# - get "/_status/:hostname"
|
162
|
+
#
|
159
163
|
# @!macro hostname
|
160
164
|
#
|
161
165
|
# @!macro accepted
|
@@ -165,7 +169,7 @@ class Nagira < Sinatra::Base
|
|
165
169
|
# - plural resources: N/A
|
166
170
|
# - object access by ID: NO (TODO)
|
167
171
|
|
168
|
-
get
|
172
|
+
get %r{^/_status/(?<hostname>#{hostname_regex})$} do |hostname|
|
169
173
|
|
170
174
|
|
171
175
|
hostname = hostname.to_i if hostname =~ /^\d+$/
|
@@ -0,0 +1,109 @@
|
|
1
|
+
namespace :config do
|
2
|
+
|
3
|
+
@nagira_config = File.join($nagira_root, 'config') # Config directory of Nagira installation
|
4
|
+
|
5
|
+
target_os = nil
|
6
|
+
|
7
|
+
%x{ sherlock }.split($\).each do |line|
|
8
|
+
next unless line =~ /^FAMILY=/
|
9
|
+
l,target_os = line.chomp.split '='
|
10
|
+
target_os = target_os.chomp.strip.to_sym
|
11
|
+
end
|
12
|
+
|
13
|
+
namespace :test do
|
14
|
+
|
15
|
+
desc "Test Nagira production config: Nagios files in proper locations and parseable"
|
16
|
+
task :prod do
|
17
|
+
ENV['RACK_ENV'] = 'production'
|
18
|
+
Rake::Task['config:test:test'].invoke
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Test Nagira installation: test Nagios files and parse"
|
22
|
+
task :install do
|
23
|
+
ENV['RACK_ENV'] = 'test'
|
24
|
+
Rake::Task['config:test:test'].invoke
|
25
|
+
end
|
26
|
+
|
27
|
+
task :test do
|
28
|
+
p "Starting test in #{ENV['RACK_ENV']} environment"
|
29
|
+
sh "rspec --format doc --color spec/00_configuration_spec.rb"
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Create Nagira configuration, allow start on boot and start it"
|
35
|
+
task :all => [:config, :chkconfig, :start]
|
36
|
+
|
37
|
+
def test?
|
38
|
+
ENV['RAKE_ENV'] == 'test'
|
39
|
+
end
|
40
|
+
|
41
|
+
etc = test? ? 'tmp/etc' : "/etc"
|
42
|
+
init_d = File.join etc, 'init.d'
|
43
|
+
|
44
|
+
directory etc
|
45
|
+
directory init_d
|
46
|
+
|
47
|
+
|
48
|
+
desc "Create configuration for Nagira in /etc"
|
49
|
+
task :config => [:init_d, :defaults]
|
50
|
+
|
51
|
+
|
52
|
+
#desc "Install /etc/init.d startup file for Nagira"
|
53
|
+
task :init_d => init_d do
|
54
|
+
src = File.join(@nagira_config, 'nagira.init_d')
|
55
|
+
dst = "#{init_d}/nagira"
|
56
|
+
|
57
|
+
FileUtils.copy src, dst
|
58
|
+
FileUtils.chown 0, 0, dst unless test?
|
59
|
+
FileUtils.chmod 0755, dst
|
60
|
+
|
61
|
+
log_user "Installed startup file at #{dst}"
|
62
|
+
end
|
63
|
+
|
64
|
+
#desc "Install defaults file for Nagira service in /etc"
|
65
|
+
task :defaults do
|
66
|
+
src = File.join(@nagira_config, 'nagira.defaults')
|
67
|
+
dst = case target_os
|
68
|
+
when :rh
|
69
|
+
'/etc/sysconfig/nagira'
|
70
|
+
when :debian
|
71
|
+
'/etc/default/nagira'
|
72
|
+
else
|
73
|
+
log_user "Unknown or unsupported target OS: #{target_os}"
|
74
|
+
log_user " >>> Skipped defaults file installation"
|
75
|
+
next
|
76
|
+
end
|
77
|
+
unless File.exists? dst
|
78
|
+
FileUtils.copy src, dst
|
79
|
+
FileUtils.chown 0, 0, dst unless test?
|
80
|
+
FileUtils.chmod 0644, dst
|
81
|
+
|
82
|
+
log_user "Installed new defaults file for Nagira in #{dst}."
|
83
|
+
log_user " >>> You might want to tune some of the variables."
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
desc "Start Nagira API service"
|
88
|
+
task :start => [:init_d, :defaults] do
|
89
|
+
log_user "Starting Nagira for the first time"
|
90
|
+
sh "/etc/init.d/nagira start"
|
91
|
+
end
|
92
|
+
|
93
|
+
desc "Configure Nagira to start on system boot"
|
94
|
+
task :chkconfig => [:init_d, :defaults] do
|
95
|
+
|
96
|
+
log_user "Configuring Nagira to start at boot"
|
97
|
+
case target_os
|
98
|
+
when :rh
|
99
|
+
sh "/sbin/chkconfig --add nagira"
|
100
|
+
sh "/sbin/chkconfig nagira on"
|
101
|
+
when :debian
|
102
|
+
sh "/usr/sbin/update-rc.d nagira defaults"
|
103
|
+
else
|
104
|
+
abort "Unknown or unsupported target OS: #{target_os}"
|
105
|
+
end
|
106
|
+
log_user "[OK]"
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
namespace :debug do
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
#
|
5
|
+
# These are default configured files.
|
6
|
+
#
|
7
|
+
files = %w{ /etc/init.d/nagira /etc/sysconfig/nagira /etc/default/nagira /var/log/nagios/nagira.log }
|
8
|
+
files += Dir.glob(
|
9
|
+
[
|
10
|
+
"/etc/nagios*/nagios.cfg",
|
11
|
+
"/usr/local/nagios/etc/nagios.cfg"
|
12
|
+
]
|
13
|
+
)
|
14
|
+
files << ENV['NAGIOS_CFG_FILE'] if ENV['NAGIOS_CFG_FILE']
|
15
|
+
|
16
|
+
desc "Collect debugging information: config files, permissions etc."
|
17
|
+
task :collect do
|
18
|
+
|
19
|
+
output = "nagira-debug-output.#{Time.now.to_s.gsub(' ', '_')}.tgz"
|
20
|
+
os_info = %x{ $GEM_HOME/bin/sherlock 2>&1 }
|
21
|
+
permissions = %x{ ls -liL #{files.join ' '} 2>&1 }
|
22
|
+
environment = %x{ (set; export) 2>&1 }
|
23
|
+
|
24
|
+
puts "Creating file #{output}. Please send this file for investigation."
|
25
|
+
|
26
|
+
Dir.mktmpdir { |dir|
|
27
|
+
|
28
|
+
$stdout.reopen("#{dir}/stdout.txt", "w")
|
29
|
+
require_relative '../../lib/nagira.rb'
|
30
|
+
require_relative '../../lib/app.rb'
|
31
|
+
#
|
32
|
+
# These files from parsed config.
|
33
|
+
#
|
34
|
+
files << $nagios[:config].path
|
35
|
+
files << $nagios[:status].path
|
36
|
+
files << $nagios[:objects].path
|
37
|
+
|
38
|
+
open("#{dir}/sherlock.txt", "w") { |f| f.puts os_info }
|
39
|
+
open("#{dir}/permissions.txt", "w") { |f| f.puts permissions }
|
40
|
+
open("#{dir}/environment.txt", "w") { |f| f.puts environment }
|
41
|
+
|
42
|
+
files.each do |ff|
|
43
|
+
FileUtils.cp(ff, "#{dir}/#{ff.gsub('/','_')}") if File.exist? ff
|
44
|
+
end
|
45
|
+
|
46
|
+
%x{ tar cfz #{output} #{dir} 1>&2 }
|
47
|
+
}
|
48
|
+
end
|
49
|
+
end
|
data/lib/tasks/doc.rake
ADDED
data/spec/get/endpoints_spec.rb
CHANGED
@@ -7,20 +7,30 @@ require 'spec_helper'
|
|
7
7
|
shared_examples_for :fail_on_random_url do |base|
|
8
8
|
RANDOM.each do |url|
|
9
9
|
ep = "#{base}/#{url}"
|
10
|
-
it "fails on #{ep} string" do
|
10
|
+
it "fails on '#{ep}' string" do
|
11
11
|
get ep
|
12
12
|
last_response.status.should be 404
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
shared_examples_for :respond_to_valid_url do |base, urls|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
shared_examples_for :respond_to_valid_url do |base, urls, custom_regex|
|
18
|
+
|
19
|
+
case urls
|
20
|
+
when Array
|
21
|
+
urls.each do |url|
|
22
|
+
ep = "#{base}/#{url}"
|
23
|
+
it "responds to #{ep}" do
|
24
|
+
get ep
|
25
|
+
last_response.should be_ok
|
26
|
+
end
|
23
27
|
end
|
28
|
+
when nil
|
29
|
+
ep = "#{base}"
|
30
|
+
it "responds to #{ep}" do
|
31
|
+
get ep
|
32
|
+
last_response.should be_ok
|
33
|
+
end
|
24
34
|
end
|
25
35
|
end
|
26
36
|
|
@@ -41,7 +51,9 @@ describe Nagira do
|
|
41
51
|
|
42
52
|
context "API endpoints" do
|
43
53
|
|
44
|
-
host
|
54
|
+
host = IMPLEMENTED[:hosts].first
|
55
|
+
spaces = "host%20with%20space"
|
56
|
+
|
45
57
|
|
46
58
|
context :top do
|
47
59
|
it_should_behave_like :respond_to_valid_url, '', IMPLEMENTED[:top]
|
@@ -59,14 +71,33 @@ describe Nagira do
|
|
59
71
|
it_should_behave_like :respond_to_valid_url, "/_status/#{host}", IMPLEMENTED[:status]
|
60
72
|
it_should_behave_like :fail_on_random_url, "/_status/#{host}"
|
61
73
|
|
74
|
+
context "hostname with space" do
|
75
|
+
it_should_behave_like :fail_on_bad_url, "/_status/#{spaces}"
|
76
|
+
end
|
77
|
+
|
62
78
|
context :unknown_host do
|
63
79
|
it_should_behave_like :fail_on_bad_url, '/_status/unknown_host'
|
64
80
|
it_should_behave_like :fail_on_random_url, "/_status/unknown_host"
|
65
81
|
end
|
82
|
+
end # /_status/:host
|
83
|
+
|
84
|
+
context "/_status/:host/_services" do
|
85
|
+
it_should_behave_like :respond_to_valid_url, "/_status/#{host}/_services"
|
86
|
+
it_should_behave_like :respond_to_valid_url, "/_status/#{host}/_services", ["SSH", "PING"]
|
66
87
|
|
88
|
+
context "hostname with space" do
|
89
|
+
it_should_behave_like :fail_on_bad_url, "/_status/#{spaces}/_services"
|
90
|
+
end
|
67
91
|
end
|
68
92
|
|
69
|
-
end # API endpoints
|
70
93
|
|
94
|
+
context "custom hostname regex - host with spaces" do
|
95
|
+
|
96
|
+
it { pending "Need to figure out how to change hostname regex on the fly" }
|
97
|
+
#it_should_behave_like :respond_to_valid_url, "/_status/#{spaces}", nil, '\w[(%20)\w\-\.]+'
|
98
|
+
#it_should_behave_like :respond_to_valid_url, "/_status/#{spaces}/_services"
|
99
|
+
end # custom hostname regex
|
100
|
+
|
101
|
+
end # API endpoints
|
71
102
|
|
72
103
|
end
|
data/spec/get/services_spec.rb
CHANGED
data/test/data/status.dat
CHANGED
@@ -112,6 +112,63 @@ hoststatus {
|
|
112
112
|
scheduled_downtime_depth=0
|
113
113
|
}
|
114
114
|
|
115
|
+
hoststatus {
|
116
|
+
host_name=host with space
|
117
|
+
modified_attributes=0
|
118
|
+
check_command=check-host-alive
|
119
|
+
check_period=
|
120
|
+
notification_period=_24x7
|
121
|
+
check_interval=5.000000
|
122
|
+
retry_interval=1.000000
|
123
|
+
event_handler=
|
124
|
+
has_been_checked=1
|
125
|
+
should_be_scheduled=1
|
126
|
+
check_execution_time=3.011
|
127
|
+
check_latency=0.071
|
128
|
+
check_type=0
|
129
|
+
current_state=1
|
130
|
+
last_hard_state=1
|
131
|
+
last_event_id=19699
|
132
|
+
current_event_id=19702
|
133
|
+
current_problem_id=8664
|
134
|
+
last_problem_id=8611
|
135
|
+
plugin_output=CRITICAL - Host Unreachable (192.168.2.72)
|
136
|
+
long_plugin_output=
|
137
|
+
performance_data=
|
138
|
+
last_check=1325284831
|
139
|
+
next_check=1325285141
|
140
|
+
check_options=0
|
141
|
+
current_attempt=1
|
142
|
+
max_attempts=10
|
143
|
+
current_event_id=19702
|
144
|
+
last_event_id=19699
|
145
|
+
state_type=1
|
146
|
+
last_state_change=1324805581
|
147
|
+
last_hard_state_change=1324805581
|
148
|
+
last_time_up=1324787230
|
149
|
+
last_time_down=1325284841
|
150
|
+
last_time_unreachable=0
|
151
|
+
last_notification=1324805581
|
152
|
+
next_notification=1324805581
|
153
|
+
no_more_notifications=1
|
154
|
+
current_notification_number=1
|
155
|
+
current_notification_id=2118
|
156
|
+
notifications_enabled=1
|
157
|
+
problem_has_been_acknowledged=0
|
158
|
+
acknowledgement_type=0
|
159
|
+
active_checks_enabled=1
|
160
|
+
passive_checks_enabled=1
|
161
|
+
event_handler_enabled=1
|
162
|
+
flap_detection_enabled=1
|
163
|
+
failure_prediction_enabled=1
|
164
|
+
process_performance_data=1
|
165
|
+
obsess_over_host=1
|
166
|
+
last_update=1325285001
|
167
|
+
is_flapping=0
|
168
|
+
percent_state_change=0.00
|
169
|
+
scheduled_downtime_depth=0
|
170
|
+
}
|
171
|
+
|
115
172
|
hoststatus {
|
116
173
|
host_name=gateway
|
117
174
|
modified_attributes=0
|
@@ -575,6 +632,67 @@ servicestatus {
|
|
575
632
|
scheduled_downtime_depth=0
|
576
633
|
}
|
577
634
|
|
635
|
+
|
636
|
+
servicestatus {
|
637
|
+
host_name=host with space
|
638
|
+
service_description=SSH
|
639
|
+
modified_attributes=0
|
640
|
+
check_command=check_ssh
|
641
|
+
check_period=_24x7
|
642
|
+
notification_period=_24x7
|
643
|
+
check_interval=5.000000
|
644
|
+
retry_interval=1.000000
|
645
|
+
event_handler=
|
646
|
+
has_been_checked=1
|
647
|
+
should_be_scheduled=1
|
648
|
+
check_execution_time=3.012
|
649
|
+
check_latency=0.226
|
650
|
+
check_type=0
|
651
|
+
current_state=2
|
652
|
+
last_hard_state=2
|
653
|
+
last_event_id=19664
|
654
|
+
current_event_id=19686
|
655
|
+
current_problem_id=8675
|
656
|
+
last_problem_id=8662
|
657
|
+
current_attempt=1
|
658
|
+
max_attempts=4
|
659
|
+
current_event_id=19686
|
660
|
+
last_event_id=19664
|
661
|
+
state_type=1
|
662
|
+
last_state_change=1324805222
|
663
|
+
last_hard_state_change=1324805222
|
664
|
+
last_time_ok=1324787091
|
665
|
+
last_time_warning=0
|
666
|
+
last_time_unknown=0
|
667
|
+
last_time_critical=1325284922
|
668
|
+
plugin_output=No route to host
|
669
|
+
long_plugin_output=
|
670
|
+
performance_data=
|
671
|
+
last_check=1325284922
|
672
|
+
next_check=1325285222
|
673
|
+
check_options=0
|
674
|
+
current_notification_number=0
|
675
|
+
current_notification_id=0
|
676
|
+
last_notification=0
|
677
|
+
next_notification=0
|
678
|
+
no_more_notifications=0
|
679
|
+
notifications_enabled=1
|
680
|
+
active_checks_enabled=1
|
681
|
+
passive_checks_enabled=1
|
682
|
+
event_handler_enabled=1
|
683
|
+
problem_has_been_acknowledged=0
|
684
|
+
acknowledgement_type=0
|
685
|
+
flap_detection_enabled=1
|
686
|
+
failure_prediction_enabled=1
|
687
|
+
process_performance_data=1
|
688
|
+
obsess_over_service=1
|
689
|
+
last_update=1325285001
|
690
|
+
is_flapping=0
|
691
|
+
percent_state_change=0.00
|
692
|
+
scheduled_downtime_depth=0
|
693
|
+
}
|
694
|
+
|
695
|
+
|
578
696
|
servicestatus {
|
579
697
|
host_name=kurobka
|
580
698
|
service_description=Check time
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nagira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmytro Kovalov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -293,6 +293,9 @@ files:
|
|
293
293
|
- lib/nagira/nagios.rb
|
294
294
|
- lib/nagira/timed_parse.rb
|
295
295
|
- lib/nagira.rb
|
296
|
+
- lib/tasks/config.rake
|
297
|
+
- lib/tasks/debug.rake
|
298
|
+
- lib/tasks/doc.rake
|
296
299
|
- spec/00_configuration_spec.rb
|
297
300
|
- spec/01_data_format/01_nagira_response_spec.rb
|
298
301
|
- spec/01_data_format/02_0_status_spec.rb
|
@@ -348,7 +351,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
348
351
|
version: '0'
|
349
352
|
requirements: []
|
350
353
|
rubyforge_project:
|
351
|
-
rubygems_version: 2.0.
|
354
|
+
rubygems_version: 2.0.7
|
352
355
|
signing_key:
|
353
356
|
specification_version: 4
|
354
357
|
summary: 'Nagira : Nagios RESTful API'
|