flapjack 0.7.32 → 0.7.33
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/CHANGELOG.md +5 -0
- data/README.md +88 -2
- data/dist/etc/init.d/flapjack +14 -3
- data/etc/flapjack_config.yaml.example +1 -1
- data/lib/flapjack/gateways/jabber.rb +8 -8
- data/lib/flapjack/version.rb +1 -1
- data/spec/lib/flapjack/gateways/jabber_spec.rb +32 -0
- metadata +4 -4
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
## Flapjack Changelog
|
|
2
2
|
|
|
3
|
+
# 0.7.33 - 2013-11-15
|
|
4
|
+
- Feature: Ignore XMPP transcript history replay on connect gh-23 (@ali-graham)
|
|
5
|
+
- Feature: Allow newlines in Jabber comments and commands gh-34 (@ali-graham)
|
|
6
|
+
- Docs: Add quickstarts to README gh-352 (@jessereynolds)
|
|
7
|
+
|
|
3
8
|
# 0.7.32 - 2013-11-12
|
|
4
9
|
- Feature: Improve flapjack-nagios-receiver --help to output example Nagios config gh-317 (@jessereynolds)
|
|
5
10
|
- Bug: Crash with jabber query 'tell me about ENTITY' gh-367 (@ali-graham)
|
data/README.md
CHANGED
|
@@ -10,12 +10,98 @@ Flapjack provides a scalable method for dealing with events representing changes
|
|
|
10
10
|
|
|
11
11
|
At its core, Flapjack processes events received from external check execution engines, such as Nagios. Nagios provides a 'perfdata' event output channel, which writes to a named pipe. `flapjack-nagios-receiver` then reads from this named pipe, converts each line to JSON and adds them to the events queue.
|
|
12
12
|
|
|
13
|
-
Flapjack
|
|
13
|
+
Flapjack picks up the events and processes them -- deciding when and who to notifify about problems, recoveries, acknowledgements, etc.
|
|
14
14
|
|
|
15
15
|
Additional check engines can be supported by adding additional receiver processes similar to the nagios receiver.
|
|
16
16
|
|
|
17
|
+
## Installing
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
**Ubuntu Precise 64 (12.04):**
|
|
20
|
+
|
|
21
|
+
Add the flapjack deb repository to your apt sources:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
echo 'deb http://packages.flapjack.io/deb precise main' > /tmp/flapjack.list
|
|
25
|
+
sudo cp /tmp/flapjack.list /etc/apt/sources.list.d/flapjack.list
|
|
26
|
+
sudo apt-get update
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Install the latest flapjack package:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
sudo apt-get install flapjack
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Alternatively, [download the deb](http://packages.flapjack.io/deb/pool/main/f/flapjack/) and install using `sudo dpkg -i <filename>`
|
|
36
|
+
|
|
37
|
+
The flapjack package is an 'omnibus' package and as such contains most dependencies under /opt/flapjack, including redis.
|
|
38
|
+
|
|
39
|
+
Installing the package will start redis and flapjack. You should now be able to access the flapjack Web UI at:
|
|
40
|
+
|
|
41
|
+
[http://localhost:3080/](http://localhost:3080)
|
|
42
|
+
|
|
43
|
+
And consume the REST API at:
|
|
44
|
+
|
|
45
|
+
[http://localhost:3081/](http://localhost:3081)
|
|
46
|
+
|
|
47
|
+
**Other OSes:**
|
|
48
|
+
|
|
49
|
+
Currently we only make a package for Ubuntu Precise (amd64). If you feel comfortable getting a ruby 1.9 or 2.0 environment going on your preferred OS, then you can also just install flapjack from rubygems.org:
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
gem install flapjack
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Using a tool like [rbenv](https://github.com/sstephenson/rbenv) or [rvm](https://rvm.io/) is recommended to keep your ruby applications from intefering with one another.
|
|
56
|
+
|
|
57
|
+
Alternatively, you can add support for your OS of choice to [omnibus-flapjack](https://github.com/flpjck/omnibus-flapjack) and build a native package. Pull requests welcome!
|
|
58
|
+
|
|
59
|
+
## Configuring
|
|
60
|
+
|
|
61
|
+
Have a look at the default config file and modify things as required. See the [Configuring Components](https://github.com/flpjck/flapjack/wiki/USING#wiki-configuring_components) section on the wiki for more details.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# hack the config
|
|
65
|
+
sudo vi /etc/flapjack/flapjack_config.yaml
|
|
66
|
+
|
|
67
|
+
# reload the config
|
|
68
|
+
sudo /etc/init.d/flapjack reload
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Running
|
|
72
|
+
|
|
73
|
+
**Ubuntu Precise 64:**
|
|
74
|
+
|
|
75
|
+
After installing the flapjack package, redis and flapjack should be automatically started.
|
|
76
|
+
|
|
77
|
+
First up, start redis if it's not already started:
|
|
78
|
+
```bash
|
|
79
|
+
# status:
|
|
80
|
+
sudo /etc/init.d/redis status
|
|
81
|
+
|
|
82
|
+
# start:
|
|
83
|
+
sudo /etc/init.d/redis start
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Operating flapjack:
|
|
87
|
+
```bash
|
|
88
|
+
# status:
|
|
89
|
+
sudo /etc/init.d/flapjack status
|
|
90
|
+
|
|
91
|
+
# reload:
|
|
92
|
+
sudo /etc/init.d/flapjack reload
|
|
93
|
+
|
|
94
|
+
# restart:
|
|
95
|
+
sudo /etc/init.d/flapjack restart
|
|
96
|
+
|
|
97
|
+
# stop:
|
|
98
|
+
sudo /etc/init.d/flapjack stop
|
|
99
|
+
|
|
100
|
+
# start:
|
|
101
|
+
sudo /etc/init.d/flapjack start
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Using - Details
|
|
19
105
|
|
|
20
106
|
For more information, including full specification of the configuration file and the data import formats, please refer to the [USING](https://github.com/flpjck/flapjack/wiki/USING) section of the Flapjack wiki
|
|
21
107
|
|
data/dist/etc/init.d/flapjack
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
### BEGIN INIT INFO
|
|
4
|
+
# Provides: flapjack
|
|
5
|
+
# Required-Start: $syslog $remote_fs redis-flapjack
|
|
6
|
+
# Required-Stop: $syslog $remote_fs redis-flapjack
|
|
7
|
+
# Should-Start: $local_fs
|
|
8
|
+
# Should-Stop: $local_fs
|
|
9
|
+
# Default-Start: 2 3 4 5
|
|
10
|
+
# Default-Stop: 0 1 6
|
|
11
|
+
# Short-Description: flapjack - scalable monitoring notification system
|
|
12
|
+
# Description: flapjack - scalable monitoring notification system
|
|
13
|
+
### END INIT INFO
|
|
14
|
+
|
|
3
15
|
# Copyright (c) 2009-2013 Lindsay Holmwood <lindsay@holmwood.id.au>
|
|
4
16
|
#
|
|
5
|
-
# flapjack
|
|
6
17
|
# Boots flapjack (coordinator, processor, notifier, gateways...)
|
|
7
|
-
#
|
|
8
18
|
|
|
9
19
|
PATH=/opt/flapjack/bin:$PATH
|
|
10
20
|
|
|
@@ -19,3 +29,4 @@ flapjack $1
|
|
|
19
29
|
|
|
20
30
|
RETVAL=$?
|
|
21
31
|
exit $RETVAL
|
|
32
|
+
|
|
@@ -112,7 +112,7 @@ module Flapjack
|
|
|
112
112
|
presence = Blather::Stanza::Presence.new
|
|
113
113
|
presence.from = @flapjack_jid
|
|
114
114
|
presence.to = Blather::JID.new("#{room}/#{@config['alias']}")
|
|
115
|
-
presence << "<x xmlns='http://jabber.org/protocol/muc'
|
|
115
|
+
presence << "<x xmlns='http://jabber.org/protocol/muc'><history maxstanzas='0'></x>"
|
|
116
116
|
EventMachine::Synchrony.next_tick do
|
|
117
117
|
write presence
|
|
118
118
|
say(room, "flapjack jabber gateway started at #{Time.now}, hello!", :groupchat)
|
|
@@ -171,7 +171,7 @@ module Flapjack
|
|
|
171
171
|
command = th.chunks.join(' ')
|
|
172
172
|
|
|
173
173
|
case command
|
|
174
|
-
when /^ACKID\s+(\d+)(?:\s*(.*?)(?:\s*duration:.*?(\w+.*))?)$/
|
|
174
|
+
when /^ACKID\s+(\d+)(?:\s*(.*?)(?:\s*duration:.*?(\w+.*))?)$/im
|
|
175
175
|
ackid = $1
|
|
176
176
|
comment = $2
|
|
177
177
|
duration_str = $3
|
|
@@ -241,7 +241,7 @@ module Flapjack
|
|
|
241
241
|
"System CPU Time: #{t.stime}\n" +
|
|
242
242
|
`uname -a`.chomp + "\n"
|
|
243
243
|
|
|
244
|
-
when /^test notifications for\s+([a-z0-9\-\.]+)(?::(.+))?$/
|
|
244
|
+
when /^test notifications for\s+([a-z0-9\-\.]+)(?::(.+))?$/im
|
|
245
245
|
entity_name = $1
|
|
246
246
|
check_name = $2 || 'test'
|
|
247
247
|
|
|
@@ -254,7 +254,7 @@ module Flapjack
|
|
|
254
254
|
msg = "yeah, no I can't see #{entity_name} in my systems"
|
|
255
255
|
end
|
|
256
256
|
|
|
257
|
-
when /^tell me about\s+([a-z0-9\-\.]+)(?::(.+))?$+/
|
|
257
|
+
when /^tell me about\s+([a-z0-9\-\.]+)(?::(.+))?$+/im
|
|
258
258
|
entity_name = $1
|
|
259
259
|
check_name = $2
|
|
260
260
|
|
|
@@ -280,7 +280,7 @@ module Flapjack
|
|
|
280
280
|
msg = "hmmm, I can't see #{entity_name} in my systems"
|
|
281
281
|
end
|
|
282
282
|
|
|
283
|
-
when /^(?:find )?checks(?:\s+matching\s+\/(.+)\/)?\s+on\s+(?:entities matching\s+\/(.+)\/|([a-z0-9\-\.]+))/
|
|
283
|
+
when /^(?:find )?checks(?:\s+matching\s+\/(.+)\/)?\s+on\s+(?:entities matching\s+\/(.+)\/|([a-z0-9\-\.]+))/im
|
|
284
284
|
check_pattern = $1 ? $1.chomp.strip : nil
|
|
285
285
|
entity_pattern = $2 ? $2.chomp.strip : nil
|
|
286
286
|
entity_name = $3
|
|
@@ -333,7 +333,7 @@ module Flapjack
|
|
|
333
333
|
end
|
|
334
334
|
end
|
|
335
335
|
|
|
336
|
-
when /^(?:find )?entities matching\s+\/(.+)\//
|
|
336
|
+
when /^(?:find )?entities matching\s+\/(.+)\//im
|
|
337
337
|
pattern = $1.chomp.strip
|
|
338
338
|
entity_list = Flapjack::Data::Entity.find_all_name_matching(pattern, :redis => @redis)
|
|
339
339
|
|
|
@@ -371,7 +371,7 @@ module Flapjack
|
|
|
371
371
|
return if @should_quit
|
|
372
372
|
@logger.debug("groupchat message received: #{stanza.inspect}")
|
|
373
373
|
|
|
374
|
-
if stanza.body =~ /^#{@config['alias']}:\s+(.*)/
|
|
374
|
+
if stanza.body =~ /^#{@config['alias']}:\s+(.*)/m
|
|
375
375
|
command = $1
|
|
376
376
|
end
|
|
377
377
|
|
|
@@ -397,7 +397,7 @@ module Flapjack
|
|
|
397
397
|
return if @should_quit
|
|
398
398
|
@logger.debug("chat message received: #{stanza.inspect}")
|
|
399
399
|
|
|
400
|
-
if stanza.body =~ /^flapjack:\s+(.*)/
|
|
400
|
+
if stanza.body =~ /^flapjack:\s+(.*)/m
|
|
401
401
|
command = $1
|
|
402
402
|
else
|
|
403
403
|
command = stanza.body
|
data/lib/flapjack/version.rb
CHANGED
|
@@ -116,6 +116,38 @@ describe Flapjack::Gateways::Jabber, :logger => true do
|
|
|
116
116
|
fj.on_groupchat(stanza)
|
|
117
117
|
end
|
|
118
118
|
|
|
119
|
+
it "handles a message with a newline in it" do
|
|
120
|
+
stanza.should_receive(:body).
|
|
121
|
+
and_return("flapjack: tell me about \nexample.com")
|
|
122
|
+
|
|
123
|
+
from = double('from')
|
|
124
|
+
from.should_receive(:stripped).and_return('sender')
|
|
125
|
+
stanza.should_receive(:from).and_return(from)
|
|
126
|
+
|
|
127
|
+
redis = double('redis')
|
|
128
|
+
entity = double(Flapjack::Data::Entity)
|
|
129
|
+
entity.should_receive(:check_list).and_return(['ping'])
|
|
130
|
+
|
|
131
|
+
Flapjack::Data::Entity.should_receive(:find_by_name).with('example.com',
|
|
132
|
+
:redis => redis).and_return(entity)
|
|
133
|
+
|
|
134
|
+
entity_check = double(Flapjack::Data::EntityCheck)
|
|
135
|
+
entity_check.should_receive(:current_maintenance).with(:scheduled => true).and_return(nil)
|
|
136
|
+
entity_check.should_receive(:current_maintenance).with(:unscheduled => true).and_return(nil)
|
|
137
|
+
|
|
138
|
+
Flapjack::Data::EntityCheck.should_receive(:for_entity).with(entity, 'ping',
|
|
139
|
+
:redis => redis).and_return(entity_check)
|
|
140
|
+
|
|
141
|
+
Flapjack::RedisPool.should_receive(:new).and_return(redis)
|
|
142
|
+
fj = Flapjack::Gateways::Jabber.new(:config => config, :logger => @logger)
|
|
143
|
+
|
|
144
|
+
EventMachine::Synchrony.should_receive(:next_tick).and_yield
|
|
145
|
+
fj.should_receive(:connected?).and_return(true)
|
|
146
|
+
fj.should_receive(:write).with(an_instance_of(Blather::Stanza::Message))
|
|
147
|
+
|
|
148
|
+
fj.on_groupchat(stanza)
|
|
149
|
+
end
|
|
150
|
+
|
|
119
151
|
it "receives a message it doesn't understand" do
|
|
120
152
|
stanza.should_receive(:body).once.and_return('flapjack: hello!')
|
|
121
153
|
from = double('from')
|
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.33
|
|
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-15 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: -3960452771586560623
|
|
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: -3960452771586560623
|
|
571
571
|
requirements: []
|
|
572
572
|
rubyforge_project:
|
|
573
573
|
rubygems_version: 1.8.23
|