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.
- data/.gitignore +10 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +1 -15
- data/Gemfile.lock +44 -42
- data/README.md +123 -49
- data/Rakefile +16 -26
- data/bin/visage-app +17 -4
- data/features/cli.feature +10 -3
- data/features/json.feature +37 -0
- data/features/step_definitions/{visage_steps.rb → cli_steps.rb} +1 -1
- data/features/step_definitions/json_steps.rb +50 -8
- data/features/step_definitions/site_steps.rb +1 -1
- data/features/support/config/default/profiles.yaml +335 -0
- data/features/{data → support}/config/with_no_profiles/.stub +0 -0
- data/features/support/config/with_no_profiles/profiles.yaml +0 -0
- data/features/support/config/with_old_profile_yaml/profiles.yaml +116 -0
- data/features/support/env.rb +2 -3
- data/lib/visage-app.rb +35 -25
- data/lib/visage-app/collectd/json.rb +115 -118
- data/lib/visage-app/collectd/rrds.rb +25 -19
- data/lib/visage-app/helpers.rb +17 -0
- data/lib/visage-app/profile.rb +18 -25
- data/lib/visage-app/public/images/caution.png +0 -0
- data/lib/visage-app/public/images/ok.png +0 -0
- data/lib/visage-app/public/images/questions.png +0 -0
- data/lib/visage-app/public/javascripts/builder.js +607 -0
- data/lib/visage-app/public/javascripts/graph.js +179 -142
- data/lib/visage-app/public/javascripts/message.js +520 -0
- data/lib/visage-app/public/javascripts/mootools-core-1.4.0-full-compat.js +6285 -0
- data/lib/visage-app/public/javascripts/mootools-more-1.4.0.1.js +6399 -0
- data/lib/visage-app/public/stylesheets/message.css +61 -0
- data/lib/visage-app/public/stylesheets/screen.css +149 -38
- data/lib/visage-app/version.rb +5 -0
- data/lib/visage-app/views/builder.haml +38 -49
- data/lib/visage-app/views/builder_form.haml +14 -0
- data/lib/visage-app/views/layout.haml +5 -2
- data/lib/visage-app/views/profile.haml +44 -25
- data/visage-app.gemspec +29 -132
- metadata +93 -150
- data/VERSION +0 -1
- data/features/builder.feature +0 -16
- data/lib/visage-app/collectd/profile.rb +0 -36
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
@@ -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
|
data/Gemfile.lock
CHANGED
@@ -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 (
|
15
|
+
cucumber (1.1.9)
|
6
16
|
builder (>= 2.1.2)
|
7
|
-
diff-lcs (
|
8
|
-
gherkin (~> 2.
|
9
|
-
json (
|
10
|
-
term-ansicolor (
|
11
|
-
diff-lcs (1.1.
|
12
|
-
errand (0.7.
|
13
|
-
gherkin (2.
|
14
|
-
json (
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
27
|
-
|
28
|
-
rspec-
|
29
|
-
rspec-
|
30
|
-
|
31
|
-
rspec-
|
32
|
-
|
33
|
-
|
34
|
-
|
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.
|
38
|
-
rack (~> 1.1)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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 (
|
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
|
-
|
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
|
-
|
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
|
-
|
52
|
+
Follow the above instructions for installing REE, and then run:
|
35
53
|
|
36
|
-
|
54
|
+
``` bash
|
55
|
+
sudo yum install -y librrd-dev ruby rubygems collectd
|
56
|
+
gem install librrd
|
57
|
+
```
|
37
58
|
|
38
|
-
|
59
|
+
Then install the app with:
|
60
|
+
|
61
|
+
``` bash
|
62
|
+
gem install visage-app
|
63
|
+
```
|
64
|
+
|
65
|
+
#### CentOS/RHEL 6+ ####
|
39
66
|
|
40
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
115
|
+
``` bash
|
116
|
+
visage-app genapache
|
117
|
+
<VirtualHost *>
|
118
|
+
ServerName ubuntu.localdomain
|
119
|
+
ServerAdmin root@ubuntu.localdomain
|
73
120
|
|
74
|
-
|
121
|
+
DocumentRoot /home/user/.gem/ruby/1.8/gems/visage-app-0.1.0/lib/visage-app/public
|
75
122
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
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
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
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
|
-
|
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
|
-
|
115
|
-
|
116
|
-
|
167
|
+
```
|
168
|
+
<VirtualHost *:80>
|
169
|
+
ServerName monitoring.example.org
|
170
|
+
ServerAdmin me@example.org
|
117
171
|
|
118
|
-
|
119
|
-
|
172
|
+
SetEnv CONFIG_PATH /var/lib/visage
|
173
|
+
SetEnv RRDDIR /opt/collectd/var/lib/collectd
|
120
174
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
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
|
-
|
128
|
-
|
129
|
-
|
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
|
-
|
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
|
-
|
198
|
+
``` bash
|
199
|
+
git clone git://github.com/auxesis/visage.git
|
200
|
+
```
|
142
201
|
|
143
202
|
Install the development dependencies with:
|
144
203
|
|
145
|
-
|
146
|
-
|
204
|
+
``` bash
|
205
|
+
gem install bundler
|
206
|
+
bundle install
|
207
|
+
```
|
147
208
|
|
148
209
|
Run all cucumber features:
|
149
210
|
|
150
|
-
|
211
|
+
``` bash
|
212
|
+
rake features
|
213
|
+
```
|
151
214
|
|
152
215
|
And run the app with:
|
153
216
|
|
154
|
-
|
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
|
-
|
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
|
-
|
6
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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/", "
|
51
|
+
[ "webrat.log", "pkg/", "_site/"].each do |filename|
|
62
52
|
puts "Removing #{filename}"
|
63
53
|
FileUtils.rm_rf(filename)
|
64
54
|
end
|