collectd-interface 0.1.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/README.md +19 -35
  2. data/bin/collectd-interface-daemon +32 -23
  3. data/bin/collectd-interface-plugins +1 -1
  4. data/public/images/cpus.png +0 -0
  5. data/public/images/disk-traffic-root.png +0 -0
  6. data/public/images/disk-traffic-tmp.png +0 -0
  7. data/public/images/load.png +0 -0
  8. data/public/images/memory.png +0 -0
  9. data/public/images/network-eth0.png +0 -0
  10. data/public/images/network-lo.png +0 -0
  11. data/public/images/processes.png +0 -0
  12. data/views/README.md +19 -35
  13. data/views/graph_header.erb +6 -0
  14. data/views/graphs/cpus.erb +73 -0
  15. data/views/graphs/disk-traffic-root.erb +24 -0
  16. data/views/graphs/disk-traffic-srv.erb.disabled +25 -0
  17. data/views/graphs/disk-traffic-tmp.erb.disabled +24 -0
  18. data/views/graphs/disk-traffic-var.erb.disabled +25 -0
  19. data/views/graphs/gridengine-jobs.erb.disabled +29 -0
  20. data/views/graphs/load.erb +32 -0
  21. data/views/graphs/memory.erb +43 -0
  22. data/views/graphs/network-eth0.erb +23 -0
  23. data/views/graphs/network-lo.erb +23 -0
  24. data/views/graphs/processes.erb +63 -0
  25. data/views/template/navigation.erb +1 -1
  26. data/views/template/options/data.erb +4 -0
  27. metadata +19 -19
  28. data/graphs/cpus.erb +0 -76
  29. data/graphs/disk-traffic-root.erb +0 -30
  30. data/graphs/disk-traffic-srv.erb.disabled +0 -30
  31. data/graphs/disk-traffic-tmp.erb.disabled +0 -30
  32. data/graphs/disk-traffic-var.erb.disabled +0 -30
  33. data/graphs/gridengine-jobs.erb.disabled +0 -32
  34. data/graphs/load.erb +0 -36
  35. data/graphs/memory.erb +0 -47
  36. data/graphs/network-eth0.erb +0 -26
  37. data/graphs/network-lo.erb +0 -26
  38. data/graphs/processes.erb +0 -66
  39. data/views/readme.erb +0 -3
  40. data/views/template/options/readme.erb +0 -0
data/README.md CHANGED
@@ -4,21 +4,27 @@ By Victor Penso
4
4
  Description
5
5
  ===========
6
6
 
