Class: TCellAgent::SensorEvents::ServerAgentPackagesSensorEvent

Inherits:
TCellSensorEvent
  • Object
show all
Includes:
ModuleLoggerAccess
Defined in:
lib/tcell_agent/sensor_events/server_agent.rb

Instance Attribute Summary

Attributes inherited from TCellSensorEvent

#ensure, #flush, #send

Instance Method Summary collapse

Methods included from ModuleLoggerAccess

#module_logger

Methods inherited from TCellSensorEvent

#bucket_key, #calculate_offset

Constructor Details

#initializeServerAgentPackagesSensorEvent

Returns a new instance of ServerAgentPackagesSensorEvent.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/tcell_agent/sensor_events/server_agent.rb', line 13

def initialize
  super('server_agent_packages')
  @flush = true
  @ensure = true
  packages = []
  Gem.loaded_specs.values.map do |x|
    begin
      if x.name
        package = { 'n' => x.name, 'v' => x.version.version }
        packages.push(package)
        module_logger.debug("Adding packages #{x.name}")
      end
    rescue StandardError => e
      module_logger.error("Exception adding package: #{e.message}")
      module_logger.exception(e)
    end
  end
  self['packages'] = packages
end