pencil 0.2.6 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.rb ADDED
@@ -0,0 +1 @@
1
+ PENCIL_VERSION = "0.2.8"
@@ -51,6 +51,10 @@
51
51
  - load_average:
52
52
  - cpu_usage:
53
53
  - network_traffic:
54
+ - mysql_pending_file_io:
55
+ - mysql_history_length:
56
+ - mysql_file_io_threads:
57
+ - mysql_file_io_threads_usage:
54
58
  hosts: ["sync*_db", "wp-db*"]
55
59
  sync_node_alloc:
56
60
  title: sync node allocation
data/examples/graphs.yml CHANGED
@@ -25,7 +25,7 @@
25
25
  title: "syncstorage 401s"
26
26
  targets:
27
27
  syncstorage.request_rate.401:
28
- :key: 401
28
+ :key: 200
29
29
  :color: brown
30
30
  hosts: ["sync*_web", "test*_web", "wp-web*"]
31
31
 
@@ -193,10 +193,10 @@
193
193
  scale: 1024 # M -> G
194
194
  hosts: ["*"]
195
195
  # some random options for demonstration
196
- template: alphas
197
- bgcolor: "#AFFFFF"
198
- vtitle: tvtnolgrf
199
- lineWidth: 20
196
+ # template: alphas
197
+ # bgcolor: "#AFFFFF"
198
+ # vtitle: tvtnolgrf
199
+ # lineWidth: 20
200
200
 
201
201
  sync_node_alloc:
202
202
  title: "node alloc rate"
@@ -221,3 +221,100 @@
221
221
  :color: blue
222
222
 
223
223
  hosts: ["wp-adm01"]
224
+
225
+ mysql_pending_file_io:
226
+ title: "mysql pending file i/o"
227
+ targets:
228
+ stats.timers.mysql.innodb.pending_read.mean:
229
+ :key: read
230
+ :color: green
231
+ stats.timers.mysql.innodb.pending_write.mean:
232
+ :key: write
233
+ :color: blue
234
+ stats.timers.mysql.innodb.pending_ibuf.mean:
235
+ :key: ibuf
236
+ :color: brown
237
+ stats.timers.mysql.innodb.pending_log.mean:
238
+ :key: log
239
+ :color: red
240
+ stats.timers.mysql.innodb.pending_sync.mean:
241
+ :key: sync
242
+ :color: yellow
243
+
244
+ hosts: ["wp-db*", "sync*_db"]
245
+
246
+ mysql_history_length:
247
+ title: "mysql transaction history"
248
+ targets:
249
+ stats.timers.mysql.innodb.history_length.mean:
250
+ :key: read
251
+ :color: green
252
+
253
+ hosts: ["wp-db*", "sync*_db"]
254
+
255
+ mysql_file_io_threads_usage:
256
+ title: "mysql file i/o threads active (% used)"
257
+ targets:
258
+ ? - stats.timers.mysql.innodb.threads_active_read.mean:
259
+ - stats.timers.mysql.innodb.threads_total_read.mean:
260
+ :
261
+ !omap
262
+ - :divideSeries:
263
+ - :color: green
264
+ - :asPercent: 1.0
265
+ - :movingAverage: 10
266
+ - :key: read
267
+ ? - stats.timers.mysql.innodb.threads_active_write.mean:
268
+ - stats.timers.mysql.innodb.threads_total_write.mean:
269
+ :
270
+ !omap
271
+ - :divideSeries:
272
+ - :color: blue
273
+ - :asPercent: 1.0
274
+ - :movingAverage: 10
275
+ - :key: write
276
+ ? - stats.timers.mysql.innodb.threads_active_ibuf.mean:
277
+ - stats.timers.mysql.innodb.threads_total_ibuf.mean:
278
+ :
279
+ !omap
280
+ - :divideSeries:
281
+ - :color: brown
282
+ - :asPercent: 1.0
283
+ - :movingAverage: 10
284
+ - :key: ibuf
285
+ ? - stats.timers.mysql.innodb.threads_active_log.mean:
286
+ - stats.timers.mysql.innodb.threads_total_log.mean:
287
+ :
288
+ !omap
289
+ - :divideSeries:
290
+ - :color: red
291
+ - :asPercent: 1.0
292
+ - :movingAverage: 10
293
+ - :key: log
294
+ hosts: ["wp-db*", "sync*_db"]
295
+
296
+ mysql_file_io_threads:
297
+ title: "mysql file i/o threads"
298
+ targets:
299
+ stats.timers.mysql.innodb.threads_active_read.mean:
300
+ !omap
301
+ - :color: green
302
+ - :movingAverage: 10
303
+ - :key: read
304
+ stats.timers.mysql.innodb.threads_active_write.mean:
305
+ !omap
306
+ - :color: blue
307
+ - :movingAverage: 10
308
+ - :key: write
309
+ stats.timers.mysql.innodb.threads_active_ibuf.mean:
310
+ !omap
311
+ - :color: brown
312
+ - :movingAverage: 10
313
+ - :key: ibuf
314
+ stats.timers.mysql.innodb.threads_active_log.mean:
315
+ !omap
316
+ - :color: red
317
+ - :movingAverage: 10
318
+ - :key: log
319
+
320
+ hosts: ["wp-db*", "sync*_db"]
data/examples/pencil.yml CHANGED
@@ -13,7 +13,7 @@
13
13
  :margin: 5