7
- _Collectd-Interface_ serves a web user-interface to data stored
8
- by [Collectd](http://collectd.org/). Furthermore it provides REST
9
- access to all data.
7
+ _Collectd-Interface_ provides a web user-interface to data stored
8
+ by Collectd. Furthermore it serves a REST
9
+ interface to all RRD files of Collectd.
10
+
11
+ ![Screenshot of User-Interface](https://github.com/vpenso/collectd-interface/raw/master/public/readme/user-interface.png "Screenshot of the User-Interface")
10
12
 
11
13
  Installation
12
14
  ============
13
15
 
14
- Download and install Collectd following the instructions
16
+ Download and install [Collectd](http://collectd.org/) following the instructions
15
17
  from the developers.
16
18
 
17
19
  On Debian flavored Linux use:
18
20
 
19
21
  apt-get install collectd rrdtool
20
22
 
21
- You will need the [RRDtool](http://oss.oetiker.ch/rrdtool/) too.
23
+ You will need [RRDtool](http://oss.oetiker.ch/rrdtool/) too.
24
+
25
+ Install the Collectd-Interface RubyGem:
26
+
27
+ gem install collectd-interface
22
28
 
23
29
  Usage
24
30
  =====
@@ -31,7 +37,9 @@ Start the Collectd Interface in fore-ground:
31
37
 
32
38
  collectd-interface-daemon
33
39
 
34
- Open the web-interface <a href='localhost:4567'>localhost:4567</a>.
40
+ Open the web-interface at <a href='localhost:4567'>localhost:4567</a>.
41
+ Collectd-Interface expects the RRD file in `/var/lib/collectd/rrd/`
42
+ by default. Overwrite it with the option `-f PATH`.
35
43
 
36
44
  Start the Collectd Interface as daemon:
37
45
 
@@ -41,14 +49,14 @@ Start the Collectd Interface as daemon:
41
49
  Interfaces
42
50
  ==========
43
51
 
44
- Collectd-Interface servers three different kinds of output:
52
+ Collectd-Interface servers three different interfaces:
45
53
 
46
54
  1. `/graph` is the user-interface showing line charts of many
47
55
  of the data accumulated by Collectd.
48
56
  2. `/report` presents tables of system specific information
49
- like disk capacity of a list of network sockets.
57
+ like disk capacity or a list of network sockets.
50
58
  3. `/data` servers an REST API to all data available from
51
- Collectd.
59
+ Collectd RRD files.
52
60
 
53
61
  All content from `/graph`, `/report` and `/data` is accessible
54
62
  by a REST interface, to allow embedding this content into other
@@ -57,13 +65,10 @@ applications.
57
65
  Graph
58
66
  -----
59
67
 
60
- ![Screenshot of User-Interface](https://github.com/vpenso/collectd-interface/raw/master/public/readme/user-interface.png "Screenshot of the User-Interface")
61
-
62
68
  You can select individual graphs using the drop-down menu followed by
63
69
  clicking the "Show" button. In case you just want to have the image, to
64
- embed it into another web-page, use the links beneath the graph.
65
-
66
- Once the graph is generated the caller will be redirected to `/image/`.
70
+ embed it into another web-page, use the links beneath the graph. Once
71
+ the graph is generated the caller will be redirected to `/image/`.
67
72
 
68
73
  **Parameters**
69
74
 
@@ -76,27 +81,6 @@ This simple example:
76
81
 
77
82
  Requests an SVG image with the memory graph for the last week.
78
83
 
79
- **Plugin**
80
-
81
- You can create add a custom graph rendering data from Collectd
82
- by creating a template which is used to generate the <tt>rrdtool graph</tt>.
83
- Take a look to the <tt>graphs/</tt> and <tt>disabled/graphs/</tt> directories
84
- for examples. I recommend you the start the Collectd-Interface in
85
- debug mode (option <tt>-d</tt>) while you develop new graph templates.
86
-
87
- In case you want to enable graphs from <tt>disabled/graphs/</tt> create
88
- a soft link from <tt>graphs/</tt>. The <tt>collectd-interface</tt> daemon will
89
- automatically recognize new templates within <tt>graphs</tt> on start.
90
-
91
- Report
92
- ------
93
-
94
- Reports a basically wrappers around commands like <tt>df -l</tt> or
95
- <tt>ss -ar</tt>. The output is available as HTML in the "Report" section
96
- of the user-interface.
97
-
98
- TODO
99
-
100
84
  Data
101
85
  ----
102
86
 
@@ -137,10 +137,11 @@ class CollectdInterface < Sinatra::Base
137
137
 
138
138
  # Load all graphic plug-ins available
139
139
  graphs = Hash.new
140
- Dir["#{settings.root}/graphs/*.erb"].each do |file|
140
+ Dir["#{settings.root}/views/graphs/*.erb"].each do |file|
141
141
  graphs[File.basename(file,'.erb')] = file
142
142
  end
143
143
  set :plugins, graphs
144
+
144
145
  # List all RRD files available
145
146
  rrd_values = Array.new
146
147
  Dir["#{settings.rrd_path}/**/*.rrd"].each do |file|
@@ -156,7 +157,6 @@ class CollectdInterface < Sinatra::Base
156
157
  reports = Hash.new
157
158
  Dir["#{settings.root}/views/reports/*.erb"].each { |f| reports[File.basename(f,'.erb')] = f }
158
159
  set :reports, reports
159
-
160
160
  end
161
161
 
162
162
  get '/data' do
@@ -254,7 +254,12 @@ class CollectdInterface < Sinatra::Base
254
254
  end
255
255
  end
256
256
 
257
+ ##
258
+ ## Web-Interface to all graphs generated from the Collectd RRD files
259
+ ##
257
260
  get '/graph' do
261
+ # Clients can discover a list of available graphs using the
262
+ # format parameters
258
263
  if params.has_key? 'format'
259
264
  graph_list = settings.plugins.keys.sort.map! { |g| "/graph/#{g}" }
260
265
  if params['format'] == 'json'
@@ -264,17 +269,28 @@ class CollectdInterface < Sinatra::Base
264
269
  content_type :text
265
270
  graph_list.join("\n")
266
271
  end
272
+ # By default the web-interface will be displayed
267
273
  else
268
274
  # default parameters
269
275
  params['last'] = '12h' unless params.has_key?('last')
270
276
  params['image'] = 'png' unless params.has_key?('image')
271
- @display = params.has_key?('display') ? params['display'] : ['all']
272
- # this parameters should not be inherited to /graph/*
277
+ # display only a subset of the graphs by default
278
+ unless params.has_key?('display')
279
+ params['display'] = [ 'cpus', 'memory', 'load', ]
280
+ end
281
+ # pass the list of graphs to display into the template
282
+ @display = params['display']
283
+ # remove it from the parameter list
273
284
  params.delete('display') if params.has_key?('display')
274
- @graphs = settings.plugins
285
+ # all other parameters will be appended for the graph
286
+ # generation.
275
287
  p = Array.new; params.each_pair { |k,v| p << "#{k}=#{v}" }
276
288
  @args = p.join('&')
289
+ # list of all available graphs for the drop down menu
290
+ @graphs = settings.plugins
291
+ # identifier for the template
277
292
  @target = 'graph'
293
+ # render the templates
278
294
  erb :graph, :layout => "template/default".to_sym
279
295
  end
280
296
  end
@@ -283,7 +299,7 @@ class CollectdInterface < Sinatra::Base
283
299
  unless settings.plugins.has_key? path
284
300
  redirect '/'
285
301
  else
286
- color = {
302
+ @color = {
287
303
  :red_light => '#FF000044', :red_dark => '#FF0000AA',
288
304
  :green_light => '#00F00022', :green_dark => '#00F000AA',
289
305
  :yellow_light => '#FFFF0022', :yellow_dark => '#FFFF00AA',
@@ -292,14 +308,14 @@ class CollectdInterface < Sinatra::Base
292
308
  :cyan_light => '#00FFFF22', :cyan_dark => '#00FFFFAA',
293
309
  :purple_light => '#FF00FF22', :purple_dark => '#FF00FFAA'
294
310
  }
295
- type = params.has_key?('image') ? params['image'] : 'png'
296
- last = params.has_key?('last') ? params['last'] : '10800s'
297
- target = %Q[#{settings.public_folder}/images/#{path}.#{type}]
298
- rrd_path = settings.rrd_path
299
- command = ERB.new(File.read(settings.plugins[path])).result(binding)
311
+ @type = params.has_key?('image') ? params['image'] : 'png'
312
+ @last = params.has_key?('last') ? params['last'] : '10800s'
313
+ @target = %Q[#{settings.public_folder}/images/#{path}.#{@type}]
314
+ @rrd_path = settings.rrd_path
315
+ command = erb "graphs/#{path}".to_sym, :layout => :graph_header
300
316
  puts command if $DEBUG
301
317
  system("#{command} > /dev/null 2>&1")
302
- redirect %Q[/images/#{path}.#{type}]
318
+ redirect %Q[/images/#{path}.#{@type}]
303
319
  end
304
320
  end
305
321
 
@@ -317,11 +333,10 @@ class CollectdInterface < Sinatra::Base
317
333
  end
318
334
  # Render a HTML representation of all/a single report(s)
319
335
  else
320
- if params.has_key? 'display' and params['display'] != 'all'
321
- @display = params['display']
322
- else
323
- @display = 'all'
336
+ unless params.has_key? 'display'
337
+ params['display'] = 'disk-free'
324
338
  end
339
+ @display = params['display']
325
340
  @target = 'report'
326
341
  erb :report, :layout => "template/default".to_sym
327
342
  end
@@ -352,13 +367,7 @@ class CollectdInterface < Sinatra::Base
352
367
  redirect '/graph'
353
368
  end
354
369
 
355
- get '/help' do
356
- @target = 'readme'
357
- erb :readme, :layout => "template/default".to_sym
358
- end
359
-
360
- error do
361
- flash[:error] = env['sinatra.error'].to_s
370
+ error 404 do
362
371
  redirect '/'
363
372
  end
364
373
 
@@ -7,7 +7,7 @@ application_root = File.expand_path(File.join(File.dirname(File.expand_path(__FI
7
7
 
8
8
  name = File.basename(__FILE__)
9
9
 
10
- graphs = "#{application_root}/graphs"
10
+ graphs = "#{application_root}/views/graphs"
11
11
  reports = "#{application_root}/views/reports"
12
12
 
13
13
  def list(path)
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/views/README.md CHANGED
@@ -4,21 +4,27 @@ By Victor Penso
4
4
  Description
5
5
  ===========
6
6
 
7
- _Collectd-Interface_ serves a web user-interface to data stored
8
- by [Collectd](http://collectd.org/). Furthermore it provides REST
9
- access to all data.
7
+ _Collectd-Interface_ provides a web user-interface to data stored
8
+ by Collectd. Furthermore it serves a REST
9
+ interface to all RRD files of Collectd.
10
+
11
+ ![Screenshot of User-Interface](https://github.com/vpenso/collectd-interface/raw/master/public/readme/user-interface.png "Screenshot of the User-Interface")
10
12
 
11
13
  Installation
12
14
  ============
13
15
 
14
- Download and install Collectd following the instructions
16
+ Download and install [Collectd](http://collectd.org/) following the instructions
15
17
  from the developers.
16
18
 
17
19
  On Debian flavored Linux use:
18
20
 
19
21
  apt-get install collectd rrdtool
20
22
 
21
- You will need the [RRDtool](http://oss.oetiker.ch/rrdtool/) too.
23
+ You will need [RRDtool](http://oss.oetiker.ch/rrdtool/) too.
24
+
25
+ Install the Collectd-Interface RubyGem:
26
+
27
+ gem install collectd-interface
22
28
 
23
29
  Usage
24
30
  =====
@@ -31,7 +37,9 @@ Start the Collectd Interface in fore-ground:
31
37
 
32
38
  collectd-interface-daemon
33
39
 
34
- Open the web-interface <a href='localhost:4567'>localhost:4567</a>.
40
+ Open the web-interface at <a href='localhost:4567'>localhost:4567</a>.
41
+ Collectd-Interface expects the RRD file in `/var/lib/collectd/rrd/`
42
+ by default. Overwrite it with the option `-f PATH`.
35
43
 
36
44
  Start the Collectd Interface as daemon:
37
45
 
@@ -41,14 +49,14 @@ Start the Collectd Interface as daemon:
41
49
  Interfaces
42
50
  ==========
43
51
 
44
- Collectd-Interface servers three different kinds of output:
52
+ Collectd-Interface servers three different interfaces:
45
53
 
46
54
  1. `/graph` is the user-interface showing line charts of many
47
55
  of the data accumulated by Collectd.
48
56
  2. `/report` presents tables of system specific information
49
- like disk capacity of a list of network sockets.
57
+ like disk capacity or a list of network sockets.
50
58
  3. `/data` servers an REST API to all data available from
51
- Collectd.
59
+ Collectd RRD files.
52
60
 
53
61
  All content from `/graph`, `/report` and `/data` is accessible
54
62
  by a REST interface, to allow embedding this content into other
@@ -57,13 +65,10 @@ applications.
57
65
  Graph
58
66
  -----
59
67
 
60
- ![Screenshot of User-Interface](https://github.com/vpenso/collectd-interface/raw/master/public/readme/user-interface.png "Screenshot of the User-Interface")
61
-
62
68
  You can select individual graphs using the drop-down menu followed by
63
69
  clicking the "Show" button. In case you just want to have the image, to
64
- embed it into another web-page, use the links beneath the graph.
65
-
66
- Once the graph is generated the caller will be redirected to `/image/`.
70
+ embed it into another web-page, use the links beneath the graph. Once
71
+ the graph is generated the caller will be redirected to `/image/`.
67
72
 
68
73
  **Parameters**
69
74
 
@@ -76,27 +81,6 @@ This simple example:
76
81
 
77
82
  Requests an SVG image with the memory graph for the last week.
78
83
 
79
- **Plugin**
80
-
81
- You can create add a custom graph rendering data from Collectd
82
- by creating a template which is used to generate the <tt>rrdtool graph</tt>.
83
- Take a look to the <tt>graphs/</tt> and <tt>disabled/graphs/</tt> directories
84
- for examples. I recommend you the start the Collectd-Interface in
85
- debug mode (option <tt>-d</tt>) while you develop new graph templates.
86
-
87
- In case you want to enable graphs from <tt>disabled/graphs/</tt> create
88
- a soft link from <tt>graphs/</tt>. The <tt>collectd-interface</tt> daemon will
89
- automatically recognize new templates within <tt>graphs</tt> on start.
90
-
91
- Report
92
- ------
93
-
94
- Reports a basically wrappers around commands like <tt>df -l</tt> or
95
- <tt>ss -ar</tt>. The output is available as HTML in the "Report" section
96
- of the user-interface.
97
-
98
- TODO
99
-
100
84
  Data
101
85
  ----
102
86
 
@@ -0,0 +1,6 @@
1
+ rrdtool graph <%= @target %> \
2
+ -a <%= @type.upcase %> \
3
+ --end now --start=end-<%= @last %> \
4
+ --grid-dash 1:1 --width=400 --height=100 \
5
+ --tabwidth=10 --border=0 --color=BACK#FFFFFF \
6
+ <%= yield %>
@@ -0,0 +1,73 @@
1
+ <%
2
+
3
+ lines = String.new
4
+ areas = String.new
5
+ cores = `grep -c processor /proc/cpuinfo`.to_i
6
+ limit = cores*100
7
+
8
+ if cores > 1
9
+ cores = "#{cores} cores"
10
+ else
11
+ cores = "#{cores} core"
12
+ end
13
+
14
+ def define(name,files,function = "AVERAGE")
15
+ defs = String.new
16
+ cdef = "CDEF:#{name}="
17
+ tail = String.new
18
+ cpu = 1
19
+ files.each do |f|
20
+ n = "#{name}_#{cpu}"
21
+ defs << %Q[DEF:#{n}=#{f}:value:#{function} ]
22
+ cdef << "#{n},"
23
+ tail << "+,"
24
+ cpu += 1
25
+ end
26
+ return defs << cdef << tail.chop.chop.chop << ' '
27
+ end
28
+
29
+ definitions = define('sys_av',Dir["#{@rrd_path}cpu*/cpu-system.rrd"] )
30
+ definitions << define('sys_min',Dir["#{@rrd_path}cpu*/cpu-system.rrd"],'MIN' )
31
+ definitions << define('sys_max',Dir["#{@rrd_path}cpu*/cpu-system.rrd"],'MAX' )
32
+ lines << %Q[LINE1:sys_av#{@color[:green_dark]}:'System\t\t\t\t\t' GPRINT:sys_min:MIN:"Min. %4.0lf" GPRINT:sys_av:AVERAGE:"Avg. %4.0lf" GPRINT:sys_max:MAX:"Max. %4.0lf" GPRINT:sys_av:LAST:'Last %4.0lf' ]
33
+
34
+
35
+ definitions << define('user_av',Dir["#{@rrd_path}cpu*/cpu-user.rrd"] )
36
+ definitions << define('user_min',Dir["#{@rrd_path}cpu*/cpu-user.rrd"],'MIN' )
37
+ definitions << define('user_max',Dir["#{@rrd_path}cpu*/cpu-user.rrd"],'MAX' )
38
+ lines << %Q[LINE1:user_av#{@color[:blue_dark]}:'User\t\t\t\t\t\t\t' GPRINT:user_min:MIN:"Min. %4.0lf" GPRINT:user_av:AVERAGE:"Avg. %4.0lf" GPRINT:user_max:MAX:'Max. %4.0lf' GPRINT:user_av:LAST:'Last %4.0lf' ]
39
+
40
+ definitions << define('idle_av',Dir["#{@rrd_path}cpu*/cpu-idle.rrd"] )
41
+ definitions << define('idle_min',Dir["#{@rrd_path}cpu*/cpu-idle.rrd"],'MIN' )
42
+ definitions << define('idle_max',Dir["#{@rrd_path}cpu*/cpu-idle.rrd"],'MAX' )
43
+ areas << %Q[AREA:idle_av#F5F5F588 ]
44
+ lines << %Q[LINE1:idle_av#CCCCCCAA:'Idle\t\t\t\t\t\t\t' GPRINT:idle_min:MIN:"Min. %4.0lf" GPRINT:idle_av:AVERAGE:"Avg. %4.0lf" GPRINT:idle_max:MAX:"Max. %4.0lf" GPRINT:idle_av:LAST:'Last %4.0lf' ]
45
+
46
+ definitions << define('nice_av',Dir["#{@rrd_path}cpu*/cpu-nice.rrd"] )
47
+ definitions << define('nice_min',Dir["#{@rrd_path}cpu*/cpu-nice.rrd"],'MIN' )
48
+ definitions << define('nice_max',Dir["#{@rrd_path}cpu*/cpu-nice.rrd"],'MAX' )
49
+ lines << %Q[LINE1:nice_av#{@color[:yellow_dark]}:'Nice\t\t\t\t\t\t\t' GPRINT:nice_min:MIN:"Min. %4.0lf" GPRINT:nice_av:AVERAGE:"Avg. %4.0lf" GPRINT:nice_max:MAX:"Max. %4.0lf" GPRINT:nice_av:LAST:'Last %4.0lf' ]
50
+
51
+ definitions << define('wait_av',Dir["#{@rrd_path}cpu*/cpu-wait.rrd"] )
52
+ definitions << define('wait_min',Dir["#{@rrd_path}cpu*/cpu-wait.rrd"],'MIN' )
53
+ definitions << define('wait_max',Dir["#{@rrd_path}cpu*/cpu-wait.rrd"],'MAX' )
54
+ lines << %Q[LINE1:wait_av#{@color[:orange_dark]}:'Wait (IO)\t\t\t' GPRINT:wait_min:MIN:"Min. %4.0lf" GPRINT:wait_av:AVERAGE:"Avg. %4.0lf" GPRINT:wait_max:MAX:"Max. %4.0lf" GPRINT:wait_av:LAST:"Last %4.0lf" ]
55
+
56
+ definitions << define('steal_av',Dir["#{@rrd_path}cpu*/cpu-steal.rrd"] )
57
+ definitions << define('steal_min',Dir["#{@rrd_path}cpu*/cpu-steal.rrd"],'MIN' )
58
+ definitions << define('steal_max',Dir["#{@rrd_path}cpu*/cpu-steal.rrd"],'MAX' )
59
+ lines << %Q[LINE1:steal_av#{@color[:red_dark]}:'Steal\t\t\t\t\t\t' GPRINT:steal_min:MIN:"Min. %4.0lf" GPRINT:steal_av:AVERAGE:"Avg. %4.0lf" GPRINT:steal_max:MAX:"Max. %4.0lf" GPRINT:steal_av:LAST:"Last %4.0lf" ]
60
+
61
+
62
+ definitions << define('int_av',Dir["#{@rrd_path}cpu*/cpu-interrupt.rrd"] )
63
+ definitions << define('int_min',Dir["#{@rrd_path}cpu*/cpu-interrupt.rrd"],'MIN' )
64
+ definitions << define('int_max',Dir["#{@rrd_path}cpu*/cpu-interrupt.rrd"],'MAX' )
65
+ lines << %Q[LINE1:int_av#{@color[:cyan_dark]}:'IRQ\t\t\t\t\t\t\t\t' GPRINT:int_min:MIN:"Min. %4.0lf" GPRINT:int_av:AVERAGE:"Avg. %4.0lf" GPRINT:int_max:MAX:"Max. %4.0lf" GPRINT:int_av:LAST:"Last %4.0lf" ]
66
+
67
+ definitions << define('sint_av',Dir["#{@rrd_path}cpu*/cpu-softirq.rrd"] )
68
+ definitions << define('sint_min',Dir["#{@rrd_path}cpu*/cpu-softirq.rrd"],'MIN' )
69
+ definitions << define('sint_max',Dir["#{@rrd_path}cpu*/cpu-softirq.rrd"],'MAX' )
70
+ lines << %Q[LINE1:sint_av#{@color[:purple_dark]}:'IRQ (soft)\t\t\t' GPRINT:sint_min:MIN:"Min. %4.0lf" GPRINT:sint_av:AVERAGE:"Avg. %4.0lf" GPRINT:sint_max:MAX:"Max. %4.0lf" GPRINT:sint_av:LAST:"Last %4.0lf" ]
71
+
72
+
73
+ %> --title="CPU Usage (<%= cores %>)" --vertical-label="Jiffies" --units-exponent=k --lower-limit=0 --legend-position=south --force-rules-legend --slope-mode --upper-limit <%= limit %> <%= definitions %> <%= areas %> <%= lines %>
@@ -0,0 +1,24 @@
1
+ <% name = '/' %>
2
+ <% device = `df -l #{name} | grep '/dev/'`.split[0].split('/')[-1] %>
3
+ --title='Disk Traffic "<%= name %>"' --vertical-label="Bytes" \
4
+ --alt-autoscale-max --base 1024 \
5
+ DEF:read_av=<%= @rrd_path %>disk-<%= device %>/disk_octets.rrd:read:AVERAGE \
6
+ DEF:read_min=<%= @rrd_path %>disk-<%= device %>/disk_octets.rrd:read:MIN \
7
+ DEF:read_max=<%= @rrd_path %>disk-<%= device %>/disk_octets.rrd:read:MAX \
8
+ DEF:write_av=<%= @rrd_path %>disk-<%= device %>/disk_octets.rrd:write:AVERAGE \
9
+ DEF:write_min=<%= @rrd_path %>disk-<%= device %>/disk_octets.rrd:write:MIN \
10
+ DEF:write_max=<%= @rrd_path %>disk-<%= device %>/disk_octets.rrd:write:MAX \
11
+ AREA:read_max<%= @color[:green_light] %> \
12
+ AREA:read_min#ffffff \
13
+ AREA:write_max<%= @color[:blue_light] %> \
14
+ AREA:write_min#ffffff \
15
+ LINE1:read_av<%= @color[:green_dark] %>:"Read\t\t\t" \
16
+ GPRINT:read_min:MIN:"Min. %3.0lf%sB" \
17
+ GPRINT:read_av:AVERAGE:"Avg. %3.0lf%sB" \
18
+ GPRINT:read_max:MAX:"Max. %3.0lf%sB" \
19
+ GPRINT:read_av:LAST:"Last %3.0lf%sB" \
20
+ LINE1:write_av<%= @color[:blue_dark] %>:"Write\t\t" \
21
+ GPRINT:write_min:MIN:"Min. %3.0lf%sB" \
22
+ GPRINT:write_av:AVERAGE:"Avg. %3.0lf%sB" \
23
+ GPRINT:write_max:MAX:"Max. %3.0lf%sB" \
24
+ GPRINT:write_av:LAST:"Last %3.0lf%sB" \