flapjack 0.7.31 → 0.7.32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/bin/flapjack-nagios-receiver +31 -1
- data/features/cli_flapjack-nagios-receiver.feature +1 -0
- data/lib/flapjack/gateways/jabber.rb +18 -8
- data/lib/flapjack/version.rb +1 -1
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## Flapjack Changelog
|
2
2
|
|
3
|
+
# 0.7.32 - 2013-11-12
|
4
|
+
- Feature: Improve flapjack-nagios-receiver --help to output example Nagios config gh-317 (@jessereynolds)
|
5
|
+
- Bug: Crash with jabber query 'tell me about ENTITY' gh-367 (@ali-graham)
|
6
|
+
|
3
7
|
# 0.7.31 - 2013-11-06
|
4
8
|
- Bug: TypeError at /checks_all gh-363 (@jessereynolds)
|
5
9
|
|
@@ -116,6 +116,35 @@ optparse = OptionParser.new do |opts|
|
|
116
116
|
options.logfile = l
|
117
117
|
end
|
118
118
|
|
119
|
+
opts.on_tail("-h", "--help", "Show this usage message") do
|
120
|
+
puts opts
|
121
|
+
puts '
|
122
|
+
Required Nagios Configuration Changes
|
123
|
+
-------------------------------------
|
124
|
+
|
125
|
+
flapjack-nagios-receiver reads events from a named pipe written to by Nagios. The named pipe needs creating, and Nagios needs to be told to write performance data output to it.
|
126
|
+
|
127
|
+
To create the named pipe:
|
128
|
+
|
129
|
+
mkfifo -m 0666 /var/cache/nagios3/event_stream.fifo
|
130
|
+
|
131
|
+
nagios.cfg changes:
|
132
|
+
|
133
|
+
# modified lines:
|
134
|
+
enable_notifications=0
|
135
|
+
host_perfdata_file=/var/cache/nagios3/event_stream.fifo
|
136
|
+
service_perfdata_file=/var/cache/nagios3/event_stream.fifo
|
137
|
+
host_perfdata_file_template=[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\tHOST\t$HOSTSTATE$\t$HOSTEXECUTIONTIME$\t$HOSTLATENCY$\t$HOSTOUTPUT$\t$HOSTPERFDATA$
|
138
|
+
service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$
|
139
|
+
host_perfdata_file_mode=p
|
140
|
+
service_perfdata_file_mode=p
|
141
|
+
|
142
|
+
Details on the wiki: https://github.com/flpjck/flapjack/wiki/USING#configuring-nagios
|
143
|
+
'
|
144
|
+
|
145
|
+
exit
|
146
|
+
end
|
147
|
+
|
119
148
|
end
|
120
149
|
optparse.parse!(ARGV)
|
121
150
|
|
@@ -128,7 +157,8 @@ redis_options = config.for_redis
|
|
128
157
|
|
129
158
|
if config_env.nil? || config_env.empty?
|
130
159
|
puts "No config data for environment '#{FLAPJACK_ENV}' found in '#{options.config}'"
|
131
|
-
|
160
|
+
puts optparse
|
161
|
+
exit 1
|
132
162
|
end
|
133
163
|
|
134
164
|
config_nr = config_env['nagios-receiver'] || {}
|
@@ -30,6 +30,7 @@ test:
|
|
30
30
|
Then the exit status should be 0
|
31
31
|
And the output should contain "Usage: flapjack-nagios-receiver"
|
32
32
|
And the output should contain "-f, --fifo FIFO"
|
33
|
+
And the output should contain "Required Nagios Configuration Changes"
|
33
34
|
|
34
35
|
Scenario: Starting flapjack-nagios-receiver
|
35
36
|
When I start flapjack-nagios-receiver with `flapjack-nagios-receiver start --no-daemonize --config tmp/cucumber_cli/flapjack-nagios-receiver.yaml`
|
@@ -128,7 +128,7 @@ module Flapjack
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
def get_check_details(entity_check)
|
131
|
+
def get_check_details(entity_check, current_time)
|
132
132
|
sched = entity_check.current_maintenance(:scheduled => true)
|
133
133
|
unsched = entity_check.current_maintenance(:unscheduled => true)
|
134
134
|
out = ''
|
@@ -273,7 +273,7 @@ module Flapjack
|
|
273
273
|
entity_check = Flapjack::Data::EntityCheck.for_entity(entity, check, :redis => @redis)
|
274
274
|
next if entity_check.nil?
|
275
275
|
msg += "---\n#{entity_name}:#{check}\n" if check_name.nil?
|
276
|
-
msg += get_check_details(entity_check)
|
276
|
+
msg += get_check_details(entity_check, current_time)
|
277
277
|
end
|
278
278
|
end
|
279
279
|
else
|
@@ -375,9 +375,14 @@ module Flapjack
|
|
375
375
|
command = $1
|
376
376
|
end
|
377
377
|
|
378
|
-
|
379
|
-
|
380
|
-
|
378
|
+
begin
|
379
|
+
results = interpreter(command)
|
380
|
+
msg = results[:msg]
|
381
|
+
action = results[:action]
|
382
|
+
rescue => e
|
383
|
+
@logger.error("Exception when interpreting command '#{command}' - #{e.class}, #{e.message}")
|
384
|
+
msg = "Oops, something went wrong processing that command (#{e.class}, #{e.message})"
|
385
|
+
end
|
381
386
|
|
382
387
|
if msg || action
|
383
388
|
EventMachine::Synchrony.next_tick do
|
@@ -398,9 +403,14 @@ module Flapjack
|
|
398
403
|
command = stanza.body
|
399
404
|
end
|
400
405
|
|
401
|
-
|
402
|
-
|
403
|
-
|
406
|
+
begin
|
407
|
+
results = interpreter(command)
|
408
|
+
msg = results[:msg]
|
409
|
+
action = results[:action]
|
410
|
+
rescue => e
|
411
|
+
@logger.error("Exception when interpreting command '#{command}' - #{e.class}, #{e.message}")
|
412
|
+
msg = "Oops, something went wrong processing that command (#{e.class}, #{e.message})"
|
413
|
+
end
|
404
414
|
|
405
415
|
if msg || action
|
406
416
|
EventMachine::Synchrony.next_tick do
|
data/lib/flapjack/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flapjack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.32
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-11-
|
14
|
+
date: 2013-11-11 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: dante
|
@@ -558,7 +558,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
558
558
|
version: '0'
|
559
559
|
segments:
|
560
560
|
- 0
|
561
|
-
hash:
|
561
|
+
hash: 834691896094237630
|
562
562
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
563
563
|
none: false
|
564
564
|
requirements:
|
@@ -567,7 +567,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
567
567
|
version: '0'
|
568
568
|
segments:
|
569
569
|
- 0
|
570
|
-
hash:
|
570
|
+
hash: 834691896094237630
|
571
571
|
requirements: []
|
572
572
|
rubyforge_project:
|
573
573
|
rubygems_version: 1.8.23
|