sensu-dashboard 0.5.1

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.
Files changed (37) hide show
  1. data/.gitignore +6 -0
  2. data/Gemfile +4 -0
  3. data/MIT-LICENSE.txt +20 -0
  4. data/README.org +4 -0
  5. data/Rakefile +1 -0
  6. data/bin/sensu-dashboard +9 -0
  7. data/lib/sensu-dashboard/app.rb +275 -0
  8. data/lib/sensu-dashboard/public/css/autoSuggest.css +217 -0
  9. data/lib/sensu-dashboard/public/css/style.css +177 -0
  10. data/lib/sensu-dashboard/public/img/footer_bg.png +0 -0
  11. data/lib/sensu-dashboard/public/img/header_bg.png +0 -0
  12. data/lib/sensu-dashboard/public/img/loading_circle.gif +0 -0
  13. data/lib/sensu-dashboard/public/img/main_content_bg.png +0 -0
  14. data/lib/sensu-dashboard/public/img/megaphone_icon.png +0 -0
  15. data/lib/sensu-dashboard/public/img/megaphone_icon_off.png +0 -0
  16. data/lib/sensu-dashboard/public/js/FABridge.js +604 -0
  17. data/lib/sensu-dashboard/public/js/functions.js +198 -0
  18. data/lib/sensu-dashboard/public/js/jquery-1.5.1.min.js +16 -0
  19. data/lib/sensu-dashboard/public/js/jquery.autoSuggest.js +375 -0
  20. data/lib/sensu-dashboard/public/js/jquery.leanModal.min.js +1 -0
  21. data/lib/sensu-dashboard/public/js/jquery.sortElements.js +69 -0
  22. data/lib/sensu-dashboard/public/js/jquery.tmpl.min.js +1 -0
  23. data/lib/sensu-dashboard/public/js/jquery.zclip.min.js +12 -0
  24. data/lib/sensu-dashboard/public/js/modernizr-1.7.min.js +2 -0
  25. data/lib/sensu-dashboard/public/js/swfobject.js +4 -0
  26. data/lib/sensu-dashboard/public/js/web_socket.js +312 -0
  27. data/lib/sensu-dashboard/public/swf/WebSocketMain.swf +0 -0
  28. data/lib/sensu-dashboard/public/swf/ZeroClipboard.swf +0 -0
  29. data/lib/sensu-dashboard/version.rb +5 -0
  30. data/lib/sensu-dashboard/views/client_templates.erb +29 -0
  31. data/lib/sensu-dashboard/views/clients.erb +23 -0
  32. data/lib/sensu-dashboard/views/event_templates.erb +142 -0
  33. data/lib/sensu-dashboard/views/index.erb +41 -0
  34. data/lib/sensu-dashboard/views/layout.erb +120 -0
  35. data/lib/sensu-dashboard/views/sonian.sass +206 -0
  36. data/sensu-dashboard.gemspec +25 -0
  37. metadata +163 -0
