Class: TCellAgent::SensorEvents::ServerAgentPackagesSensorEvent

Inherits:
TCellSensorEvent
  • Object
show all
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 inherited from TCellSensorEvent

#bucket_key, #calculateOffset, #post_process

Constructor Details

#initializeServerAgentPackagesSensorEvent



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

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