Class: Nosey::Munin::Graph::DSL
- Inherits:
-
Object
- Object
- Nosey::Munin::Graph::DSL
- Defined in:
- lib/nosey/munin.rb
Overview
A little DSL that lets us set the socket and report name we’ll read
Constant Summary collapse
- ResetCommand =
We use this command to read Nosey data from the socket, but more importantly, reset it so that when we come back around the next time we can grab all the data that’s occured since that time.
"RESET\nQUIT\n"
- Category =
Default munin category. Zie app!
'App'
Instance Method Summary collapse
-
#category(category = Category) ⇒ Object
Category this thing will be in.
- #data(data) ⇒ Object
- #filter(&block) ⇒ Object
-
#graph(configure = false) ⇒ Object
Configure an instance of a client.
-
#initialize(&block) ⇒ DSL
constructor
A new instance of DSL.
- #labels(labels) ⇒ Object
-
#probe_set(probe_set) ⇒ Object
Name the probset that we’ll spit out for this graph.
- #socket(host = EventMachine::Nosey::SocketServer::Host, port = EventMachine::Nosey::SocketServer::Port) ⇒ Object
- #title(title) ⇒ Object
- #vertical_label(vertical_label) ⇒ Object
Constructor Details
#initialize(&block) ⇒ DSL
Returns a new instance of DSL.
132 133 134 135 |
# File 'lib/nosey/munin.rb', line 132 def initialize(&block) block.arity > 1 ? block.call(self) : instance_eval(&block) self end |
Instance Method Details
#category(category = Category) ⇒ Object
Category this thing will be in
174 175 176 177 |
# File 'lib/nosey/munin.rb', line 174 def category(category=Category) @category = category self end |
#data(data) ⇒ Object
163 164 165 166 |
# File 'lib/nosey/munin.rb', line 163 def data(data) @data = data self end |
#filter(&block) ⇒ Object
168 169 170 171 |
# File 'lib/nosey/munin.rb', line 168 def filter(&block) @filter = block self end |
#graph(configure = false) ⇒ Object
Configure an instance of a client.
180 181 182 183 184 185 186 187 188 189 |
# File 'lib/nosey/munin.rb', line 180 def graph(configure=false) Graph.new (configure ? nil : read_data) do |c| c.probe_set = @probe_set c.category = @category c.title = @title c.vertical_label = @vertical_label c.filter = @filter c.labels = @labels end end |
#labels(labels) ⇒ Object
158 159 160 161 |
# File 'lib/nosey/munin.rb', line 158 def labels(labels) @labels = labels self end |
#probe_set(probe_set) ⇒ Object
Name the probset that we’ll spit out for this graph
143 144 145 146 |
# File 'lib/nosey/munin.rb', line 143 def probe_set(probe_set) @probe_set = probe_set self end |
#socket(host = EventMachine::Nosey::SocketServer::Host, port = EventMachine::Nosey::SocketServer::Port) ⇒ Object
137 138 139 140 |
# File 'lib/nosey/munin.rb', line 137 def socket(host=EventMachine::Nosey::SocketServer::Host,port=EventMachine::Nosey::SocketServer::Port) @host, @port = host, port self end |
#title(title) ⇒ Object
148 149 150 151 |
# File 'lib/nosey/munin.rb', line 148 def title(title) @title = title self end |
#vertical_label(vertical_label) ⇒ Object
153 154 155 156 |
# File 'lib/nosey/munin.rb', line 153 def vertical_label(vertical_label) @vertical_label = vertical_label self end |