Module: BlackStack::SimpleHostMonitoring

Defined in:
lib/simple_host_monitoring.rb

Constant Summary collapse

HOST_ID_FILENAME =

get the unique host id from the file ./host_id.data if the file does not exists, it will ask the API for a GUID and create the file

'./host_id.data'

Class Method Summary collapse

Class Method Details

.macaddressObject

This function works in windows only TODO: Esta funcion no retorna la mac address completa TODO: Validar que no se retorne una macaddress virtual, con todos valores en 0



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/simple_host_monitoring.rb', line 28

def self.macaddress()
  return `ifconfig | grep ether`.split[1].upcase.strip.gsub(':', '-') unless BlackStack::RemoteHost.new.windows_os?

  s = `ipconfig /all`

  # The standard (IEEE 802) format for printing MAC-48
  # => addresses in human-friendly form is six groups
  # => of two hexadecimal digits, separated by hyphens
  # => - or colons :
  v = s.scan(/(([A-F0-9]{2}\-){5})([A-F0-9]{2}$)/im)

  if (v.size>0)
    return v.first.join.to_s
  else
    return nil
  end
end

.require_db_classesObject



47
48
49
50
51
# File 'lib/simple_host_monitoring.rb', line 47

def self.require_db_classes()
  # You have to load all the Sinatra classes after connect the database.
  require_relative '../lib/localhost.rb'
  require_relative '../lib/localhosthistory.rb'
end