visage-app 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/.gitignore +10 -0
  2. data/CHANGELOG.md +12 -0
  3. data/Gemfile +1 -15
  4. data/Gemfile.lock +44 -42
  5. data/README.md +123 -49
  6. data/Rakefile +16 -26
  7. data/bin/visage-app +17 -4
  8. data/features/cli.feature +10 -3
  9. data/features/json.feature +37 -0
  10. data/features/step_definitions/{visage_steps.rb → cli_steps.rb} +1 -1
  11. data/features/step_definitions/json_steps.rb +50 -8
  12. data/features/step_definitions/site_steps.rb +1 -1
  13. data/features/support/config/default/profiles.yaml +335 -0
  14. data/features/{data → support}/config/with_no_profiles/.stub +0 -0
  15. data/features/support/config/with_no_profiles/profiles.yaml +0 -0
  16. data/features/support/config/with_old_profile_yaml/profiles.yaml +116 -0
  17. data/features/support/env.rb +2 -3
  18. data/lib/visage-app.rb +35 -25
  19. data/lib/visage-app/collectd/json.rb +115 -118
  20. data/lib/visage-app/collectd/rrds.rb +25 -19
  21. data/lib/visage-app/helpers.rb +17 -0
  22. data/lib/visage-app/profile.rb +18 -25
  23. data/lib/visage-app/public/images/caution.png +0 -0
  24. data/lib/visage-app/public/images/ok.png +0 -0
  25. data/lib/visage-app/public/images/questions.png +0 -0
  26. data/lib/visage-app/public/javascripts/builder.js +607 -0
  27. data/lib/visage-app/public/javascripts/graph.js +179 -142
  28. data/lib/visage-app/public/javascripts/message.js +520 -0
  29. data/lib/visage-app/public/javascripts/mootools-core-1.4.0-full-compat.js +6285 -0
  30. data/lib/visage-app/public/javascripts/mootools-more-1.4.0.1.js +6399 -0
  31. data/lib/visage-app/public/stylesheets/message.css +61 -0
  32. data/lib/visage-app/public/stylesheets/screen.css +149 -38
  33. data/lib/visage-app/version.rb +5 -0
  34. data/lib/visage-app/views/builder.haml +38 -49
  35. data/lib/visage-app/views/builder_form.haml +14 -0
  36. data/lib/visage-app/views/layout.haml +5 -2
  37. data/lib/visage-app/views/profile.haml +44 -25
  38. data/visage-app.gemspec +29 -132
  39. metadata +93 -150
  40. data/VERSION +0 -1
  41. data/features/builder.feature +0 -16
  42. data/lib/visage-app/collectd/profile.rb +0 -36
@@ -0,0 +1,10 @@
1
+ .DS_Store
2
+ log/*
3
+ tmp/*
4
+ pkg/*
5
+ *~
6
+ .#*
7
+ webrat*
8
+ lib/visage-app/config/profiles.yaml
9
+ _site
10
+ features/data/config/*/*.yaml
@@ -0,0 +1,12 @@
1
+ 2.0.0
2
+ - New builder interface, optimised for metric discovery + investigatory work
3
+ - Backwards incompatible profile.yaml file format change
4
+ - Chart performance optimisations
5
+ - Visual improvements to chart layout + design
6
+ - Bump versions of dependencies
7
+ - Improve the installation documentation for non-Ubuntu platforms
8
+
9
+ 1.0.0 (e11234a) - Sat Jun 11 07:56:08 2011 +1000
10
+
11
+ - 1.0.0 release! Production ready.
12
+
data/Gemfile CHANGED
@@ -1,18 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  source :rubygems
4
-
5
- gem "haml"
6
- gem "tilt"
7
- gem "sinatra"
8
- gem "errand", "0.7.3"
9
- gem "yajl-ruby"
10
-
11
- group :development do
12
- gem "shotgun"
13
- gem "rack-test"
14
- gem "rspec"
15
- gem "cucumber"
16
- gem "webrat"
17
- gem "jeweler"
18
- end
4
+ gemspec
@@ -1,62 +1,64 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ visage-app (2.0.0)
5
+ errand (= 0.7.3)
6
+ haml (= 3.1.4)
7
+ sinatra (= 1.3.2)
8
+ tilt (= 1.3.3)
9
+ yajl-ruby (= 1.1.0)
10
+
1
11
  GEM
