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
-
.macaddress ⇒ Object
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.
- .require_db_classes ⇒ Object
Class Method Details
.macaddress ⇒ Object
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
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/simple_host_monitoring.rb', line 47 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 ⇒ Object
66 67 68 69 70 |
# File 'lib/simple_host_monitoring.rb', line 66 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 |