Class: ForemanGraphite::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/foreman_graphite/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Client

Returns a new instance of Client.



4
5
6
7
8
9
10
11
# File 'lib/foreman_graphite/client.rb', line 4

def initialize(opts = {})
  GraphiteAPI::Logger.logger = opts[:logger] if opts[:logger]

  @client = GraphiteAPI.new(
    :graphite => (opts[:server] || "0.0.0.0:2003"), # required argument
    :prefix   => ['theforeman', fqdn]
  )
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



2
3
4
# File 'lib/foreman_graphite/client.rb', line 2

def client
  @client
end

Instance Method Details

#fqdnObject



13
14
15
# File 'lib/foreman_graphite/client.rb', line 13

def fqdn
  @fqdn ||= (Facter.value(:fqdn) || SETTINGS[:fqdn]).tr(".", "-")
end