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 CHANGED
@@ -1,3 +1,7 @@
1
+ ### v.0.2.6
2
+ * Tue Mar 26 2013 -- Ivan Gusev
3
+
4
+ - Fix for long time parsing https://github.com/dmytro/nagira/issues/20
1
5
  ### v.0.2.5
2
6
 
3
7
  * Fri Mar 15 2013 -- Dmytro Kovalov
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.5
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.5
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-15 00:00:00.000000000 Z
12
+ date: 2013-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel