Module: Graphiterb::Utils::SystemInfo

Included in:
Accumulator, Monitors::PeriodicMonitor
Defined in:
lib/graphiterb/utils/system.rb

Overview

A module which provides information about the node this code is executing on.

Maybe it’s worth bringing Ohai into this. I’m not sure.

Instance Method Summary collapse

Instance Method Details

#graphite_identifierObject



18
19
20
# File 'lib/graphiterb/utils/system.rb', line 18

def graphite_identifier
  node_name || hostname
end

#hostnameObject



10
11
12
# File 'lib/graphiterb/utils/system.rb', line 10

def hostname
  @hostname ||= `hostname`.chomp.gsub(/\./,"_")
end

#node_nameObject



14
15
16
# File 'lib/graphiterb/utils/system.rb', line 14

def node_name
  @node_name ||= Settings[:node_name_file] && File.exist?(Settings[:node_name_file]) && File.read(Settings[:node_name_file]).chomp.strip.gsub(/\./, '_')
end