module BlackStack::SimpleHostMonitoring

Constants

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

Public Class Methods

macaddress() click to toggle source

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

# 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_classes() click to toggle source
# 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