Permalink
Browse files

make setting up config/profiles.yaml just that little bit more sane. …

…"Naming" each profile now becomes more intuitive, and the old name: is now only used as a splatpart:. Hopefully more intuitive/sane!!!
  • Loading branch information...
1 parent f4bc577 commit b1ad940c02a63b6571107295d9d39e6b0553f302 @jf committed Sep 30, 2009
Showing with 23 additions and 21 deletions.
  1. +17 −17 config/profiles.yaml
  2. +5 −3 lib/collectd-profile.rb
  3. +1 −1 views/index.haml
View
@@ -1,34 +1,34 @@
----
-profiles:
- cpu+load:
- plugins:
+---
+profiles:
+ CPU + Load:
+ plugins:
- cpu-0
- cpu-1
- load/load
- battery-0
- name: CPU + Load
+ splatpart: cpu+load
order: 1
- memory:
- plugins:
+ Memory:
+ plugins:
- memory
- swap
- name: Memory
+ splatpart: mem
order: 2
- disk+usage:
- plugins:
+ Disk Usage:
+ plugins:
- df/df-root
- disk-sda
- name: Disk Usage
+ splatpart: du
order: 3
- network:
- plugins:
+ Networking:
+ plugins:
- tcpconns-9393-local
- tcpconns-80-local
- name: Networking
+ splatpart: network
order: 4
- processes:
- plugins:
+ Processes:
+ plugins:
- processes
- processes-collectd
- name: Processes
+ splatpart: processes
order: 5
View
@@ -14,16 +14,18 @@ class << self
attr_accessor :profiles
def get(id)
- id.gsub!(/\s+/, '+')
- OpenStruct.new(@profiles[id])
+ if found = @profiles.find {|p| p[1]["splatpart"] == id }
+ found = found[1]
+ end
+ OpenStruct.new(found)
end
def all
# here be ugliness
profiles = @profiles.to_a.sort_by { |profile|
profile[1]["order"]
}.map { |profile|
- OpenStruct.new(profile[1].merge({'url' => profile[0]}))
+ OpenStruct.new(profile[1].merge({'name' => profile[0]}))
}
end
View
@@ -13,7 +13,7 @@
%ul
- @profiles.each do |profile|
%li
- %a{:href => "/#{host}/#{profile.url}"}= profile.name
+ %a{:href => "/#{host}/#{profile.splatpart}"}= profile.name
%div#graphs
- if @profile && @profile.plugins

0 comments on commit b1ad940

Please sign in to comment.