14
14
  :thickness: 2
15
15
 
16
- :refresh_rate: 60
16
+ :refresh_rate: false
17
17
  :host_sort: "sensible"
18
18
  :quantum: 30 # map requests to 30 second intervals
19
19
  :date_format: "%X %x" # strftime
data/lib/dash.rb CHANGED
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
-
3
1
  require "rubygems"
4
2
  require "namespace"
5
3
 
@@ -17,9 +15,6 @@ require "chronic_duration"
17
15
  require "optparse"
18
16
  require "rubyfixes"
19
17
 
20
- # fixme style.css isn't actually cached, you need to set something up with
21
- # rack to cache static files
22
-
23
18
  $:.unshift(File.dirname(__FILE__))
24
19
 
25
20
  module Dash
@@ -129,8 +124,8 @@ module Dash
129
124
  end
130
125
 
131
126
  get '/host/:cluster/:host/?' do
132
- @host = Host.new(params[:host], { "cluster" => params[:cluster] })
133
- @cluster = params[:cluster]
127
+ @host = Host.find_by_name_and_cluster(params[:host], params[:cluster])
128
+ @cluster = @host.cluster
134
129
  raise "Unknown host: #{params[:host]} in #{params[:cluster]}" unless @host
135
130
 
136
131
  @title = "#{@host.cluster} :: host :: #{@host.name}"
data/lib/helpers.rb CHANGED
@@ -114,15 +114,15 @@ module Dash::Helpers
114
114
  end
115
115
  end
116
116
 
117
- def hosts_selector(hosts)
117
+ def hosts_selector(hosts, print_clusters=false)
118
+ @print_clusters = print_clusters
118
119
  @hosts = hosts
119
120
  erb :'partials/hosts_selector', :layout => false
120
121
  end
121
122
 
122
123
  def append_query_string(str)
123
124
  v = str.dup
124
- query = request.query_string.chomp("&permalink=1")
125
- (v << "?#{query}") unless request.query_string.empty?
125
+ (v << "?#{request.query_string}") unless request.query_string.empty?
126
126
  return v
127
127
  end
128
128
 
data/lib/models/graph.rb CHANGED
@@ -307,11 +307,11 @@ module Dash::Models
307
307
  return metrics.flatten.map { |x| x.split(".") }
308
308
  end
309
309
 
310
- # FIXMEEEE needs to be fixed for different metric formats
311
310
  def hosts_clusters
312
311
  metrics = expand
313
312
  clusters = Set.new
314
313
 
314
+ # find the indicies of the clusters and hosts
315
315
  f = @params[:metric_format].dup.split("%m")
316
316
  first = f.first.split(".")
317
317
  last = f.last.split(".")
@@ -327,7 +327,7 @@ module Dash::Models
327
327
  end
328
328
  end
329
329
  hosts = metrics.map do |m|
330
- Host.new(m[hi], @params.merge({ "cluster" => m[ci] }))
330
+ Host.new(m[hi], m[ci], @params)
331
331
  end.uniq
332
332
 
333
333
  # filter by what matches the graph definition
data/lib/models/host.rb CHANGED
@@ -4,9 +4,14 @@ require "models/graph"
4
4
  module Dash::Models
