Class: Nosey::Munin::Graph::DSL

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(&block) ⇒ DSL

Returns a new instance of DSL.



129
130
131
132
# File 'lib/nosey/munin.rb', line 129

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



166
167
168
169
# File 'lib/nosey/munin.rb', line 166

def category(category=Category)
  @category = category
  self
end

#data(data) ⇒ Object



155
156
157
158
# File 'lib/nosey/munin.rb', line 155

def data(data)
  @data = data
  self
end

#filter(&block) ⇒ Object



160
161
162
163
# File 'lib/nosey/munin.rb', line 160

def filter(&block)
  @filter = block
  self
end

#graphObject

Configure an instance of a client.



172
173
174
175
176
177
178
179
180
# File 'lib/nosey/munin.rb', line 172

def graph
  Graph.new read_data do |c|
    c.probe_set = @probe_set
    c.category = @category
    c.title = @title
    c.vertical_label = @vertical_label
    c.filter = @filter
  end
end

#probe_set(probe_set) ⇒ Object

Name the probset that we’ll spit out for this graph



140
141
142
143
# File 'lib/nosey/munin.rb', line 140

def probe_set(probe_set)
  @probe_set = probe_set
  self
end

#socket(host = EventMachine::Nosey::SocketServer::Host, port = EventMachine::Nosey::SocketServer::Port) ⇒ Object



134
135
136
137
# File 'lib/nosey/munin.rb', line 134

def socket(host=EventMachine::Nosey::SocketServer::Host,port=EventMachine::Nosey::SocketServer::Port)
  @host, @port = host, port
  self
end

#title(title) ⇒ Object



145
146
147
148
# File 'lib/nosey/munin.rb', line 145

def title(title)
  @title = title
  self
end

#vertical_label(vertical_label) ⇒ Object



150
151
152
153
# File 'lib/nosey/munin.rb', line 150

def vertical_label(vertical_label)
  @vertical_label = vertical_label
  self
end