collectd-interface 0.2.1 → 0.3.0

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.
data/README.md CHANGED
@@ -73,13 +73,24 @@ the graph is generated the caller will be redirected to `/image/`.
73
73
  **Parameters**
74
74
 
75
75
  It is possible to limit the time-frame of the graph using the option
76
- `last=10h`(us (m)inutes,(d)ays or (w)eeks).
76
+ _start_ and _end_. They are available in the drop-down menu, and can
77
+ be defined using the input fields or by appending them as URL
78
+ parameters.
77
79
 
78
- This simple example:
80
+ Following URLs demonstrate the selection of a specific graph with
81
+ parameters to define a time-frame:
79
82
 
80
- http://.../memory?last=1w&image=svg
83
+ http://.../load?start=end-1d&end=now-2h
84
+ http://.../cpus?start=20120217&end=20120220
85
+ http://.../memory?start=end-48h&end=20120218
86
+ http://.../network-eth0?start=20120217&end=now&image=svg
81
87
 
82
- Requests an SVG image with the memory graph for the last week.
88
+ **Plugins**
89
+
90
+ Each graph is generated from a plugin in `views/graphs/`. This
91
+ directory is scanned when the Collectd-Interface daemon is started,
92
+ and each ERB-template (`*.erb`) is registered. Enable/disable
93
+ certain plugins using the command `collectd-interface-plugins`.
83
94
 
84
95
  Data
85
96
  ----
@@ -271,8 +271,11 @@ class CollectdInterface < Sinatra::Base
271
271
  end
272
272
  # By default the web-interface will be displayed
273
273
  else
274
- # default parameters
275
- params['last'] = '12h' unless params.has_key?('last')
274
+ # by default each graph presents the last 12 hours
275
+ unless params.has_key? 'start' and params.has_key? 'end'
276
+ params['start'] = 'end-12h'
277
+ params['end'] = 'now'
278
+ end
276
279
  params['image'] = 'png' unless params.has_key?('image')
277
280
  # display only a subset of the graphs by default
278
281
  unless params.has_key?('display')
@@ -309,12 +312,19 @@ class CollectdInterface < Sinatra::Base
309
312
  :purple_light => '#FF00FF22', :purple_dark => '#FF00FFAA'
310
313
  }
311
314
  @type = params.has_key?('image') ? params['image'] : 'png'
312
- @last = params.has_key?('last') ? params['last'] : '10800s'
315
+ if params.has_key? 'start' and params.has_key? 'end'
316
+ @start = params['start']
317
+ @end = params['end']
318
+ else
319
+ @start = 'end-24h'
320
+ @end = 'now'
321
+ end
313
322
  @target = %Q[#{settings.public_folder}/images/#{path}.#{@type}]
314
323
  @rrd_path = settings.rrd_path
315
324
  command = erb "graphs/#{path}".to_sym, :layout => :graph_header
316
- puts command if $DEBUG
317
- system("#{command} > /dev/null 2>&1")
325
+ puts command.chomp if $DEBUG
326
+ output = `#{command} > /dev/null 2>&1`
327
+ puts output.chomp if $DEBUG and not output.empty?
318
328
  redirect %Q[/images/#{path}.#{@type}]
319
329
  end
320
330
  end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/views/README.md CHANGED
@@ -73,13 +73,24 @@ the graph is generated the caller will be redirected to `/image/`.
73
73
  **Parameters**
74
74
 
75
75
  It is possible to limit the time-frame of the graph using the option
76
- `last=10h`(us (m)inutes,(d)ays or (w)eeks).
76
+ _start_ and _end_. They are available in the drop-down menu, and can
77
+ be defined using the input fields or by appending them as URL
78
+ parameters.
77
79
 
78
- This simple example:
80
+ Following URLs demonstrate the selection of a specific graph with
81
+ parameters to define a time-frame:
79
82
 
80
- http://.../memory?last=1w&image=svg
83
+ http://.../load?start=end-1d&end=now-2h
84
+ http://.../cpus?start=20120217&end=20120220
85
+ http://.../memory?start=end-48h&end=20120218
86
+ http://.../network-eth0?start=20120217&end=now&image=svg
81
87
 
82
- Requests an SVG image with the memory graph for the last week.
88
+ **Plugins**
89
+
90
+ Each graph is generated from a plugin in `views/graphs/`. This
91
+ directory is scanned when the Collectd-Interface daemon is started,
92
+ and each ERB-template (`*.erb`) is registered. Enable/disable
93
+ certain plugins using the command `collectd-interface-plugins`.
83
94
 
84
95
  Data
85
96
  ----
@@ -1,6 +1,6 @@
1
1
  rrdtool graph <%= @target %> \
2
2
  -a <%= @type.upcase %> \
3
- --end now --start=end-<%= @last %> \
3
+ --end <%= @end %> --start=<%= @start %> \
4
4
  --grid-dash 1:1 --width=400 --height=100 \
5
5
  --tabwidth=10 --border=0 --color=BACK#FFFFFF \
6
6
  <%= yield %>
@@ -1,4 +1,4 @@
1
- --title='Process State' \
1
+ --title='Process State' \
2
2
  --vertical-label='Count' \
3
3
  --lower-limit=0 \
4
4
  DEF:sleep_av=<%= @rrd_path %>/processes/ps_state-sleeping.rrd:value:AVERAGE \
@@ -9,9 +9,11 @@
9
9
  </select>
10
10
  </li>
11
11
  <li>
12
- <div class="label">Values of the last:</div>
13
- <input type="text" name="last" value="12h"/>
14
- <div class="explain">(s)econds (h)ours (d)ays (w)eeks</div>
12
+ <div class="label">Start:</div>
13
+ <input type="text" name="start" value="end-12h"/>
14
+ <div class="label">End:</div>
15
+ <input type="text" name="end" value="now"/>
16
+ <div class="explain">Read Help for more details.</div>
15
17
  </li>
16
18
  <li>
17
19
  <div class="label">Image type for graphs:</div>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: collectd-interface
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-20 00:00:00.000000000 +01:00
12
+ date: 2012-02-22 00:00:00.000000000 +01:00
13
13
  default_executable: collectd-interface-daemon
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sinatra
17
- requirement: &15161540 !ruby/object:Gem::Requirement
17
+ requirement: &9266720 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '1.3'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *15161540
25
+ version_requirements: *9266720
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: maruku
28
- requirement: &15203860 !ruby/object:Gem::Requirement
28
+ requirement: &9266240 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0.6'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *15203860
36
+ version_requirements: *9266240
37
37
  description: ''
38
38
  email: vic.penso@gmail.com
39
39
  executables: