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,7 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
|
3
|
+
require 'httparty'
|
4
|
+
|
5
|
+
require 'oj'
|
6
|
+
Oj.default_options = { :indent => 0, :mode => :strict }
|
5
7
|
|
6
8
|
class Foo
|
7
9
|
|
@@ -153,7 +155,7 @@ class Foo
|
|
153
155
|
do_post(url, data)
|
154
156
|
end
|
155
157
|
|
156
|
-
rule =
|
158
|
+
rule = Oj.load(get('/contacts/21/notification_rules').body).last
|
157
159
|
rule_id = rule['id']
|
158
160
|
raise RuntimeError unless rule_id
|
159
161
|
puts "****** NOTIFICATION RULE ID TO PICK ON (PUT, DELETE) IS: #{rule_id} ******"
|
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.19
|
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-07-
|
14
|
+
date: 2013-07-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: dante
|
@@ -30,23 +30,7 @@ dependencies:
|
|
30
30
|
- !ruby/object:Gem::Version
|
31
31
|
version: '0'
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
|
-
name:
|
34
|
-
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
|
-
requirements:
|
37
|
-
- - ! '>='
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '0'
|
40
|
-
type: :runtime
|
41
|
-
prerelease: false
|
42
|
-
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
|
-
requirements:
|
45
|
-
- - ! '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: yajl-ruby
|
33
|
+
name: oj
|
50
34
|
requirement: !ruby/object:Gem::Requirement
|
51
35
|
none: false
|
52
36
|
requirements:
|
@@ -205,22 +189,6 @@ dependencies:
|
|
205
189
|
- - ! '>='
|
206
190
|
- !ruby/object:Gem::Version
|
207
191
|
version: '0'
|
208
|
-
- !ruby/object:Gem::Dependency
|
209
|
-
name: haml
|
210
|
-
requirement: !ruby/object:Gem::Requirement
|
211
|
-
none: false
|
212
|
-
requirements:
|
213
|
-
- - ! '>='
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '0'
|
216
|
-
type: :runtime
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
none: false
|
220
|
-
requirements:
|
221
|
-
- - ! '>='
|
222
|
-
- !ruby/object:Gem::Version
|
223
|
-
version: '0'
|
224
192
|
- !ruby/object:Gem::Dependency
|
225
193
|
name: thin
|
226
194
|
requirement: !ruby/object:Gem::Requirement
|
@@ -437,7 +405,6 @@ files:
|
|
437
405
|
- lib/flapjack/data/notification_rule.rb
|
438
406
|
- lib/flapjack/data/tag.rb
|
439
407
|
- lib/flapjack/data/tag_set.rb
|
440
|
-
- lib/flapjack/executive.rb
|
441
408
|
- lib/flapjack/filters/acknowledgement.rb
|
442
409
|
- lib/flapjack/filters/base.rb
|
443
410
|
- lib/flapjack/filters/delays.rb
|
@@ -452,7 +419,7 @@ files:
|
|
452
419
|
- lib/flapjack/gateways/api/entity_presenter.rb
|
453
420
|
- lib/flapjack/gateways/api/rack/json_params_parser.rb
|
454
421
|
- lib/flapjack/gateways/email.rb
|
455
|
-
- lib/flapjack/gateways/email/alert.html.
|
422
|
+
- lib/flapjack/gateways/email/alert.html.erb
|
456
423
|
- lib/flapjack/gateways/email/alert.text.erb
|
457
424
|
- lib/flapjack/gateways/jabber.rb
|
458
425
|
- lib/flapjack/gateways/oobetet.rb
|
@@ -466,21 +433,23 @@ files:
|
|
466
433
|
- lib/flapjack/gateways/web/public/img/glyphicons-halflings-white.png
|
467
434
|
- lib/flapjack/gateways/web/public/img/glyphicons-halflings.png
|
468
435
|
- lib/flapjack/gateways/web/public/js/bootstrap.min.js
|
469
|
-
- lib/flapjack/gateways/web/views/_css.
|
470
|
-
- lib/flapjack/gateways/web/views/_foot.
|
471
|
-
- lib/flapjack/gateways/web/views/_head.
|
472
|
-
- lib/flapjack/gateways/web/views/_nav.
|
473
|
-
- lib/flapjack/gateways/web/views/check.
|
474
|
-
- lib/flapjack/gateways/web/views/checks.
|
475
|
-
- lib/flapjack/gateways/web/views/contact.
|
476
|
-
- lib/flapjack/gateways/web/views/contacts.
|
477
|
-
- lib/flapjack/gateways/web/views/entities.
|
478
|
-
- lib/flapjack/gateways/web/views/entity.
|
479
|
-
- lib/flapjack/gateways/web/views/index.
|
480
|
-
- lib/flapjack/gateways/web/views/self_stats.
|
436
|
+
- lib/flapjack/gateways/web/views/_css.html.erb
|
437
|
+
- lib/flapjack/gateways/web/views/_foot.html.erb
|
438
|
+
- lib/flapjack/gateways/web/views/_head.html.erb
|
439
|
+
- lib/flapjack/gateways/web/views/_nav.html.erb
|
440
|
+
- lib/flapjack/gateways/web/views/check.html.erb
|
441
|
+
- lib/flapjack/gateways/web/views/checks.html.erb
|
442
|
+
- lib/flapjack/gateways/web/views/contact.html.erb
|
443
|
+
- lib/flapjack/gateways/web/views/contacts.html.erb
|
444
|
+
- lib/flapjack/gateways/web/views/entities.html.erb
|
445
|
+
- lib/flapjack/gateways/web/views/entity.html.erb
|
446
|
+
- lib/flapjack/gateways/web/views/index.html.erb
|
447
|
+
- lib/flapjack/gateways/web/views/self_stats.html.erb
|
481
448
|
- lib/flapjack/logger.rb
|
449
|
+
- lib/flapjack/notifier.rb
|
482
450
|
- lib/flapjack/patches.rb
|
483
451
|
- lib/flapjack/pikelet.rb
|
452
|
+
- lib/flapjack/processor.rb
|
484
453
|
- lib/flapjack/rack_logger.rb
|
485
454
|
- lib/flapjack/redis_pool.rb
|
486
455
|
- lib/flapjack/utility.rb
|
@@ -495,7 +464,6 @@ files:
|
|
495
464
|
- spec/lib/flapjack/data/notification_rule_spec.rb
|
496
465
|
- spec/lib/flapjack/data/notification_spec.rb
|
497
466
|
- spec/lib/flapjack/data/tag_spec.rb
|
498
|
-
- spec/lib/flapjack/executive_spec.rb
|
499
467
|
- spec/lib/flapjack/filters/acknowledgement_spec.rb
|
500
468
|
- spec/lib/flapjack/filters/delays_spec.rb
|
501
469
|
- spec/lib/flapjack/filters/detect_mass_client_failures_spec.rb
|
@@ -512,16 +480,18 @@ files:
|
|
512
480
|
- spec/lib/flapjack/gateways/oobetet_spec.rb
|
513
481
|
- spec/lib/flapjack/gateways/pagerduty_spec.rb
|
514
482
|
- spec/lib/flapjack/gateways/sms_messagenet.spec.rb
|
515
|
-
- spec/lib/flapjack/gateways/web/views/check.
|
516
|
-
- spec/lib/flapjack/gateways/web/views/contact.
|
517
|
-
- spec/lib/flapjack/gateways/web/views/index.
|
483
|
+
- spec/lib/flapjack/gateways/web/views/check.html.erb_spec.rb
|
484
|
+
- spec/lib/flapjack/gateways/web/views/contact.html.erb_spec.rb
|
485
|
+
- spec/lib/flapjack/gateways/web/views/index.html.erb_spec.rb
|
518
486
|
- spec/lib/flapjack/gateways/web_spec.rb
|
519
487
|
- spec/lib/flapjack/logger_spec.rb
|
488
|
+
- spec/lib/flapjack/notifier_spec.rb
|
520
489
|
- spec/lib/flapjack/pikelet_spec.rb
|
490
|
+
- spec/lib/flapjack/processor_spec.rb
|
521
491
|
- spec/lib/flapjack/redis_pool_spec.rb
|
522
492
|
- spec/lib/flapjack/utility_spec.rb
|
523
493
|
- spec/spec_helper.rb
|
524
|
-
- spec/support/
|
494
|
+
- spec/support/erb_view_helper.rb
|
525
495
|
- spec/support/profile_all_formatter.rb
|
526
496
|
- spec/support/uncolored_doc_formatter.rb
|
527
497
|
- tasks/events.rake
|
@@ -557,7 +527,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
557
527
|
version: '0'
|
558
528
|
segments:
|
559
529
|
- 0
|
560
|
-
hash: -
|
530
|
+
hash: -4516922423453420301
|
561
531
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
562
532
|
none: false
|
563
533
|
requirements:
|
@@ -566,7 +536,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
566
536
|
version: '0'
|
567
537
|
segments:
|
568
538
|
- 0
|
569
|
-
hash: -
|
539
|
+
hash: -4516922423453420301
|
570
540
|
requirements: []
|
571
541
|
rubyforge_project:
|
572
542
|
rubygems_version: 1.8.23
|
@@ -596,7 +566,6 @@ test_files:
|
|
596
566
|
- spec/lib/flapjack/data/notification_rule_spec.rb
|
597
567
|
- spec/lib/flapjack/data/notification_spec.rb
|
598
568
|
- spec/lib/flapjack/data/tag_spec.rb
|
599
|
-
- spec/lib/flapjack/executive_spec.rb
|
600
569
|
- spec/lib/flapjack/filters/acknowledgement_spec.rb
|
601
570
|
- spec/lib/flapjack/filters/delays_spec.rb
|
602
571
|
- spec/lib/flapjack/filters/detect_mass_client_failures_spec.rb
|
@@ -613,15 +582,17 @@ test_files:
|
|
613
582
|
- spec/lib/flapjack/gateways/oobetet_spec.rb
|
614
583
|
- spec/lib/flapjack/gateways/pagerduty_spec.rb
|
615
584
|
- spec/lib/flapjack/gateways/sms_messagenet.spec.rb
|
616
|
-
- spec/lib/flapjack/gateways/web/views/check.
|
617
|
-
- spec/lib/flapjack/gateways/web/views/contact.
|
618
|
-
- spec/lib/flapjack/gateways/web/views/index.
|
585
|
+
- spec/lib/flapjack/gateways/web/views/check.html.erb_spec.rb
|
586
|
+
- spec/lib/flapjack/gateways/web/views/contact.html.erb_spec.rb
|
587
|
+
- spec/lib/flapjack/gateways/web/views/index.html.erb_spec.rb
|
619
588
|
- spec/lib/flapjack/gateways/web_spec.rb
|
620
589
|
- spec/lib/flapjack/logger_spec.rb
|
590
|
+
- spec/lib/flapjack/notifier_spec.rb
|
621
591
|
- spec/lib/flapjack/pikelet_spec.rb
|
592
|
+
- spec/lib/flapjack/processor_spec.rb
|
622
593
|
- spec/lib/flapjack/redis_pool_spec.rb
|
623
594
|
- spec/lib/flapjack/utility_spec.rb
|
624
595
|
- spec/spec_helper.rb
|
625
|
-
- spec/support/
|
596
|
+
- spec/support/erb_view_helper.rb
|
626
597
|
- spec/support/profile_all_formatter.rb
|
627
598
|
- spec/support/uncolored_doc_formatter.rb
|
@@ -1,10 +0,0 @@
|
|
1
|
-
%meta{:name => 'viewport',
|
2
|
-
:content => 'width=device-width, initial-scale=1.0'}
|
3
|
-
%link{:rel => 'stylesheet',
|
4
|
-
:href => '/css/bootstrap.min.css',
|
5
|
-
:media => 'screen'}
|
6
|
-
%link{:rel => 'stylesheet',
|
7
|
-
:href => '/css/flapjack.css',
|
8
|
-
:media => 'screen'}
|
9
|
-
%link{:rel => 'stylesheet',
|
10
|
-
:href => '/css/bootstrap-responsive.min.css'}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
%p
|
2
|
-
%a(title='' href='/') Summary
|
3
|
-
|
|
4
|
-
%a(title='' href='/entities_all') All Entities
|
5
|
-
|
|
6
|
-
%a(title='' href='/entities_failing') Failing Entities
|
7
|
-
|
|
8
|
-
%a(title='' href='/checks_all') All Checks
|
9
|
-
|
|
10
|
-
%a(title='' href='/checks_failing') Failing Checks
|
11
|
-
|
|
12
|
-
%a(title='' href='/contacts') Contacts
|
13
|
-
|
|
14
|
-
%a(title='' href='/self_stats') Internal Statistics
|
@@ -1,191 +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
|
-
- check_path_escaped = URI.escape(@entity, ' #&;/=?') << '/' << URI.escape(@check, ' #&;/=?')
|
6
|
-
- current_time = Time.now
|
7
|
-
%html
|
8
|
-
%head
|
9
|
-
%title Flapjack - Check: #{@entity}:#{@check}
|
10
|
-
= head
|
11
|
-
%body
|
12
|
-
%div#wrap
|
13
|
-
%div{:class => "container"}
|
14
|
-
%div{:class => "page-header"}
|
15
|
-
= nav
|
16
|
-
%h2 #{@check} on #{@entity}
|
17
|
-
%h3 State: #{@check_state ? @check_state.upcase : ''}
|
18
|
-
- if (['warning', 'critical', 'unknown'].include?(@check_state) and !@current_scheduled_maintenance)
|
19
|
-
%form{:action => "/acknowledgements/#{check_path_escaped}", :method => "post", :class => "form-inline"}
|
20
|
-
%input{:type => 'hidden', :name => 'acknowledgement_id', :value => "#{@acknowledgement_id}"}
|
21
|
-
%input{:type => 'submit', :value => @current_unscheduled_maintenance ? 'Replace acknowledgment' : 'Acknowledge', :class => 'button'}
|
22
|
-
with
|
23
|
-
%label{:for => 'summary'}
|
24
|
-
summary:
|
25
|
-
%input{:type => 'text', :name => 'summary', :value => ''}
|
26
|
-
%label{:for => 'duration'}
|
27
|
-
duration:
|
28
|
-
%input{:type => 'text', :name => 'duration', :value => ''}
|
29
|
-
e.g. "5 hours"
|
30
|
-
- if @current_unscheduled_maintenance
|
31
|
-
%h3 (Acknowledged - #{@current_unscheduled_maintenance[:summary]})
|
32
|
-
- start = Time.at(@current_unscheduled_maintenance[:start_time])
|
33
|
-
- finish = Time.at(@current_unscheduled_maintenance[:start_time] + @current_unscheduled_maintenance[:duration])
|
34
|
-
- remain = time_period_in_words( (finish - current_time).ceil )
|
35
|
-
%p #{start} -> #{finish} (#{remain} remaining)
|
36
|
-
%form{:action => "/end_unscheduled_maintenance/#{check_path_escaped}", :method => "post"}
|
37
|
-
%p
|
38
|
-
%input{:type => 'submit', :value => 'End Unscheduled Maintenance (Unacknowledge)', :class => 'button'}
|
39
|
-
- if @current_scheduled_maintenance
|
40
|
-
%h4 (Scheduled Maintenance - #{@current_scheduled_maintenance[:summary]})
|
41
|
-
- start = Time.at(@current_scheduled_maintenance[:start_time])
|
42
|
-
- finish = Time.at(@current_scheduled_maintenance[:start_time] + @current_scheduled_maintenance[:duration])
|
43
|
-
- remain = time_period_in_words( (finish - current_time).ceil )
|
44
|
-
%p #{start} -> #{finish} (#{remain} remaining)
|
45
|
-
%h3 Output: #{@check_summary}
|
46
|
-
%p #{@check_details}
|
47
|
-
%table{:class => "table table-hover table-condensed"}
|
48
|
-
%tr
|
49
|
-
%td Last state change:
|
50
|
-
%td #{relative_time_ago(Time.at(@check_last_change.to_i))} ago
|
51
|
-
%td #{Time.at(@check_last_change.to_i)}
|
52
|
-
%td
|
53
|
-
%tr
|
54
|
-
%td Last update:
|
55
|
-
%td #{relative_time_ago(Time.at(@check_last_update.to_i))} ago
|
56
|
-
%td #{Time.at(@check_last_update.to_i)}
|
57
|
-
%td
|
58
|
-
- last_critical = nil
|
59
|
-
- if @last_notifications[:critical] && @last_notifications[:critical][:timestamp]
|
60
|
-
- t = Time.at(@last_notifications[:critical][:timestamp])
|
61
|
-
- last_critical = {:time => t.to_s, :relative => relative_time_ago(t) + " ago", :summary => @last_notifications[:critical][:summary]}
|
62
|
-
%tr
|
63
|
-
%td Last critical notification:
|
64
|
-
%td= last_critical ? last_critical[:relative] : 'never'
|
65
|
-
%td= last_critical ? last_critical[:time] : ''
|
66
|
-
%td= last_critical ? last_critical[:summary] : ''
|
67
|
-
|
68
|
-
- last_warning = nil
|
69
|
-
- if @last_notifications[:warning] && @last_notifications[:warning][:timestamp]
|
70
|
-
- t = Time.at(@last_notifications[:warning][:timestamp])
|
71
|
-
- last_warning = {:time => t.to_s, :relative => relative_time_ago(t) + " ago", :summary => @last_notifications[:warning][:summary]}
|
72
|
-
%tr
|
73
|
-
%td Last warning notification:
|
74
|
-
%td= last_warning ? last_warning[:relative] : 'never'
|
75
|
-
%td= last_warning ? last_warning[:time] : ''
|
76
|
-
%td= last_warning ? last_warning[:summary] : ''
|
77
|
-
|
78
|
-
- last_unknown = nil
|
79
|
-
- if @last_notifications[:unknown] && @last_notifications[:unknown][:timestamp]
|
80
|
-
- t = Time.at(@last_notifications[:unknown][:timestamp])
|
81
|
-
- last_unknown = {:time => t.to_s, :relative => relative_time_ago(t) + " ago", :summary => @last_notifications[:unknown][:summary]}
|
82
|
-
%tr
|
83
|
-
%td Last unknown notification:
|
84
|
-
%td= last_unknown ? last_unknown[:relative] : 'never'
|
85
|
-
%td= last_unknown ? last_unknown[:time] : ''
|
86
|
-
%td= last_unknown ? last_unknown[:summary] : ''
|
87
|
-
|
88
|
-
- last_recovery = nil
|
89
|
-
- if @last_notifications[:recovery] && @last_notifications[:recovery][:timestamp]
|
90
|
-
- t = Time.at(@last_notifications[:recovery][:timestamp])
|
91
|
-
- last_recovery = {:time => t.to_s, :relative => relative_time_ago(t) + " ago", :summary => @last_notifications[:recovery][:summary]}
|
92
|
-
%tr
|
93
|
-
%td Last recovery notification:
|
94
|
-
%td= last_recovery ? last_recovery[:relative] : 'never'
|
95
|
-
%td= last_recovery ? last_recovery[:time] : ''
|
96
|
-
%td= last_recovery ? last_recovery[:summary] : ''
|
97
|
-
|
98
|
-
- last_ack = nil
|
99
|
-
- if @last_notifications[:acknowledgement] && @last_notifications[:acknowledgement][:timestamp]
|
100
|
-
- t = Time.at(@last_notifications[:acknowledgement][:timestamp])
|
101
|
-
- last_ack = {:time => t.to_s, :relative => relative_time_ago(t) + " ago", :summary => @last_notifications[:acknowledgement][:summary]}
|
102
|
-
%tr
|
103
|
-
%td Last acknowledgement notification:
|
104
|
-
%td= last_ack ? last_ack[:relative] : 'never'
|
105
|
-
%td= last_ack ? last_ack[:time] : ''
|
106
|
-
%td= last_ack ? last_ack[:summary] : ''
|
107
|
-
|
108
|
-
%h3 Scheduled Maintenance Periods
|
109
|
-
- if @scheduled_maintenances && !@scheduled_maintenances.empty?
|
110
|
-
%table{:class => "table table-bordered table-hover table-condensed"}
|
111
|
-
%tr
|
112
|
-
%th Start
|
113
|
-
%th End
|
114
|
-
%th Duration
|
115
|
-
%th Summary
|
116
|
-
%th Actions
|
117
|
-
- @scheduled_maintenances.sort_by {|s| s[:start_time]}.each do |scheduled_maintenance|
|
118
|
-
- start_time = scheduled_maintenance[:start_time]
|
119
|
-
- end_time = scheduled_maintenance[:end_time]
|
120
|
-
- duration = scheduled_maintenance[:duration]
|
121
|
-
- summary = scheduled_maintenance[:summary]
|
122
|
-
%tr
|
123
|
-
%td= Time.at(start_time).to_s
|
124
|
-
%td= Time.at(end_time).to_s
|
125
|
-
%td= ChronicDuration.output(duration)
|
126
|
-
%td= summary
|
127
|
-
%td
|
128
|
-
- if end_time > current_time.to_i
|
129
|
-
- label = (start_time > current_time.to_i) ? 'Delete' : 'End Now'
|
130
|
-
%form{ :action => "/scheduled_maintenances/#{check_path_escaped}", :method => "post"}
|
131
|
-
%input{:type => 'hidden', :name => '_method', :value => 'delete'}
|
132
|
-
%input{:type => 'hidden', :name => 'start_time', :value => start_time}
|
133
|
-
%input{:type => 'submit', :value => label, :class => 'button'}
|
134
|
-
- else
|
135
|
-
%p No maintenance is scheduled
|
136
|
-
%h4 Add Scheduled Maintenance
|
137
|
-
%form{:action => "/scheduled_maintenances/#{check_path_escaped}", :method => "post", :class => "form-horizontal"}
|
138
|
-
%div{:class => "control-group"}
|
139
|
-
%label{:class => "control-label", :for => 'start_time'} Start time:
|
140
|
-
%div{:class => "controls"}
|
141
|
-
%input{:type => 'text', :name => 'start_time', :class => 'text', :size => '20', :maxlength => '80'}
|
142
|
-
e.g. "today 4pm", "two hours hence", "friday 2pm", "2012-01-28 13:00"
|
143
|
-
%div{:class => "control-group"}
|
144
|
-
%label{:class => "control-label", :for => 'duration'} Duration:
|
145
|
-
%div{:class => "controls"}
|
146
|
-
%input{:type => 'text', :name => 'duration', :class => 'text', :size => '20', :maxlength => '80'}
|
147
|
-
e.g. "1 hour", "2:30:00", "three days", etc
|
148
|
-
%div{:class => "control-group"}
|
149
|
-
%label{:class => "control-label", :for => 'summary'} Summary:
|
150
|
-
%div{:class => "controls"}
|
151
|
-
%input{:type => 'text', :name => 'summary', :class => 'text', :size => '80', :maxlength => '160'}
|
152
|
-
%div{:class => "control-group"}
|
153
|
-
%div{:class => "controls"}
|
154
|
-
%input{:type => 'submit', :value => 'Save', :class => 'button'}
|
155
|
-
%p Times given will be interpreted in the local timezone of #{local_timezone}
|
156
|
-
|
157
|
-
- if @state_changes && !@state_changes.empty?
|
158
|
-
%h3 Recent state changes
|
159
|
-
%table{:class => "table table-bordered table-hover table-condensed"}
|
160
|
-
%tr
|
161
|
-
%th Timestamp
|
162
|
-
%th State
|
163
|
-
%th Summary
|
164
|
-
- @state_changes.each do |sc|
|
165
|
-
%tr
|
166
|
-
%td= Time.at(sc[:timestamp]).to_s
|
167
|
-
%td= sc[:state]
|
168
|
-
%td= sc[:summary]
|
169
|
-
|
170
|
-
%h3 Contacts
|
171
|
-
- if @contacts && !@contacts.empty?
|
172
|
-
%table{:class => "table table-bordered table-hover table-condensed"}
|
173
|
-
%tr
|
174
|
-
%th Name
|
175
|
-
%th Media
|
176
|
-
- @contacts.sort_by {|c| [c.first_name, c.last_name] }.each do |contact|
|
177
|
-
%tr
|
178
|
-
%td
|
179
|
-
- link = "/contacts/#{contact.id}"
|
180
|
-
%a(title='contact details' href=link) #{contact.name}
|
181
|
-
%td
|
182
|
-
- if contact.media && !contact.media.empty?
|
183
|
-
%p= contact.media.keys.collect(&:capitalize).join(", ")
|
184
|
-
- else
|
185
|
-
%p No media
|
186
|
-
- else
|
187
|
-
%p No contacts
|
188
|
-
%div#push
|
189
|
-
%div#footer
|
190
|
-
= foot
|
191
|
-
|
@@ -1,49 +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} Checks
|
8
|
-
= head
|
9
|
-
%body
|
10
|
-
%div#wrap
|
11
|
-
%div{:class => "container"}
|
12
|
-
%div{:class => "page-header"}
|
13
|
-
= nav
|
14
|
-
%h2 #{@adjective.capitalize} Checks
|
15
|
-
%p #{@count_failing_checks} failing out of #{@count_all_checks}
|
16
|
-
%table{:class => "table table-bordered table-hover table-condensed"}
|
17
|
-
%tr
|
18
|
-
%th Entity
|
19
|
-
%th Check
|
20
|
-
%th State
|
21
|
-
%th Last State Change
|
22
|
-
%th Last Update
|
23
|
-
%th Last Notification
|
24
|
-
- @states.each do |entity, check, status, changed, updated, in_unscheduled_outage, in_scheduled_outage, notified_kind, notified|
|
25
|
-
- colour_class = status
|
26
|
-
- case status
|
27
|
-
- when 'critical', 'unknown'
|
28
|
-
- colour_class = 'error'
|
29
|
-
- when 'ok', 'up'
|
30
|
-
- colour_class = 'success'
|
31
|
-
%tr{:class => colour_class}
|
32
|
-
%td= entity
|
33
|
-
%td
|
34
|
-
- link = "/check?entity=" + CGI.escape(entity) + "&check=" + CGI.escape(check)
|
35
|
-
%a(title='check detail' href=link) #{check}
|
36
|
-
%td{:class => status}
|
37
|
-
= status.upcase
|
38
|
-
= " (Acknowledged)" if in_unscheduled_outage
|
39
|
-
= " (Scheduled Maintenance)" if in_scheduled_outage
|
40
|
-
%td= relative_time_ago(Time.at(changed.to_i)) + ' ago'
|
41
|
-
%td= relative_time_ago(Time.at(updated.to_i)) + ' ago'
|
42
|
-
- if notified && (notified > 0)
|
43
|
-
- last_notified = relative_time_ago(Time.at(notified.to_i)) + " ago, #{notified_kind}"
|
44
|
-
- else
|
45
|
-
- last_notified = 'never'
|
46
|
-
%td= last_notified
|
47
|
-
%div#push
|
48
|
-
%div#footer
|
49
|
-
= foot
|