Sha256: b52e4d42d9d7dfbe6006845b9d085e961296f3e18a61b9dd8b6463779e2203e1

Contents?: true

Size: 579 Bytes

Versions: 2

Compression:

Stored size: 579 Bytes

Contents

module Graphiterb
  module Utils

    # 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.
    module SystemInfo

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

      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

      def graphite_identifier
        node_name || hostname
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
graphiterb-0.2.13 lib/graphiterb/utils/system.rb
graphiterb-0.2.12 lib/graphiterb/utils/system.rb