nagira 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +4 -0
- data/lib/app.rb +15 -2
- data/lib/nagira/background_parse.rb +4 -1
- data/version.txt +1 -1
- metadata +2 -2
data/History.md
CHANGED
data/lib/app.rb
CHANGED
@@ -77,6 +77,15 @@ class Nagira < Sinatra::Base
|
|
77
77
|
)
|
78
78
|
})
|
79
79
|
|
80
|
+
$nagios.merge!({
|
81
|
+
status_inflight: Nagios::Status.new( Nagira.settings.status_cfg ||
|
82
|
+
$nagios[:config].status_file
|
83
|
+
),
|
84
|
+
objects_inflight: Nagios::Objects.new( Nagira.settings.objects_cfg ||
|
85
|
+
$nagios[:config].object_cache_file
|
86
|
+
)
|
87
|
+
}) if ::DEFAULT[:start_background_parser]
|
88
|
+
|
80
89
|
puts "[#{Time.now}] -- Starting Nagira application"
|
81
90
|
puts "[#{Time.now}] -- Version #{Nagira::VERSION}"
|
82
91
|
puts "[#{Time.now}] -- Running in #{Nagira.settings.environment} environment"
|
@@ -123,14 +132,18 @@ class Nagira < Sinatra::Base
|
|
123
132
|
$nagios[:status].parse
|
124
133
|
$nagios[:objects].parse
|
125
134
|
end
|
135
|
+
$use_inflight_status ? @status = $nagios[:status_inflight].status['hosts']
|
136
|
+
: @status = $nagios[:status].status['hosts']
|
137
|
+
$use_inflight_objects ? @objects = $nagios[:objects_inflight].objects
|
138
|
+
: @objects = $nagios[:objects].objects
|
126
139
|
else
|
127
140
|
$nagios[:config].parse
|
128
141
|
$nagios[:status].parse
|
129
142
|
$nagios[:objects].parse
|
143
|
+
@status = $nagios[:status].status['hosts']
|
144
|
+
@objects = $nagios[:objects].objects
|
130
145
|
end
|
131
146
|
|
132
|
-
@status = $nagios[:status].status['hosts']
|
133
|
-
@objects = $nagios[:objects].objects
|
134
147
|
|
135
148
|
##
|
136
149
|
# TODO: This stuff breaks XML valid. Will have to wait.
|
@@ -14,11 +14,14 @@ module Nagios
|
|
14
14
|
#
|
15
15
|
def initialize
|
16
16
|
interval = [::DEFAULT[:ttl],1].max || nil
|
17
|
+
$use_inflight_status = false
|
18
|
+
$use_inflight_objects = false
|
17
19
|
if interval && ::DEFAULT[:start_background_parser]
|
18
20
|
puts "[#{Time.now}] Starting background parser thread with interval #{interval} sec"
|
19
21
|
$bg = Thread.new {
|
20
22
|
loop {
|
21
|
-
$nagios[:status].parse
|
23
|
+
$use_inflight_status ? $nagios[:status].parse : $nagios[:status_inflight].parse
|
24
|
+
$use_inflight_status = !$use_inflight_status
|
22
25
|
sleep interval
|
23
26
|
} #loop
|
24
27
|
} # thread
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.6
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nagira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|