2
12
  remote: http://rubygems.org/
3
13
  specs:
4
14
  builder (3.0.0)
5
- cucumber (0.10.0)
15
+ cucumber (1.1.9)
6
16
  builder (>= 2.1.2)
7
- diff-lcs (~> 1.1.2)
8
- gherkin (~> 2.3.2)
9
- json (~> 1.4.6)
10
- term-ansicolor (~> 1.0.5)
11
- diff-lcs (1.1.2)
12
- errand (0.7.2)
13
- gherkin (2.3.3)
14
- json (~> 1.4.6)
15
- git (1.2.5)
16
- haml (3.0.25)
17
- jeweler (1.5.2)
18
- bundler (~> 1.0.0)
19
- git (>= 1.2.5)
20
- rake
21
- json (1.4.6)
22
- nokogiri (1.4.4)
23
- rack (1.2.1)
24
- rack-test (0.5.7)
17
+ diff-lcs (>= 1.1.2)
18
+ gherkin (~> 2.9.0)
19
+ json (>= 1.4.6)
20
+ term-ansicolor (>= 1.0.6)
21
+ diff-lcs (1.1.3)
22
+ errand (0.7.3)
23
+ gherkin (2.9.1)
24
+ json (>= 1.4.6)
25
+ haml (3.1.4)
26
+ json (1.6.5)
27
+ nokogiri (1.5.2)
28
+ rack (1.4.1)
29
+ rack-protection (1.2.0)
30
+ rack
31
+ rack-test (0.6.1)
25
32
  rack (>= 1.0)
26
- rake (0.8.7)
27
- rspec (2.4.0)
28
- rspec-core (~> 2.4.0)
29
- rspec-expectations (~> 2.4.0)
30
- rspec-mocks (~> 2.4.0)
31
- rspec-core (2.4.0)
32
- rspec-expectations (2.4.0)
33
- diff-lcs (~> 1.1.2)
34
- rspec-mocks (2.4.0)
35
- shotgun (0.8)
33
+ rspec (2.9.0)
34
+ rspec-core (~> 2.9.0)
35
+ rspec-expectations (~> 2.9.0)
36
+ rspec-mocks (~> 2.9.0)
37
+ rspec-core (2.9.0)
38
+ rspec-expectations (2.9.0)
39
+ diff-lcs (~> 1.1.3)
40
+ rspec-mocks (2.9.0)
41
+ shotgun (0.9)
36
42
  rack (>= 1.0)
37
- sinatra (1.1.2)
38
- rack (~> 1.1)
39
- tilt (~> 1.2)
40
- term-ansicolor (1.0.5)
41
- tilt (1.2.2)
42
- webrat (0.7.1)
43
+ sinatra (1.3.2)
44
+ rack (~> 1.3, >= 1.3.6)
45
+ rack-protection (~> 1.2)
46
+ tilt (~> 1.3, >= 1.3.3)
47
+ term-ansicolor (1.0.7)
48
+ tilt (1.3.3)
49
+ webrat (0.7.3)
43
50
  nokogiri (>= 1.2.0)
44
51
  rack (>= 1.0)
45
52
  rack-test (>= 0.5.3)
46
- yajl-ruby (0.7.9)
53
+ yajl-ruby (1.1.0)
47
54
 
48
55
  PLATFORMS
49
56
  ruby
50
57
 
51
58
  DEPENDENCIES
52
59
  cucumber
53
- errand
54
- haml
55
- jeweler
56
60
  rack-test
57
61
  rspec
58
62
  shotgun
59
- sinatra
60
- tilt
63
+ visage-app!
61
64
  webrat
62
- yajl-ruby
data/README.md CHANGED
@@ -16,10 +16,8 @@ Features
16
16
 
17
17
  Here, have a graph:
18
18
 
