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.



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

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



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

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

#data(data) ⇒ Object



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

def data(data)
  @data = data
  self
end

#filter(&block) ⇒ Object



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

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

#graphObject

Configure an instance of a client.



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

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



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

def probe_set(probe_set)
  @probe_set = probe_set
  self
end

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



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

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

#title(title) ⇒ Object



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

def title(title)
  @title = title
  self
end

#vertical_label(vertical_label) ⇒ Object



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

def vertical_label(vertical_label)
  @vertical_label = vertical_label
  self
end