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.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/tcell_agent/sensor_events/server_agent.rb', line 66

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 => te
      module_logger.error("Exception adding package: #{te.message}")
      module_logger.exception(te)
    end
  end
  self['packages'] = packages
end