Module: Boris::Structure
- Includes:
- Lumberjack
- Included in:
- ProfilerCore
- Defined in:
- lib/boris/structure.rb,
lib/boris/helpers/scrubber.rb
Constant Summary collapse
- CATEGORIES =
%w{ file_systems hardware hosted_shares installed_applications installed_patches installed_services local_user_groups network_id network_interfaces operating_system running_processes }
Instance Attribute Summary
Attributes included from Lumberjack
Instance Method Summary collapse
- #file_system_template ⇒ Object
- #get_file_systems ⇒ Object
- #get_hardware ⇒ Object
- #get_hosted_shares ⇒ Object
- #get_installed_applications ⇒ Object
- #get_installed_patches ⇒ Object
- #get_installed_services ⇒ Object (also: #get_installed_daemons)
- #get_local_user_groups ⇒ Object
- #get_network_id ⇒ Object
- #get_network_interfaces ⇒ Object
- #get_operating_system ⇒ Object
- #get_running_processes ⇒ Object
- #hosted_share_template ⇒ Object
- #installed_application_template ⇒ Object
- #installed_patch_template ⇒ Object
- #installed_service_template ⇒ Object
- #local_user_groups_template ⇒ Object
- #network_interface_template ⇒ Object
- #running_process_template ⇒ Object
- #scrub_data! ⇒ Object
Methods included from Lumberjack
#debug, #error, #fatal, #info, #warn
Instance Method Details
#file_system_template ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/boris/structure.rb', line 23 def file_system_template [ :capacity_mb, :file_system, :mount_point, :san_storage, :used_space_mb ].to_nil_hash end |
#get_file_systems ⇒ Object
107 108 109 110 |
# File 'lib/boris/structure.rb', line 107 def get_file_systems debug 'preparing to fetch file systems' @file_systems = [] end |
#get_hardware ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/boris/structure.rb', line 112 def get_hardware debug 'preparing to fetch hardware' @hardware = [ :cpu_architecture, :cpu_core_count, :cpu_model, :cpu_physical_count, :cpu_speed_mhz, :cpu_vendor, :firmware_version, :model, :memory_installed_mb, :serial, :vendor ].to_nil_hash end |
#get_hosted_shares ⇒ Object
129 130 131 132 |
# File 'lib/boris/structure.rb', line 129 def get_hosted_shares debug 'preparing to fetch hosted shares' @hosted_shares = [] end |
#get_installed_applications ⇒ Object
134 135 136 137 |
# File 'lib/boris/structure.rb', line 134 def get_installed_applications debug 'preparing to fetch installed applications' @installed_applications = [] end |
#get_installed_patches ⇒ Object
139 140 141 142 |
# File 'lib/boris/structure.rb', line 139 def get_installed_patches debug 'preparing to fetch installed patches' @installed_patches = [] end |
#get_installed_services ⇒ Object Also known as: get_installed_daemons
144 145 146 147 |
# File 'lib/boris/structure.rb', line 144 def get_installed_services debug 'preparing to fetch installed_services' @installed_services = [] end |
#get_local_user_groups ⇒ Object
149 150 151 152 |
# File 'lib/boris/structure.rb', line 149 def get_local_user_groups debug 'preparing to fetch users and groups' @local_user_groups = [] end |
#get_network_id ⇒ Object
154 155 156 157 158 159 160 |
# File 'lib/boris/structure.rb', line 154 def get_network_id debug 'preparing to fetch network id' @network_id = [ :domain, :hostname ].to_nil_hash end |
#get_network_interfaces ⇒ Object
162 163 164 165 |
# File 'lib/boris/structure.rb', line 162 def get_network_interfaces debug 'preparing to fetch network_interfaces' @network_interfaces = [] end |
#get_operating_system ⇒ Object
167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/boris/structure.rb', line 167 def debug 'preparing to fetch operating system' = [ :date_installed, :kernel, :license_key, :name, :service_pack, :version, :features=>[], :roles=>[] ].to_nil_hash end |
#get_running_processes ⇒ Object
181 182 183 184 |
# File 'lib/boris/structure.rb', line 181 def get_running_processes debug 'preparing to fetch running_processes' @running_processes = [] end |
#hosted_share_template ⇒ Object
33 34 35 36 37 38 |
# File 'lib/boris/structure.rb', line 33 def hosted_share_template [ :name, :path ].to_nil_hash end |
#installed_application_template ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/boris/structure.rb', line 40 def installed_application_template [ :date_installed, :install_location, :license_key, :name, :vendor, :version ].to_nil_hash end |
#installed_patch_template ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/boris/structure.rb', line 51 def installed_patch_template [ :date_installed, :installed_by, :patch_code ].to_nil_hash end |
#installed_service_template ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/boris/structure.rb', line 59 def installed_service_template [ :name, :install_location, :start_mode ].to_nil_hash end |
#local_user_groups_template ⇒ Object
67 68 69 70 71 72 |
# File 'lib/boris/structure.rb', line 67 def local_user_groups_template { :group=>nil, :members=>[] } end |
#network_interface_template ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/boris/structure.rb', line 74 def network_interface_template [ :auto_negotiate, :current_speed_mbps, :duplex, :fabric_name, :is_uplink, :mac_address, :model, :model_id, :mtu, :name, :node_wwn, :port_wwn, :remote_mac_address, :remote_wwn, :status, :type, :vendor, :vendor_id, :dns_servers=>[], :ip_addresses=>[] ].to_nil_hash end |
#running_process_template ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/boris/structure.rb', line 99 def running_process_template [ :command, :cpu_time, :date_started ].to_nil_hash end |
#scrub_data! ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/boris/helpers/scrubber.rb', line 5 def scrub_data! [ @file_systems, @hosted_shares, @installed_applications, @installed_patches, @installed_services, @local_user_groups, @network_interfaces ].collect {|arr| arr.clean_string_values_in_array if arr} debug 'string values from within data arrays cleaned up' [@hardware, @network_id, ].collect {|h| h.clean_string_values_in_hash if h} debug 'string values from within data hashes cleaned up' @installed_applications.collect do |app| app[:license_key].upcase! unless !app[:license_key] app[:name].clean_string app[:vendor].format_vendor unless !app[:vendor] end if @installed_applications debug 'installed application data cleaned up' if @network_id @network_id[:hostname].upcase! unless !@network_id[:hostname] @network_id[:domain].downcase! unless !@network_id[:domain] end debug 'network id data cleaned up' @network_interfaces.collect do |interface| interface[:fabric_name].downcase! unless !interface[:fabric_name] interface[:mac_address].upcase! unless !interface[:mac_address] interface[:model] = interface[:model].format_model unless !interface[:model] interface[:node_wwn].downcase! unless !interface[:node_wwn] interface[:port_wwn].downcase! unless !interface[:port_wwn] interface[:remote_mac_address].upcase! unless !interface[:remote_mac_address] interface[:remote_wwn].upcase! unless !interface[:remote_wwn] interface[:vendor] = interface[:vendor].format_vendor unless !interface[:vendor] end if @network_interfaces debug 'network interface data cleaned up' if @hardware @hardware[:cpu_model] = @hardware[:cpu_model].clean_string unless !@hardware[:cpu_model] @hardware[:cpu_vendor] = @hardware[:cpu_vendor].clean_string.format_vendor unless !@hardware[:cpu_vendor] @hardware[:model] = @hardware[:model].format_model unless !@hardware[:model] @hardware[:serial] = @hardware[:serial].format_serial unless !@hardware[:serial] @hardware[:vendor] = @hardware[:vendor].clean_string.format_vendor unless !@hardware[:vendor] end debug 'hardware data cleaned up' if [:license_key].upcase! unless ![:license_key] end debug 'operating system data cleaned up' debug 'data scrubbing complete' end |