5
5
  class Host < Base
6
6
  attr_accessor :graphs
7
+ attr_reader :cluster
7
8
 
8
- def initialize(name, params={})
9
- super
9
+ def initialize(name, cluster, params={})
10
+ super(name, params)
11
+ @cluster = cluster
12
+ # hack for the case where colo{1,2}.host1 both exist
13
+ @@objects[self.class.to_s].delete(name)
14
+ @@objects[self.class.to_s]["#{cluster}#{name}"] = self
10
15
 
11
16
  @graphs = []
12
17
  Graph.each do |graph_name, graph|
@@ -19,8 +24,8 @@ module Dash::Models
19
24
  end # Graph.each
20
25
  end
21
26
 
22
- def cluster
23
- return @params["cluster"]
27
+ def self.find(name)
28
+ return @@objects[self.name][key] rescue []
24
29
  end
25
30
 
26
31
  def key
@@ -64,7 +69,7 @@ module Dash::Models
64
69
 
65
70
  def self.find_by_name_and_cluster(name, cluster)
66
71
  Host.each do |host_name, host|
67
- next unless host_name = name
72
+ next unless host.name == name
68
73
  return host if host.cluster == cluster
69
74
  end
70
75
  return nil
@@ -5,7 +5,6 @@
5
5
  <%= graph_uplink %>
6
6
  <br>
7
7
  <br>
8
- <a href="#by_host">by_host</a>
9
8
  <%= hosts.collect { |h| "<a href=\"##{h}\">#{h}</a>" }.join(" ") %>
10
9
 
11
10
  <div class="graphsection" style="width:<%= @zoom.width(merge_opts) %>;">
data/lib/views/global.erb CHANGED
@@ -1,7 +1,5 @@
1
1
  <h2>List of dashboards for <%= cluster_selector %></h2>
2
2
 
3
- I feel like some graphs should go here
4
-
5
3
  <% hosts = Host.all
6
4
  boards = @dashboards
7
5
  seen_hosts = Set.new %>
@@ -10,7 +8,7 @@ I feel like some graphs should go here
10
8
  <h2><a href="/dash/<%= "#{@cluster}/#{append_query_string(b.name)}" %>"><%= b.name %></a>
11
9
  <% dash_hosts = b.get_all_hosts()[0]
12
10
  seen_hosts += dash_hosts %>
13
- <%= hosts_selector(dash_hosts) %>
11
+ <%= hosts_selector(dash_hosts, true) %>
14
12
  </h2>
15
13
  <%= b.graphs.collect do |g|
16
14
  href = append_query_string("/dash/#{@cluster}/#{b.name}/#{g}")
data/lib/views/layout.erb CHANGED
@@ -17,16 +17,20 @@
17
17
  <div id="nav">
18
18
  <% if @cluster %>
19
19
  <ul>
20
+ <!-- fixme change this to the cluster overview link when there's only one cluster-->
20
21
  Global Views:
21
22
  <li><a href="<%= cluster_link("global") %>">overview</a></li>
22
23
  <br>
24
+ <% clusters = settings.config.clusters %>
25
+ <% if clusters.size > 1 %>
23
26
  Cluster Views:
24
27
  <br>
25
- <% clusters = settings.config.clusters %>
28
+
26
29
  <% clusters.sort.each do |cluster| %>
27
30
  <li><a href="<%= cluster_link(cluster) %>"><%= cluster %></a></li>
28
31
  <% end %>
29
32
  <br>
33
+ <% end %>
30
34
  Dashboards: (<%= @cluster %>)
31
35
  <br>
32
36
  <% @dashboards.sort.each do |dash| %>
@@ -35,7 +39,7 @@
35
39
  <br>
36
40
  Jump to Host:
37
41
  <br>
38
- <%= hosts_selector(Host.all) %>
42
+ <%= hosts_selector(* @cluster == "global" ? [Host.all, true] : [Host.find_by_cluster(@cluster), false]) %>
39
43
  <br>
40
44
  <br>
41
45
  <%= input_boxes %>
@@ -52,6 +56,6 @@
52
56
 
53
57
  </body>
54
58
  <div id="footer" style="color:green;">
