lib/riemann/babbler/plugin.rb in riemann-babbler-0.3.6 vs lib/riemann/babbler/plugin.rb in riemann-babbler-0.3.7

- old
+ new

@@ -16,10 +16,11 @@ require 'open3' require 'timeout' require 'rest_client' attr_reader :logger + attr_reader :hostname def initialize( configatron, logger ) @configatron = configatron @logger = logger @storage = Hash.new @@ -48,9 +49,13 @@ event.delete(:as_diff) report(event) end def host + @hostname ||= get_hostname + end + + def get_hostname hostname = File.read('/proc/sys/kernel/hostname').strip.downcase hostname += options.riemann.suffix unless options.riemann.suffix.nil? hostname = options.riemann.prefix + hostname unless options.riemann.prefix.nil? hostname end