flapjack 0.6.33 → 0.6.34
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.
- data/README.md +4 -8
- data/bin/flapjack-nagios-receiver +11 -10
- data/dist/etc/init.d/flapjack-nagios-receiver +2 -3
- data/lib/flapjack/coordinator.rb +1 -5
- data/lib/flapjack/pikelet.rb +1 -7
- data/lib/flapjack/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -132,20 +132,16 @@ flapjack-nagios-receiver
|
|
132
132
|
|
133
133
|
There is a control script that uses [Daemons](http://daemons.rubyforge.org/) to start, stop, restart, show status etc of the flapjack-nagios-receiver process. Options after -- are passed through to flapjack-nagios-receiver. Run it like so:
|
134
134
|
|
135
|
-
flapjack-nagios-receiver-control start -- --config /etc/flapjack/flapjack-config.yaml /path/to/nagios/perfdata.fifo
|
135
|
+
flapjack-nagios-receiver-control start -- --config /etc/flapjack/flapjack-config.yaml --fifo /path/to/nagios/perfdata.fifo
|
136
136
|
flapjack-nagios-receiver-control status
|
137
|
-
flapjack-nagios-receiver-control restart -- --config /etc/flapjack/flapjack-config.yaml /path/to/nagios/perfdata.fifo
|
137
|
+
flapjack-nagios-receiver-control restart -- --config /etc/flapjack/flapjack-config.yaml --fifo /path/to/nagios/perfdata.fifo
|
138
138
|
flapjack-nagios-receiver-control stop
|
139
139
|
|
140
140
|
* Bypassing daemons control script: *
|
141
141
|
|
142
|
-
|
142
|
+
Specify the path to the nagios named pipe (fifo):
|
143
143
|
|
144
|
-
flapjack-nagios-receiver
|
145
|
-
|
146
|
-
Or the path to the fifo can just be given as an argument, thanks to the magical powers of ARGV:
|
147
|
-
|
148
|
-
flapjack-nagios-receiver /var/cache/nagios3/event_stream.fifo
|
144
|
+
flapjack-nagios-receiver --fifo /var/cache/nagios3/event_stream.fifo
|
149
145
|
|
150
146
|
Now as nagios feeds check execution results into the perfdata named pipe, flapjack-nagios-receiver will convert them to JSON encoded ruby objects and insert them into the *events* queue.
|
151
147
|
|
@@ -18,8 +18,8 @@ OptionParser.new do |opts|
|
|
18
18
|
options.config = c
|
19
19
|
end
|
20
20
|
|
21
|
-
opts.on("-f", "--fifo
|
22
|
-
options.
|
21
|
+
opts.on("-f", "--fifo FIFO", String, "Path to the nagios perfdata named pipe") do |f|
|
22
|
+
options.fifo = f
|
23
23
|
end
|
24
24
|
|
25
25
|
end.parse!(ARGV)
|
@@ -42,10 +42,12 @@ if config_env.nil? || config_env.empty?
|
|
42
42
|
exit(false)
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
if !options.fifo
|
46
|
+
puts "You must specify a path to the nagios perfdata named pipe using the --fifo option"
|
47
|
+
exit(false)
|
48
|
+
end
|
49
|
+
|
50
|
+
@fifo = File.new(options.fifo)
|
49
51
|
|
50
52
|
# nagios.cfg contains the following templates for host and service data (modified from the default
|
51
53
|
# to include hoststate / servicestate, and a fake service 'HOST' for hostperfdata, so that the
|
@@ -71,11 +73,10 @@ def process_input
|
|
71
73
|
redis = Redis.new(:db => @redis_db, :host => @redis_host, :port => @redis_port)
|
72
74
|
end
|
73
75
|
|
74
|
-
puts "ARGV after option processing looks like this: [#{ARGV.inspect}]"
|
75
|
-
|
76
76
|
begin
|
77
|
-
while line =
|
78
|
-
|
77
|
+
while line = @fifo.gets
|
78
|
+
skip unless line
|
79
|
+
object_type, timestamp, entity, check, state, check_time, check_latency, check_output, check_perfdata = line.split("\t")
|
79
80
|
puts "#{object_type}, #{timestamp}, #{entity}, #{check}, #{state}, #{check_output}"
|
80
81
|
next unless line.length == 9
|
81
82
|
next unless timestamp =~ /^\d+$/
|
@@ -28,9 +28,8 @@ fi
|
|
28
28
|
|
29
29
|
# Evaluate command
|
30
30
|
|
31
|
-
|
32
|
-
rbenv shell 1.9.3-p125 && flapjack-nagios-receiver-control $1 -- --config /etc/flapjack/flapjack-config.yaml ${NAGIOS_PERFDATA_FIFO}
|
33
|
-
RETVAL=$?
|
31
|
+
rbenv shell 1.9.3-p125 && flapjack-nagios-receiver-control $1 -- --config /etc/flapjack/flapjack-config.yaml --fifo ${NAGIOS_PERFDATA_FIFO}
|
34
32
|
|
33
|
+
RETVAL=$?
|
35
34
|
exit $RETVAL
|
36
35
|
|
data/lib/flapjack/coordinator.rb
CHANGED
@@ -227,12 +227,8 @@ module Flapjack
|
|
227
227
|
end
|
228
228
|
|
229
229
|
def build_redis_connection_pool(options = {})
|
230
|
-
redis_em_options = @redis_options.dup
|
231
|
-
redis_db = redis_em_options.delete(:db)
|
232
230
|
EventMachine::Synchrony::ConnectionPool.new(:size => options[:size] || 5) do
|
233
|
-
|
234
|
-
redis.select(redis_db)
|
235
|
-
redis
|
231
|
+
::Redis.new(@redis_options)
|
236
232
|
end
|
237
233
|
end
|
238
234
|
|
data/lib/flapjack/pikelet.rb
CHANGED
@@ -27,15 +27,9 @@ module Flapjack
|
|
27
27
|
def build_redis_connection_pool(options = {})
|
28
28
|
return unless @bootstrapped
|
29
29
|
if defined?(EventMachine) && defined?(EventMachine::Synchrony)
|
30
|
-
|
31
|
-
redis_em_options = @redis_config.dup
|
32
|
-
redis_db = redis_em_options.delete(:db)
|
33
30
|
EventMachine::Synchrony::ConnectionPool.new(:size => options[:size] || 5) do
|
34
|
-
|
35
|
-
r.select(redis_db)
|
36
|
-
r
|
31
|
+
::Redis.new(@redis_config)
|
37
32
|
end
|
38
|
-
|
39
33
|
else
|
40
34
|
::Redis.new(@redis_config)
|
41
35
|
end
|
data/lib/flapjack/version.rb
CHANGED