@@ -0,0 +1,23 @@
1
+ <h1>Current Clients <span class="clients_count">(<span id="client_count">0</span>)</span></h1>
2
+
3
+ <table id="clients">
4
+
5
+ <thead>
6
+
7
+ <tr>
8
+ <td class="col_clients">Client</td>
9
+ <td class="col_checks">Public IP</td>
10
+ <td class="col_status">Timestamp</td>
11
+ <td class="col_output">Subscriptions</td>
12
+ </tr>
13
+
14
+ </thead>
15
+
16
+ <tbody></tbody>
17
+
18
+ </table>
19
+
20
+ <div id="event_details_modal" class="event_details_modal">
21
+ <h1 class="section_title">Client Data</h1>
22
+ <div id="client_data"></div>
23
+ </div>
@@ -0,0 +1,142 @@
1
+ <!-- Event template -->
2
+ <script id="eventTemplate" type="text/x-jquery-tmpl">
3
+ <tr class="status${status}" id="${client}${check}" rel="leanModal" href="#event_details_modal">
4
+ <td id="client">${client}</td><td id="check">${check}</td><td id="status">${status}</td><td id="output">${output}</td>
5
+ </tr>
6
+ </script>
7
+
8
+ <!-- Event details row template -->
9
+ <script id="eventDetailsRowTemplate" type="text/x-jquery-tmpl">
10
+ <div class="event_detail_group">
11
+ <div class="event_detail">
12
+ <h1>Client</h1>
13
+ <p id="client_id_value">${client}</p>
14
+ </div>
15
+ <!--<div class="copy">Copy</div>-->
16
+ <div style="clear: both;"></div>
17
+ </div>
18
+ <div class="event_detail_group">
19
+ <div class="event_detail">
20
+ <h1>Check</h1>
21
+ <p id="check_name_value">${check}</p>
22
+ </div>
23
+ <!--<div class="copy">Copy</div>-->
24
+ <div style="clear: both;"></div>
25
+ </div>
26
+ <div class="event_detail_group">
27
+ <div class="event_detail">
28
+ <h1>Status</h1>
29
+ <p>${status}</p>
30
+ </div>
31
+ <!--<div class="copy">Copy</div>-->
32
+ <div style="clear: both;"></div>
33
+ </div>
34
+ <div class="event_detail_group">
35
+ <div class="event_detail">
36
+ <h1>Output</h1>
37
+ <p>${output}</p>
38
+ </div>
39
+ <!--<div class="copy">Copy</div>-->
40
+ <div style="clear: both;"></div>
41
+ </div>
42
+ <div class="event_detail_group">
43
+ <div class="event_detail">
44
+ <h1>Occurrences</h1>
45
+ <p>${occurrences}</p>
46
+ </div>
47
+ <!--<div class="copy">Copy</div>-->
48
+ <div style="clear: both;"></div>
49
+ </div>
50
+ </script>
51
+
52
+ <!-- Client details row template -->
53
+ <script id="clientDetailsRowTemplate" type="text/x-jquery-tmpl">
54
+ {{each $data}}
55
+ <div class="event_detail_group">
56
+ <div class="event_detail">
57
+ <h1>${capitaliseFirstLetter($index)}</h1>
58
+ <p>${$value}</p>
59
+ </div>
60
+ <!--<div class="copy">Copy</div>-->
61
+ <div style="clear: both;"></div>
62
+ </div>
63
+ {{/each}}
64
+ </script>
65
+
66
+ <script type="text/javascript">
67
+ fetchEvents();
68
+
69
+ ws = new WebSocket("ws://" + location.hostname + ":9000");
70
+ ws.onmessage = function(evt) {
71
+ fetchEvents();
72
+ }
73
+
74
+ $("#disable_client_events").click(function() {
75
+ var client_id = $("#client_id_value").html();
76
+ var alert_img = $("#disable_client_alerts").children().first();
77
+
78
+ if(alert_img.attr("src") == "/img/megaphone_icon_off.png") {
79
+ alert_img.attr("src", "/img/loading_circle.gif");
80
+ $.ajax({
81
+ type: 'DELETE',
82
+ url: '/stash/silence/'+client_id+'.json',
83
+ success: function(data, textStatus, xhr) {
84
+ alert_img.attr("src", "/img/megaphone_icon.png");
85
+ },
86
+ error: function(xhr, textStatus, errorThrown) {
87
+ if(xhr.status == 404) {
88
+ alert_img.attr("src", "/img/megaphone_icon_off.png");
89
+ }
90
+ },
91
+ dataType: 'json'
92
+ });
93
+ } else if(alert_img.attr("src") == "/img/megaphone_icon.png") {
94
+ alert_img.attr("src", "/img/loading_circle.gif");
95
+ $.ajax({
96
+ type: 'POST',
97
+ url: '/stash/silence/'+client_id+'.json',
98
+ success: function(data, textStatus, xhr) {
99
+ alert_img.attr("src", "/img/megaphone_icon_off.png");
100
+ },
101
+ error: function(xhr, textStatus, errorThrown) {
102
+ },
103
+ dataType: 'json'
104
+ });
105
+ }
106
+ });
107
+
108
+ $("#disable_client_check_alerts").click(function() {
109
+ var client_id = $("#client_id_value").html();
110
+ var check_name = $("#check_name_value").html();
111
+ var alert_img = $("#disable_client_check_alerts").children().first();
112
+
113
+ if(alert_img.attr("src") == "/img/megaphone_icon_off.png") {
114
+ alert_img.attr("src", "/img/loading_circle.gif");
115
+ $.ajax({
116
+ type: 'DELETE',
117
+ url: '/stash/silence/'+client_id+'/'+check_name+'.json',
118
+ success: function(data, textStatus, xhr) {
119
+ alert_img.attr("src", "/img/megaphone_icon.png");
120
+ },
121
+ error: function(xhr, textStatus, errorThrown) {
122
+ if(xhr.status == 404) {
123
+ alert_img.attr("src", "/img/megaphone_icon_off.png");
124
+ }
125
+ },
126
+ dataType: 'json'
127
+ });
128
+ } else if(alert_img.attr("src") == "/img/megaphone_icon.png") {
129
+ alert_img.attr("src", "/img/loading_circle.gif");
130
+ $.ajax({
131
+ type: 'POST',
132
+ url: '/stash/silence/'+client_id+'/'+check_name+'.json',
133
+ success: function(data, textStatus, xhr) {
134
+ alert_img.attr("src", "/img/megaphone_icon_off.png");
135
+ },
136
+ error: function(xhr, textStatus, errorThrown) {
137
+ },
138
+ dataType: 'json'
139
+ });
140
+ }
141
+ });
142
+ </script>
@@ -0,0 +1,41 @@
1
+ <h1>Current Events <span class="events_count">(<span id="event_count">0</span>)</span></h1>
2
+
3
+ <input type="text" id="autosuggest_filter" style="width: 300px;"/>
4
+
5
+ <table id="events">
6
+
7
+ <thead>
8
+
9
+ <tr>
10
+ <td class="col_clients">Client</td>
11
+ <td class="col_checks">Check</td>
12
+ <td class="col_status">Status</td>
13
+ <td class="col_output">Output</td>
14
+ </tr>
15
+
16
+ </thead>
17
+
18
+ <tbody></tbody>
19
+
20
+ </table>
21
+
22
+ <div id="event_details_modal" class="event_details_modal">
23
+ <h1 class="section_title">Actions</h1>
24
+ <div id="event_actions">
25
+ <div class="event_detail_group">
26
+ <div class="event_detail">
27
+ <div id="disable_client_alerts" class="action_btn" style="margin-right: 7px;">
28
+ <img src="/img/loading_circle.gif" style="vertical-align: middle; padding-right: 7px;"/><strong>Client</strong>
29
+ </div>
30
+ <div id="disable_client_check_alerts" class="action_btn" style="margin-right: 7px;">
31
+ <img src="/img/loading_circle.gif" style="vertical-align: middle; padding-right: 7px;"/><strong>Check</strong>
32
+ </div>
33
+ </div>
34
+ <div style="clear: both;"></div>
35
+ </div>
36
+ </div>
37
+ <h1 class="section_title">Event Data</h1>
38
+ <div id="event_data"></div>
39
+ <h1 class="section_title">Client Data</h1>
40
+ <div id="client_data"></div>
41
+ </div>
@@ -0,0 +1,120 @@
1
+ <!doctype html>
2
+
3
+ <!--[if lt IE 7 ]> <html class="ie ie6 no-js" lang="en"> <![endif]-->
4
+ <!--[if IE 7 ]> <html class="ie ie7 no-js" lang="en"> <![endif]-->
5
+ <!--[if IE 8 ]> <html class="ie ie8 no-js" lang="en"> <![endif]-->
6
+ <!--[if IE 9 ]> <html class="ie ie9 no-js" lang="en"> <![endif]-->
7
+ <!--[if gt IE 9]><!--><html class="no-js" lang="en"><!--<![endif]-->
8
+ <!-- the "no-js" class is for Modernizr. -->
9
+
10
+ <head id="www-sitename-com" data-template-set="html5-reset">
11
+
12
+ <meta charset="utf-8">
13
+
14
+ <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
15
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
16
+
17
+ <title>Sensu Dashboard</title>
18
+
19
+ <meta name="author" content="Justin Kolberg">
20
+ <meta name="Copyright" content="Copyright Sonian, Inc. 2011. MIT License.">
21
+
22
+ <!-- Mobile Viewport Fix
23
+ j.mp/mobileviewport & davidbcalhoun.com/2010/viewport-metatag
24
+ device-width : Occupy full width of the screen in its current orientation
25
+ initial-scale = 1.0 retains dimensions instead of zooming out if page height > device height
26
+ maximum-scale = 1.0 retains dimensions instead of zooming in if page width < device width
27
+ -->
28
+ <!-- Uncomment to use; use thoughtfully!
29
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
30
+ -->
31
+
32
+ <!--<link rel="shortcut icon" href="img/favicon.ico">-->
33
+ <!-- This is the traditional favicon.
34
+ - size: 16x16 or 32x32
35
+ - transparency is OK
36
+ - see wikipedia for info on browser support: http://mky.be/favicon/ -->
37
+
38
+ <!--<link rel="apple-touch-icon" href="img/apple-touch-icon.png">-->
39
+ <!-- The is the icon for iOS's Web Clip.
40
+ - size: 57x57 for older iPhones, 72x72 for iPads, 114x114 for iPhone4's retina display (IMHO, just go ahead and use the biggest one)
41
+ - To prevent iOS from applying its styles to the icon name it thusly: apple-touch-icon-precomposed.png
42
+ - Transparency is not recommended (iOS will put a black BG behind the icon) -->
43
+
44
+ <!-- CSS: screen, mobile & print are all in the same file -->
45
+ <link rel="stylesheet" href="css/style.css">
46
+ <link rel="stylesheet" href="css/sonian.css">
47
+ <link rel="stylesheet" href="css/autoSuggest.css">
48
+
49
+ <!-- all our JS is at the bottom of the page, except for Modernizr. -->
50
+ <script src="js/modernizr-1.7.min.js"></script>
51
+
52
+ </head>
53
+
54
+ <body>
55
+
56
+ <div class="wrapper"><!-- not needed? up to you: http://camendesign.com/code/developpeurs_sans_frontieres -->
57
+
58
+ <header>
59
+
60
+ <h1><a href="/">Sensu Dashboard</a></h1>
61
+
62
+ <nav>
63
+
64
+ <ol>
65
+ <li><a href="/clients">Clients</a></li>
66
+ <li><a href="/">Current Events</a></li>
67
+ </ol>
68
+
69
+ </nav>
70
+
71
+ <div style="clear: both;"></div>
72
+
73
+ </header>
74
+
75
+ <section id="main_content">
76
+
77
+ <%= yield %>
78
+
79
+ </section>
80
+
81
+ <footer>
82
+
83
+ <p><small>&copy;
84
+ Copyright <a href="http://www.sonian.com">Sonian, Inc.</a> 2011.
85
+ <a href="https://github.com/sonian/sensu-dashboard/blob/master/MIT-LICENSE.txt">License (MIT)</a>
86
+ </small></p>
87
+
88
+ </footer>
89
+
90
+ </div>
91
+
92
+ <!-- here comes the javascript -->
93
+
94
+ <!-- Grab Google CDN's jQuery. fall back to local if necessary -->
95
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
96
+ <script>window.jQuery || document.write("<script src='js/jquery-1.5.1.min.js'>\x3C/script>")</script>
97
+
98
+ <!-- jQuery templates -->
99
+ <script src="js/jquery.tmpl.min.js"></script>
100
+
101
+ <!-- jQuery lean modal -->
102
+ <script src="js/jquery.leanModal.min.js"></script>
103
+
104
+ <!-- jQuery zclip (clipboard support) -->
105
+ <script type="text/javascript" src="js/jquery.zclip.min.js"></script>
106
+
107
+ <!-- this is where we put our custom functions -->
108
+ <script src="js/functions.js"></script>
109
+
110
+ <!-- jQuery sort elements -->
111
+ <script src="js/jquery.sortElements.js"></script>
112
+
113
+ <!-- jQuery auto suggest -->
114
+ <script src="js/jquery.autoSuggest.js"></script>
115
+
116
+ <!-- include other js -->
117
+ <%= @js %>
118
+
119
+ </body>
120
+ </html>
@@ -0,0 +1,206 @@
1
+ body
2
+ background-color: #c0c0c0
3
+ background-image: url('../img/footer_bg.png')
4
+ z-index: 1
5
+
6
+ header
7
+ background-color: #992222
8
+ background-image: url('../img/header_bg.png')
9
+ padding: 15px 20px
10
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif
11
+ font-weight: 300
12
+ border-bottom: 1px solid #bbb
13
+ h1
14
+ font-family: Helvetica Neue Ultra Light
15
+ font-size: 18px
16
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif
17
+ font-weight: 300
18
+ a
19
+ color: #fafafa
20
+ text-decoration: none
21
+ float: left
22
+ text-shadow: 0 1px 0 #333
23
+ &:hover
24
+ color: #fa9999
25
+ text-shadow: 0 1px 0 #333
26
+ nav
27
+ float: right
28
+ margin-right: 30px
29
+ ol
30
+ list-style: none
31
+ margin: 0
32
+ padding: 0
33
+ li
34
+ margin: 0
35
+ padding: 0 0 0 30px
36
+ font-size: 14px
37
+ font-weight: 300
38
+ float: right
39
+ a
40
+ color: #fafafa
41
+ text-shadow: 0 1px 0 #333
42
+ &:hover
43
+ color: #fa9999
44
+ text-shadow: 0 1px 0 #333
45
+
46
+ section#main_content
47
+ background-color: #eee
48
+ background-image: url('../img/main_content_bg.png')
49
+ padding: 20px
50
+ border-bottom: 1px solid #a0a0a0
51
+ color: #333
52
+ h1
53
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif
54
+ font-weight: 300
55
+ font-size: 16px
56
+ margin-bottom: 20px
57
+ text-shadow: 0 1px 0 white
58
+ /*-webkit-box-shadow: 0 -1px 0 rgba(0,0,0,0.15);
59
+ *-moz-box-shadow: 0 -1px 0 rgba(0,0,0,0.15);
60
+ *box-shadow: 0 -1px 0 rgba(0,0,0,0.15);
61
+ table
62
+ width: 100%
63
+ thead tr
64
+ cursor: pointer
65
+ td
66
+ padding: 7px
67
+ font-weight: 600
68
+ font-size: 14px
69
+ text-shadow: 0 1px 0 white
70
+ &.col_clients
71
+ width: 100px
72
+ &.col_checks
73
+ width: 150px
74
+ &.col_status
75
+ width: 80px
76
+ tbody tr
77
+ background-color: #fff
78
+ cursor: pointer
79
+ &.status2
80
+ background-color: #b55
81
+ color: #fff
82
+ border-bottom: 1px solid #933
83
+ &.status1
84
+ background-color: #fff
85
+ border-bottom: 1px solid #ccc
86
+ &.status3
87
+ background-color: #ffffee
88
+ border-bottom: 1px solid #fffbb5
89
+ &:first-child
90
+ &.status2
91
+ border-top: 1px solid #933
92
+ &.status1
93
+ border-top: 1px solid #ccc
94
+ &.status3
95
+ border-top: 1px solid #fffbb5
96
+ &.status2:hover, &.status1:hover, &.status3:hover
97
+ background-color: #992222
98
+ color: #fff
99
+ border-bottom: 1px solid #880000
100
+ border-top: 1px solid #880000
101
+ td
102
+ padding: 7px
103
+ table#clients
104
+ tbody
105
+ tr:first-child
106
+ border-top: 1px solid #ccc
107
+ tr
108
+ border-bottom: 1px solid #ccc
109
+ tr:hover
110
+ background-color: #992222
111
+ color: #fff
112
+ border-bottom: 1px solid #880000
113
+ border-top: 1px solid #880000
114
+ div.event_details_modal
115
+ background-color: white
116
+ width: 600px
117
+ padding: 30px
118
+ display: none
119
+ border-radius: 5px
120
+ -moz-border-radius: 5px
121
+ -webkit-border-radius: 5px
122
+ box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.7)
123
+ -webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.7)
124
+ -moz-box-shadow: 0 0px 4px rgba(0, 0, 0, 0.7)
125
+ h1.section_title
126
+ margin: 20px 0 10px 0
127
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif
128
+ font-weight: 300
129
+ font-size: 16px
130
+ -moz-user-select: none
131
+ -khtml-user-select: none
132
+ user-select: none
133
+ h1.section_title:first-child
134
+ margin-top: 0
135
+ div
136
+ &.event_detail_group
137
+ background-color: #f0f0f0
138
+ margin-bottom: 10px
139
+ padding: 7px
140
+ border-radius: 5px
141
+ -moz-border-radius: 5px
142
+ -webkit-border-radius: 5px
143
+ overflow: hidden
144
+ &:last-child
145
+ margin-bottom: 0
146
+ div.event_detail
147
+ float: left
148
+ h1
149
+ font-size: 13px
150
+ margin-bottom: 7px
151
+ color: #333
152
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif
153
+ font-weight: bold
154
+ margin-bottom: 4px
155
+ text-shadow: none
156
+ &.action_btn
157
+ float: left
158
+ margin-right: 7px
159
+ padding: 7px
160
+ background-color: #933
161
+ color: white
162
+ border: 1px solid #880000
163
+ border-radius: 5px
164
+ -moz-border-radius: 5px
165
+ -webkit-border-radius: 5px
166
+ cursor: pointer
167
+ -moz-user-select: none
168
+ -khtml-user-select: none
169
+ user-select: none
170
+ &.copy
171
+ float: right
172
+ margin-right: 0
173
+ &:hover
174
+ background-color: #b33
175
+ &:active
176
+ background-color: #733
177
+
178
+ footer
179
+ border-top: 1px solid #ccc
180
+ text-align: center
181
+ padding-top: 7px
182
+ color: #333
183
+ text-shadow: 0 1px 0 #ccc
184
+ a
185
+ color: #333
186
+ &:hover
187
+ color: #992222
188
+
189
+ span.events_count
190
+ color: #992222
191
+
192
+ #lean_overlay
193
+ position: fixed
194
+ z-index: 100
195
+ top: 0px
196
+ left: 0px
197
+ height: 100%
198
+ width: 100%
199
+ background: #000
200
+ display: none
201
+
202
+ a
203
+ color: #992222
204
+ text-decoration: none
205
+ &:hover
206
+ color: #550000