flapjack 0.7.18 → 0.7.19
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -0
- data/bin/flapjack +3 -0
- data/bin/flapjack-nagios-receiver +4 -1
- data/bin/flapjack-netsaint-parser +2 -1
- data/bin/flapjack-populator +6 -3
- data/bin/receive-events +3 -1
- data/bin/simulate-failed-check +2 -1
- data/etc/flapjack_config.yaml.example +20 -0
- data/features/events.feature +1 -1
- data/features/events_check_names.feature +1 -1
- data/features/notification_rules.feature +1 -1
- data/features/notifications.feature +1 -1
- data/features/steps/events_steps.rb +18 -17
- data/features/steps/flapjack-netsaint-parser_steps.rb +1 -2
- data/features/steps/notifications_steps.rb +14 -1
- data/features/support/env.rb +27 -10
- data/flapjack.gemspec +1 -3
- data/lib/flapjack/coordinator.rb +30 -20
- data/lib/flapjack/data/contact.rb +3 -2
- data/lib/flapjack/data/entity.rb +3 -3
- data/lib/flapjack/data/entity_check.rb +116 -43
- data/lib/flapjack/data/event.rb +10 -10
- data/lib/flapjack/data/message.rb +3 -6
- data/lib/flapjack/data/notification.rb +122 -57
- data/lib/flapjack/data/notification_rule.rb +11 -11
- data/lib/flapjack/filters/acknowledgement.rb +2 -2
- data/lib/flapjack/filters/ok.rb +1 -1
- data/lib/flapjack/gateways/api/entity_check_presenter.rb +1 -0
- data/lib/flapjack/gateways/api/entity_methods.rb +4 -6
- data/lib/flapjack/gateways/api/rack/json_params_parser.rb +1 -1
- data/lib/flapjack/gateways/email.rb +3 -5
- data/lib/flapjack/gateways/email/{alert.html.haml → alert.html.erb} +0 -0
- data/lib/flapjack/gateways/jabber.rb +66 -35
- data/lib/flapjack/gateways/oobetet.rb +5 -7
- data/lib/flapjack/gateways/pagerduty.rb +7 -7
- data/lib/flapjack/gateways/web.rb +101 -41
- data/lib/flapjack/gateways/web/public/css/flapjack.css +1 -1
- data/lib/flapjack/gateways/web/views/{_css.haml → _css.html.erb} +2 -1
- data/lib/flapjack/gateways/web/views/_foot.html.erb +3 -0
- data/lib/flapjack/gateways/web/views/_head.html.erb +4 -0
- data/lib/flapjack/gateways/web/views/_nav.html.erb +9 -0
- data/lib/flapjack/gateways/web/views/check.html.erb +204 -0
- data/lib/flapjack/gateways/web/views/checks.html.erb +77 -0
- data/lib/flapjack/gateways/web/views/contact.html.erb +114 -0
- data/lib/flapjack/gateways/web/views/contacts.html.erb +42 -0
- data/lib/flapjack/gateways/web/views/entities.html.erb +39 -0
- data/lib/flapjack/gateways/web/views/entity.html.erb +67 -0
- data/lib/flapjack/gateways/web/views/index.html.erb +27 -0
- data/lib/flapjack/gateways/web/views/self_stats.html.erb +97 -0
- data/lib/flapjack/logger.rb +71 -23
- data/lib/flapjack/notifier.rb +157 -0
- data/lib/flapjack/patches.rb +1 -41
- data/lib/flapjack/pikelet.rb +4 -2
- data/lib/flapjack/{executive.rb → processor.rb} +32 -145
- data/lib/flapjack/version.rb +1 -1
- data/spec/lib/flapjack/coordinator_spec.rb +134 -71
- data/spec/lib/flapjack/data/contact_spec.rb +1 -0
- data/spec/lib/flapjack/data/entity_check_spec.rb +146 -30
- data/spec/lib/flapjack/data/entity_spec.rb +4 -4
- data/spec/lib/flapjack/data/event_spec.rb +4 -4
- data/spec/lib/flapjack/data/message_spec.rb +2 -3
- data/spec/lib/flapjack/data/notification_spec.rb +13 -19
- data/spec/lib/flapjack/gateways/api/entity_methods_spec.rb +2 -2
- data/spec/lib/flapjack/gateways/jabber_spec.rb +34 -0
- data/spec/lib/flapjack/gateways/pagerduty_spec.rb +0 -2
- data/spec/lib/flapjack/gateways/web/views/{check.haml_spec.rb → check.html.erb_spec.rb} +2 -2
- data/spec/lib/flapjack/gateways/web/views/{contact.haml_spec.rb → contact.html.erb_spec.rb} +3 -3
- data/spec/lib/flapjack/gateways/web/views/index.html.erb_spec.rb +14 -0
- data/spec/lib/flapjack/gateways/web_spec.rb +20 -8
- data/spec/lib/flapjack/logger_spec.rb +30 -28
- data/spec/lib/flapjack/notifier_spec.rb +6 -0
- data/spec/lib/flapjack/pikelet_spec.rb +8 -8
- data/spec/lib/flapjack/{executive_spec.rb → processor_spec.rb} +4 -4
- data/spec/spec_helper.rb +1 -13
- data/spec/support/erb_view_helper.rb +23 -0
- data/tasks/profile.rake +1 -1
- data/tmp/acknowledge.rb +3 -1
- data/tmp/create_event_ok.rb +3 -1
- data/tmp/create_event_unknown.rb +3 -1
- data/tmp/create_events_failure.rb +3 -1
- data/tmp/create_events_ok.rb +3 -1
- data/tmp/create_events_ok_fail_ack_ok.rb +3 -1
- data/tmp/create_events_ok_failure.rb +3 -1
- data/tmp/create_events_ok_failure_ack.rb +3 -1
- data/tmp/test_json_post.rb +5 -3
- data/tmp/test_notification_rules_api.rb +5 -3
- metadata +32 -61
- data/lib/flapjack/gateways/web/views/_foot.haml +0 -8
- data/lib/flapjack/gateways/web/views/_head.haml +0 -10
- data/lib/flapjack/gateways/web/views/_nav.haml +0 -14
- data/lib/flapjack/gateways/web/views/check.haml +0 -191
- data/lib/flapjack/gateways/web/views/checks.haml +0 -49
- data/lib/flapjack/gateways/web/views/contact.haml +0 -85
- data/lib/flapjack/gateways/web/views/contacts.haml +0 -30
- data/lib/flapjack/gateways/web/views/entities.haml +0 -28
- data/lib/flapjack/gateways/web/views/entity.haml +0 -50
- data/lib/flapjack/gateways/web/views/index.haml +0 -32
- data/lib/flapjack/gateways/web/views/self_stats.haml +0 -70
- data/spec/lib/flapjack/gateways/web/views/index.haml_spec.rb +0 -13
- data/spec/support/haml_view_helper.rb +0 -15
@@ -1,85 +0,0 @@
|
|
1
|
-
!!! 5
|
2
|
-
- nav = render_haml('_nav.haml', self)
|
3
|
-
- head = render_haml('_head.haml', self)
|
4
|
-
- foot = render_haml('_foot.haml', self)
|
5
|
-
%html
|
6
|
-
%head
|
7
|
-
%title Flapjack - #{@contact.name} (contact)
|
8
|
-
= head
|
9
|
-
%body
|
10
|
-
%div#wrap
|
11
|
-
%div{:class => "container"}
|
12
|
-
%div{:class => "page-header"}
|
13
|
-
= nav
|
14
|
-
%h2= @contact.name
|
15
|
-
%h3= "Contact Media"
|
16
|
-
- if @contact.media && !@contact.media.empty?
|
17
|
-
%table{:class => "table table-bordered table-hover table-condensed"}
|
18
|
-
%tr
|
19
|
-
%th Media
|
20
|
-
%th Address
|
21
|
-
%th Interval
|
22
|
-
- @contact.media.each_pair do |mk, mv|
|
23
|
-
%tr
|
24
|
-
- if 'pagerduty'.eql?(mk)
|
25
|
-
%td PagerDuty
|
26
|
-
%td
|
27
|
-
- @pagerduty_credentials.each_pair do |pk, pv|
|
28
|
-
- if 'password'.eql?(pk)
|
29
|
-
%p= "#{pk}: ..."
|
30
|
-
- else
|
31
|
-
%p= "#{pk}: #{pv}"
|
32
|
-
%td -
|
33
|
-
- else
|
34
|
-
%td #{mk.capitalize}
|
35
|
-
%td #{mv}
|
36
|
-
%td
|
37
|
-
- if interval = @contact.media_intervals[mk]
|
38
|
-
#{@contact.media_intervals[mk]} seconds
|
39
|
-
- else
|
40
|
-
no custom interval
|
41
|
-
- else
|
42
|
-
%p No media
|
43
|
-
%h3= "Entities and Checks"
|
44
|
-
- if @entities_and_checks && !@entities_and_checks.empty?
|
45
|
-
%table{:class => "table table-bordered table-hover table-condensed"}
|
46
|
-
%tr
|
47
|
-
%th Entity
|
48
|
-
%th Checks
|
49
|
-
- @entities_and_checks.each do |ec|
|
50
|
-
- entity = ec[:entity]
|
51
|
-
- checks = ec[:checks]
|
52
|
-
%tr
|
53
|
-
%td
|
54
|
-
- link = "/entity/#{CGI.escape(entity.name)}"
|
55
|
-
%a(title='entity status' href=link) #{entity.name}
|
56
|
-
%td
|
57
|
-
- checks.each do |check|
|
58
|
-
- link = "/check?entity=#{CGI.escape(entity.name)}&check=#{CGI.escape(check)}"
|
59
|
-
%a(title='check status' href=link) #{check}
|
60
|
-
- else
|
61
|
-
%p No entities
|
62
|
-
%h3= "Notification Rules"
|
63
|
-
- rules = @contact.notification_rules
|
64
|
-
- if rules && rules.length > 0
|
65
|
-
%table{:class => "table table-bordered table-hover table-condensed"}
|
66
|
-
%tr
|
67
|
-
%th ID
|
68
|
-
%th Entities
|
69
|
-
%th Entity Tags
|
70
|
-
%th Warning Media
|
71
|
-
%th Critical Media
|
72
|
-
%th Time Restrictions
|
73
|
-
- rules.each do |r|
|
74
|
-
%tr
|
75
|
-
%td #{r.id}
|
76
|
-
%td #{r.entities.join(', ')}
|
77
|
-
%td #{r.entity_tags ? r.entity_tags.join(', ') : ''}
|
78
|
-
%td #{r.warning_media.join(', ')}
|
79
|
-
%td #{r.critical_media.join(', ')}
|
80
|
-
%td #{r.time_restrictions}
|
81
|
-
- else
|
82
|
-
%p No notification rules
|
83
|
-
%div#push
|
84
|
-
%div#footer
|
85
|
-
= foot
|
@@ -1,30 +0,0 @@
|
|
1
|
-
!!! 5
|
2
|
-
- nav = render_haml('_nav.haml', self)
|
3
|
-
- head = render_haml('_head.haml', self)
|
4
|
-
- foot = render_haml('_foot.haml', self)
|
5
|
-
%html
|
6
|
-
%head
|
7
|
-
%title Flapjack - Contacts
|
8
|
-
= head
|
9
|
-
%body
|
10
|
-
%div#wrap
|
11
|
-
%div{:class => "container"}
|
12
|
-
%div{:class => "page-header"}
|
13
|
-
= nav
|
14
|
-
%h2 Contacts
|
15
|
-
- if @contacts && !@contacts.empty?
|
16
|
-
%table{:class => "table table-bordered table-hover table-condensed"}
|
17
|
-
%tr
|
18
|
-
%th Name
|
19
|
-
%th Email
|
20
|
-
- @contacts.sort_by {|c| [c.first_name, c.last_name] }.each do |contact|
|
21
|
-
%tr
|
22
|
-
%td
|
23
|
-
- link = "/contacts/#{contact.id}"
|
24
|
-
%a(title='contact details' href=link) #{contact.name}
|
25
|
-
%td= contact.email
|
26
|
-
- else
|
27
|
-
%p No contacts
|
28
|
-
%div#push
|
29
|
-
%div#footer
|
30
|
-
= foot
|
@@ -1,28 +0,0 @@
|
|
1
|
-
!!! 5
|
2
|
-
- nav = render_haml('_nav.haml', self)
|
3
|
-
- head = render_haml('_head.haml', self)
|
4
|
-
- foot = render_haml('_foot.haml', self)
|
5
|
-
%html
|
6
|
-
%head
|
7
|
-
%title Flapjack - #{@adjective.capitalize} Entities
|
8
|
-
= head
|
9
|
-
%body
|
10
|
-
%div#wrap
|
11
|
-
%div{:class => "container"}
|
12
|
-
%div{:class => "page-header"}
|
13
|
-
= nav
|
14
|
-
%h2 #{@adjective.capitalize} Entities
|
15
|
-
%p #{@count_failing_entities} failing out of #{@count_all_entities}
|
16
|
-
%table{:class => "table table-bordered table-hover table-condensed"}
|
17
|
-
- if @entities.length > 0
|
18
|
-
- @entities.sort.each do |entity|
|
19
|
-
%tr
|
20
|
-
%td
|
21
|
-
- link = "/entity/#{CGI.escape(entity)}"
|
22
|
-
%a{:href => link}
|
23
|
-
#{entity}
|
24
|
-
- else
|
25
|
-
%p No check output has been processed yet, so there's no entities we can show you here.
|
26
|
-
%div#push
|
27
|
-
%div#footer
|
28
|
-
= foot
|
@@ -1,50 +0,0 @@
|
|
1
|
-
!!! 5
|
2
|
-
- nav = render_haml('_nav.haml', self)
|
3
|
-
- head = render_haml('_head.haml', self)
|
4
|
-
- foot = render_haml('_foot.haml', self)
|
5
|
-
%html
|
6
|
-
%head
|
7
|
-
%title Flapjack - #{@entity} (entity)
|
8
|
-
= head
|
9
|
-
%body
|
10
|
-
%div#wrap
|
11
|
-
%div{:class => "container"}
|
12
|
-
%div{:class => "page-header"}
|
13
|
-
= nav
|
14
|
-
%h2 #{@entity}
|
15
|
-
- if @states.length > 0
|
16
|
-
%table{:class => "table table-bordered table-hover table-condensed"}
|
17
|
-
%tr
|
18
|
-
%th Check
|
19
|
-
%th State
|
20
|
-
%th Last State Change
|
21
|
-
%th Last Update
|
22
|
-
%th Last Notification
|
23
|
-
- @states.each do |entity, check, status, changed, updated, in_unscheduled_outage, in_scheduled_outage, notified_kind, notified|
|
24
|
-
- colour_class = status
|
25
|
-
- case status
|
26
|
-
- when 'critical', 'unknown'
|
27
|
-
- colour_class = 'error'
|
28
|
-
- when 'ok', 'up'
|
29
|
-
- colour_class = 'success'
|
30
|
-
%tr{:class => colour_class}
|
31
|
-
%td
|
32
|
-
- link = "/check?entity=" + CGI.escape(entity) + "&check=" + CGI.escape(check)
|
33
|
-
%a(title='check detail' href=link) #{check}
|
34
|
-
%td
|
35
|
-
= status.upcase
|
36
|
-
= " (Acknowledged)" if in_unscheduled_outage
|
37
|
-
= " (Scheduled Maintenance)" if in_scheduled_outage
|
38
|
-
%td= relative_time_ago(Time.at(changed.to_i)) + ' ago'
|
39
|
-
%td= relative_time_ago(Time.at(updated.to_i)) + ' ago'
|
40
|
-
- if notified && (notified > 0)
|
41
|
-
- last_notified = relative_time_ago(Time.at(notified.to_i)) + " ago, #{notified_kind}"
|
42
|
-
- else
|
43
|
-
- last_notified = 'never'
|
44
|
-
%td= last_notified
|
45
|
-
- else
|
46
|
-
%div#foo
|
47
|
-
%p This entity has no check output associated with it
|
48
|
-
%div#push
|
49
|
-
%div#footer
|
50
|
-
= foot
|
@@ -1,32 +0,0 @@
|
|
1
|
-
!!! 5
|
2
|
-
- nav = render_haml('_nav.haml', self)
|
3
|
-
- head = render_haml('_head.haml', self)
|
4
|
-
- foot = render_haml('_foot.haml', self)
|
5
|
-
%html
|
6
|
-
%head
|
7
|
-
%title Flapjack - Summary
|
8
|
-
= head
|
9
|
-
%body
|
10
|
-
%div#wrap
|
11
|
-
%div{:class => "container"}
|
12
|
-
%div{:class => "page-header"}
|
13
|
-
= nav
|
14
|
-
%h2 Summary
|
15
|
-
%h4
|
16
|
-
%a(title='failing entities' href='/entities_failing')
|
17
|
-
#{@count_failing_entities}
|
18
|
-
out of
|
19
|
-
%a(title='all entities' href='/entities_all')
|
20
|
-
#{@count_all_entities}
|
21
|
-
entities have failing checks
|
22
|
-
%h4
|
23
|
-
%a(title='failing checks' href='/checks_failing')
|
24
|
-
#{@count_failing_checks}
|
25
|
-
out of
|
26
|
-
%a(title='all checks' href='/checks_all')
|
27
|
-
#{@count_all_checks}
|
28
|
-
checks are failing
|
29
|
-
%img{:src => '/img/flapjack_white_bg_400_353.jpeg', :height => 353, :width => 400}
|
30
|
-
%div#push
|
31
|
-
%div#footer
|
32
|
-
= foot
|
@@ -1,70 +0,0 @@
|
|
1
|
-
!!! 5
|
2
|
-
- nav = render_haml('_nav.haml', self)
|
3
|
-
- head = render_haml('_head.haml', self)
|
4
|
-
- foot = render_haml('_foot.haml', self)
|
5
|
-
%html
|
6
|
-
%head
|
7
|
-
%title Flapjack - Internal Statistics
|
8
|
-
= head
|
9
|
-
%body
|
10
|
-
%div#wrap
|
11
|
-
%div{:class => "container"}
|
12
|
-
%div{:class => "page-header"}
|
13
|
-
= nav
|
14
|
-
%h2 Internal Statistics
|
15
|
-
%table{:class => "table table-bordered table-hover table-condensed"}
|
16
|
-
%tr
|
17
|
-
%td Events queued:
|
18
|
-
%td= @events_queued
|
19
|
-
%tr
|
20
|
-
%td Number of entities:
|
21
|
-
%td= @count_all_entities
|
22
|
-
%tr
|
23
|
-
%td Number of failing entities:
|
24
|
-
%td= @count_failing_entities
|
25
|
-
%tr
|
26
|
-
%td Number of checks:
|
27
|
-
%td= @count_all_checks
|
28
|
-
%tr
|
29
|
-
%td Number of failing checks:
|
30
|
-
%td= @count_failing_checks
|
31
|
-
%tr
|
32
|
-
%td Events processed (all time)
|
33
|
-
%td #{@event_counters['all']} (ok: #{@event_counters['ok']}, failure: #{@event_counters['failure']}, action: #{@event_counters['action']})
|
34
|
-
%tr
|
35
|
-
%td Events processed (this instance)
|
36
|
-
%td #{@event_counters_instance['all']} (ok: #{@event_counters_instance['ok']}, failure: #{@event_counters_instance['failure']}, action: #{@event_counters_instance['action']})
|
37
|
-
%tr
|
38
|
-
%td Average rate (this instance)
|
39
|
-
%td #{@event_rate_all} events per second
|
40
|
-
%tr
|
41
|
-
%td Total keys in redis
|
42
|
-
%td #{@dbsize}
|
43
|
-
%tr
|
44
|
-
%td Uptime
|
45
|
-
%td= @uptime_string
|
46
|
-
%tr
|
47
|
-
%td Boot time
|
48
|
-
%td= @boot_time
|
49
|
-
%tr
|
50
|
-
%td Current time
|
51
|
-
%td= Time.now
|
52
|
-
%h4
|
53
|
-
Executive Instances:
|
54
|
-
%table{:class => "table table-bordered table-hover"}
|
55
|
-
%tr
|
56
|
-
%th Hostname
|
57
|
-
%th PID
|
58
|
-
%th Started
|
59
|
-
- @executive_instances.each do |i|
|
60
|
-
- hostname, pid = i[0].split(':')
|
61
|
-
- started = "#{relative_time_ago(Time.at(i[1].to_i))} ago"
|
62
|
-
%tr
|
63
|
-
%td= hostname
|
64
|
-
%td= pid
|
65
|
-
%td= started
|
66
|
-
%p
|
67
|
-
%a{:href => 'self_stats.json'} Instrument as JSON
|
68
|
-
%div#push
|
69
|
-
%div#footer
|
70
|
-
= foot
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'web/views/checks.haml', :haml_view => true do
|
4
|
-
|
5
|
-
it "should escape unsafe check characters in URI parameters" do
|
6
|
-
@states = [['abc-xyz-01', 'Disk / Utilisation', '-', '-', '-', false, false, nil, nil]]
|
7
|
-
@adjective = "all"
|
8
|
-
|
9
|
-
page = render_haml('checks.haml', self)
|
10
|
-
page.should match(%r{\?entity=abc-xyz-01&check=Disk\+%2F\+Utilisation})
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'haml'
|
2
|
-
require 'flapjack/utility'
|
3
|
-
|
4
|
-
module HamlViewHelper
|
5
|
-
|
6
|
-
TEMPLATE_PATH = File.dirname(__FILE__) +
|
7
|
-
'/../../lib/flapjack/gateways/web/views/'
|
8
|
-
|
9
|
-
include Flapjack::Utility
|
10
|
-
|
11
|
-
def render_haml(file, scope)
|
12
|
-
Haml::Engine.new(File.read(TEMPLATE_PATH + file)).render(scope)
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|