55
- generated <%= @request_time %> by <a href="https://github.com/petef/pencil">pencil</a> v<%= PENCIL_VERSION %>
59
+ generated <%= @request_time %> by <a href="https://github.com/fetep/pencil">pencil</a> v<%= PENCIL_VERSION %>
56
60
  </div>
57
61
  </html>
@@ -1,7 +1,9 @@
1
1
  <select onchange="window.open(this.options[this.selectedIndex].value,'_top')">
2
2
  <option value="">-select host-</option>
3
3
  <% @hosts.sort.each do |h|
4
+ option = "#{h.name}"
5
+ option << " [#{h.cluster}] " if @print_clusters
4
6
  value = append_query_string("/host/#{h.cluster}/#{h}") %>
5
- <option value="<%= value %>" <%= "selected=\"selected\"" if @host == h %>><%= h %></option>
7
+ <option value="<%= value %>" <%= "selected=\"selected\"" if @host == h %>><%= option %></option>
6
8
  <% end %>
7
9
  </select>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pencil
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
4
+ hash: 7
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 6
10
- version: 0.2.6
9
+ - 8
10
+ version: 0.2.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pete Fritchman
@@ -16,8 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-08-02 00:00:00 -07:00
20
- default_executable:
19
+ date: 2011-08-16 00:00:00 Z
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
23
22
  name: mongrel
@@ -114,41 +113,41 @@ extensions: []
114
113
  extra_rdoc_files: []
115
114
 
116
115
  files:
117
- - lib/dash.rb
116
+ - VERSION.rb
118
117
  - lib/models.rb
118
+ - lib/config.ru
119
119
  - lib/helpers.rb
120
- - lib/namespace.rb
120
+ - lib/dash.rb
121
121
  - lib/config.rb
122
- - lib/views/dash-cluster.erb
123
- - lib/views/cluster.erb
124
- - lib/views/layout.erb
125
- - lib/views/host.erb
122
+ - lib/models/dashboard.rb
123
+ - lib/models/graph.rb
124
+ - lib/models/base.rb
125
+ - lib/models/host.rb
126
126
  - lib/views/dash-global.erb
127
- - lib/views/dash-global-zoom.erb
127
+ - lib/views/host.erb
128
+ - lib/views/dash-cluster-zoom.erb
128
129
  - lib/views/global.erb
129
- - lib/views/partials/input_boxes.erb
130
+ - lib/views/layout.erb
131
+ - lib/views/dash-global-zoom.erb
130
132
  - lib/views/partials/graph_switcher.erb
131
- - lib/views/partials/cluster_selector.erb
132
- - lib/views/partials/dash_switcher.erb
133
133
  - lib/views/partials/hosts_selector.erb
134
+ - lib/views/partials/cluster_switcher.erb
134
135
  - lib/views/partials/refresh_button.erb
135
136
  - lib/views/partials/cookies_form.erb
136
- - lib/views/partials/cluster_switcher.erb
137
- - lib/views/dash-cluster-zoom.erb
138
- - lib/rubyfixes.rb
139
- - lib/public/favicon.ico
137
+ - lib/views/partials/dash_switcher.erb
138
+ - lib/views/partials/input_boxes.erb
139
+ - lib/views/partials/cluster_selector.erb
140
+ - lib/views/cluster.erb
141
+ - lib/views/dash-cluster.erb
140
142
  - lib/public/style.css
141
- - lib/models/graph.rb
142
- - lib/models/dashboard.rb
143
- - lib/models/base.rb
144
- - lib/models/host.rb
145
- - lib/config.ru
143
+ - lib/public/favicon.ico
144
+ - lib/rubyfixes.rb
145
+ - lib/namespace.rb
146
146
  - docs/pencil_options.md
147
+ - examples/dashboards.yml
147
148
  - examples/pencil.yml
148
149
  - examples/graphs.yml
149
- - examples/dashboards.yml
150
150
  - bin/pencil
151
- has_rdoc: true
152
151
  homepage: https://github.com/fetep/pencil
153
152
  licenses:
154
153
  - Mozilla Public License (1.1)
@@ -178,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
177
  requirements: []
179
178
 
180
179
  rubyforge_project:
181
- rubygems_version: 1.3.7
180
+ rubygems_version: 1.7.2
182
181
  signing_key:
183
182
  specification_version: 3
184
183
  summary: pencil -- Graphite dashboard system