19
-
20
19
  ![Something I prepared earlier.](http://farm2.static.flickr.com/1020/4730994504_c8c6fc9c18_z.jpg)
21
20
 
22
-
23
21
  Or check out [a live demo](http://visage.unstated.net/nadia/cpu+load).
24
22
 
25
23
  Installing
@@ -27,68 +25,121 @@ Installing
27
25
 
28
26
  N.B: Visage must be deployed on a machine where `collectd` stores its stats in RRD.
29
27
 
28
+ ### Ubuntu ###
29
+
30
30
  On Ubuntu, to install dependencies run:
31
31
 
32
- $ sudo apt-get install -y build-essential librrd-ruby ruby ruby-dev rubygems collectd
32
+ ``` bash
33
+ sudo apt-get install -y build-essential librrd-ruby ruby ruby-dev rubygems collectd
34
+ ```
35
+
36
+ Then install the app with:
37
+
38
+ ``` bash
39
+ gem install visage-app
40
+ ```
41
+
42
+ ### CentOS/RHEL ###
43
+
44
+ #### CentOS/RHEL 5 ####
45
+ Visage uses [yajl-ruby](https://github.com/brianmario/yajl-ruby) to work with
46
+ JSON, which requires Ruby >= 1.8.6. CentOS/RHEL 5 ship with Ruby 1.8.5, so you
47
+ will need to use [Ruby Enterprise Edition](http://www.rubyenterpriseedition.com/).
48
+
49
+ Endpoint provide packages for REE and a [Yum repository](https://packages.endpoint.com/)
50
+ to ease installation.
33
51
 
34
- On CentOS, to install dependencies run:
52
+ Follow the above instructions for installing REE, and then run:
35
53
 
36
- $ sudo yum install -y ruby-RRDtool ruby rubygems collectd
54
+ ``` bash
55
+ sudo yum install -y librrd-dev ruby rubygems collectd
56
+ gem install librrd
57
+ ```
37
58
 
38
- If you are using Ruby Enterprise Edition, instead of installing librrd-ruby or ruby-RRDtool, run
59
+ Then install the app with:
60
+
61
+ ``` bash
62
+ gem install visage-app
63
+ ```
64
+
65
+ #### CentOS/RHEL 6+ ####
39
66
 
40
- $ gem install librrd
67
+ On CentOS 6, to install dependencies run:
68
+
69
+ ``` bash
70
+ sudo yum install -y ruby-RRDtool ruby rubygems collectd
71
+ ```
41
72
 
42
73
  Then install the app with:
43
74
 
44
- $ gem install visage-app
75
+ ``` bash
76
+ gem install visage-app
77
+ ```
78
+
79
+ ### Mac OS X ###
80
+
81
+ Visage is not supported on Mac OS X, as RRDtool is a pain in the arse on that
82
+ platform. It's highly recommended you use [Vagrant](http://vagrantup.com/) to
83
+ fire up an Ubuntu box to run Visage.
84
+
45
85
 
46
86
  Running
47
87
  -------
48
88
 
49
89
  You can try out Visage quickly with:
50
90
 
51
- $ visage-app start
91
+ ``` bash
92
+ visage-app start
93
+ ```
52
94
 
53
95
  Then paste the URL from the output into your browser.
54
96
 
55
97
  If you get a `command not found` when running the above command (RubyGems likely
56
98
  isn't on your PATH), try this instead:
57
99
 
58
- $ $(dirname $(dirname $(gem which visage-app)))/bin/visage-app start
100
+ ``` bash
101
+ $(dirname $(dirname $(gem which visage-app)))/bin/visage-app start
102
+ ```
59
103
 
60
104
  Deploying
61
105
  ---------
62
106
 
63
107
  Visage can be deployed on Apache with Passenger:
64
108
 
65
- $ sudo apt-get install libapache2-mod-passenger
109
+ ``` bash
110
+ sudo apt-get install libapache2-mod-passenger
111
+ ```
66
112
 
67
113
  Visage can attempt to generate an Apache vhost config for use with Passenger:
68
114
 
69
- $ visage-app genapache
70
- <VirtualHost *>
71
- ServerName ubuntu.localdomain
72
- ServerAdmin root@ubuntu.localdomain
115
+ ``` bash
116
+ visage-app genapache
117
+ <VirtualHost *>
118
+ ServerName ubuntu.localdomain
119
+ ServerAdmin root@ubuntu.localdomain
73
120
 
74
- DocumentRoot /home/user/.gem/ruby/1.8/gems/visage-app-0.1.0/lib/visage-app/public
121
+ DocumentRoot /home/user/.gem/ruby/1.8/gems/visage-app-0.1.0/lib/visage-app/public
75
122
 
76
- <Directory "/home/user/.gem/ruby/1.8/gems/visage-app-0.1.0/lib/visage-app/public">
77
- Options FollowSymLinks Indexes
78
- AllowOverride None
79
- Order allow,deny
80
- Allow from all
81
- </Directory>
82
- </VirtualHost>
123
+ <Directory "/home/user/.gem/ruby/1.8/gems/visage-app-0.1.0/lib/visage-app/public">
124
+ Options FollowSymLinks Indexes
125
+ AllowOverride None
126
+ Order allow,deny
127
+ Allow from all
128
+ </Directory>
129
+ </VirtualHost>
130
+ ```
83
131
 
84
132
  Copypasta this into your system's Apache config structure and tune to taste.
85
133
 
86
134
  To do this on Debian/Ubuntu:
87
135
 
88
- $ sudo -s
89
- $ visage-app genapache > /etc/apache2/sites-enabled/visage
90
- $ a2dissite default
91
- $ service apache2 reload
136
+ ``` bash
137
+ sudo -s
138
+ visage-app genapache > /etc/apache2/sites-available/visage
139
+ a2ensite visage
140
+ a2dissite default
141
+ service apache2 reload
142
+ ```
92
143
 
93
144
  Then head to your Apache instance and Visage will be up and running.
94
145
 
@@ -104,58 +155,74 @@ Visage has a configuration search path which can be used for overriding
104
155
  individual files. By default it has one entry: `$VISAGE_ROOT/lib/visage/config/`.
105
156
  You can set the `CONFIG_PATH` environment variable to add another directory to
106
157
  the config load path. This directory will be searched when loading up
107
- configuration files.
158
+ configuration files:
108
159
 
109
- CONFIG_PATH=/var/lib/visage-app start
160
+ ```
161
+ CONFIG_PATH=/var/lib/visage visage-app start
162
+ ```
110
163
 
111
164
  This is especially useful when you want to deploy + run Visage from an installed
112
165
  gem with Passenger. e.g.
113
166
 
114
- <VirtualHost *:80>
115
- ServerName monitoring.example.org
116
- ServerAdmin me@example.org
167
+ ```
168
+ <VirtualHost *:80>
169
+ ServerName monitoring.example.org
170
+ ServerAdmin me@example.org
117
171
 
118
- SetEnv CONFIG_PATH /var/lib/visage
119
- SetEnv RRDDIR /opt/collectd/var/lib/collectd
172
+ SetEnv CONFIG_PATH /var/lib/visage
173
+ SetEnv RRDDIR /opt/collectd/var/lib/collectd
120
174
 
121
- DocumentRoot /var/lib/gems/1.8/gems/visage-app-0.3.0/lib/visage/public
122
- <Directory />
123
- Options FollowSymLinks
124
- AllowOverride None
125
- </Directory>
175
+ DocumentRoot /var/lib/gems/1.8/gems/visage-app-0.3.0/lib/visage/public
176
+ <Directory />
177
+ Options FollowSymLinks
178
+ AllowOverride None
179
+ </Directory>
126
180
 
127
- LogFormat "%h %l %u %t \"%r\" %>s %b" common
128
- CustomLog /var/log/apache2/access.log common
129
- </VirtualHost>
181
+ LogFormat "%h %l %u %t \"%r\" %>s %b" common
182
+ CustomLog /var/log/apache2/access.log common
183
+ </VirtualHost>
184
+ ```
130
185
 
131
186
  Also to keep in mind when deploying with Passenger, the `CONFIG_PATH` directory
132
187
  and its files need to have the correct ownership:
133
188
 
134
- chown nobody:nogroup -R /var/lib/visage
189
+ ``` bash
190
+ chown nobody:nogroup -R /var/lib/visage
191
+ ```
135
192
 
136
193
  Developing + testing
137
194
  --------------------
138
195
 
139
196
  Check out the code with:
140
197
 
141
- $ git clone git://github.com/auxesis/visage.git
198
+ ``` bash
199
+ git clone git://github.com/auxesis/visage.git
200
+ ```
142
201
 
143
202
  Install the development dependencies with:
144
203
 
145
- $ gem install bundler
146
- $ bundle install
204
+ ``` bash
205
+ gem install bundler
206
+ bundle install
207
+ ```
147
208
 
148
209
  Run all cucumber features:
149
210
 
150
- $ rake cucumber
211
+ ``` bash
212
+ rake features
213
+ ```
151
214
 
152
215
  And run the app with:
153
216
 
154
- $ shotgun lib/visage-app/config.ru
217
+ ``` bash
218
+ shotgun lib/visage-app/config.ru
219
+ ```
155
220
 
156
221
  To create and install a new gem from the current source tree:
157
222
 
158
- $ rake install
223
+ ``` bash
224
+ rake install
225
+ ```
159
226
 
160
227
  Licencing
161
228
  ---------
@@ -168,3 +235,10 @@ permission to distribute Highcharts under the GPLv2 as part of Visage.
168
235
  If you ever need an excellent JavaScript charting library, please consider
169
236
  purchasing a [commercial license](http://highcharts.com/license) for
170
237
  Highcharts.
238
+
239
+ TODO
240
+ ----
241
+
242
+ - add natural language support for timeframes (default view: 1 week ago)
243
+ - add sparklines to profile view
244
+ - add checkbox to enable live updates on all graphs
data/Rakefile CHANGED
@@ -1,35 +1,25 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'rubygems'
4
+ require 'bundler/setup'
5
+ require 'cucumber'
6
+ require 'cucumber/rake/task'
4
7
 
5
- begin
6
- require 'cucumber/rake/task'
7
-
8
- Cucumber::Rake::Task.new do |t|
9
- t.binary = "bin/cucumber"
10
- t.cucumber_opts = "--require features/ features/"
11
- end
12
- rescue LoadError
8
+ Cucumber::Rake::Task.new(:features) do |t|
9
+ t.cucumber_opts = "features --format pretty"
13
10
  end
14
11
 
15
- begin
16
- require 'jeweler'
17
- Jeweler::Tasks.new do |gemspec|
18
- gemspec.name = "visage-app"
19
- gemspec.summary = "a web (interface | service) for viewing collectd statistics"
20
- gemspec.description = "Visage is a web interface for viewing collectd statistics. It also provides a JSON interface onto collectd's RRD data, giving you an easy way to mash up the data."
21
- gemspec.email = "lindsay@holmwood.id.au"
22
- gemspec.homepage = "http://visage-app.com/"
23
- gemspec.authors = ["Lindsay Holmwood"]
12
+ desc "build gem"
13
+ task :build do
14
+ build_output = `gem build visage-app.gemspec`
15
+ puts build_output
24
16
 
25
- gemspec.add_dependency "sinatra", "~> 1.1.3"
26
- gemspec.add_dependency "tilt", "~> 1.2.2"
27
- gemspec.add_dependency "haml", "~> 3.0.13"
28
- gemspec.add_dependency "errand", "= 0.7.3"
29
- gemspec.add_dependency "yajl-ruby", "~> 0.8.1"
30
- end
31
- rescue LoadError
32
- puts "Jeweler not available. Install it with: gem install jeweler"
17
+ gem_filename = build_output[/File: (.*)/,1]
18
+ pkg_path = "pkg"
19
+ FileUtils.mkdir_p(pkg_path)
20
+ FileUtils.mv(gem_filename, pkg_path)
21
+
22
+ puts "Gem built in #{pkg_path}/#{gem_filename}"
33
23
  end
34
24
 
35
25
  desc "push gem"
@@ -58,7 +48,7 @@ end
58
48
 
59
49
  desc "clean up various generated files"
60
50
  task :clean do
61
- [ "webrat.log", "pkg/", "visage-app-*.spec", "_site/"].each do |filename|
51
+ [ "webrat.log", "pkg/", "_site/"].each do |filename|
62
52
  puts "Removing #{filename}"
63
53
  FileUtils.rm_rf(filename)
64
54
  end