lib/riemann/babbler/plugin.rb in riemann-babbler-0.9.9.9 vs lib/riemann/babbler/plugin.rb in riemann-babbler-1.0.0
- old
+ new
@@ -71,10 +71,14 @@
end
def get_hostname
# разбор fqdn
if options.riemann.use_fqdn.nil? || options.riemann.use_fqdn == false
- hostname = File.read('/proc/sys/kernel/hostname').strip.downcase
+ if File.exist? '/proc/sys/kernel/hostname'
+ hostname = File.read('/proc/sys/kernel/hostname').strip.downcase
+ else
+ hostname = `hostname`
+ end
else
hostname = Socket.gethostbyname(Socket.gethostname).first
end
# разбор инсталяции
if options.riemann.installation.nil?